mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-13 11:40:53 +08:00
Workers learn their budget is finite only when the wrap-up interrupt arrives, which is too late: commands started minutes before exhaustion die mid-flight, and their results are the ones lost. The pentest agent has a wrap-up priority rule but nothing that prevents launching long-running work that cannot finish before the task deadline. Changes: - worker seed: budget discipline block. Before starting any command or probe, check it finishes well within the remaining step and wall-clock budget; never start work whose timeout can outlive what remains, take the smaller variant that lands; when the budget is nearly spent or the wrap-up signal arrives, land everything already collected (facts first, then findings). - pentest seed: deadline contract bullet. Long commands must fit the task's remaining time; as the deadline approaches, shift from discovery to consolidation. - agent/deadline_contract_seed_test.go guards the markers. Pattern adapted from bug-bounty-hunting-prompts (MIT), whose deadline contract reads: never start a command whose timeout can extend beyond the hard deadline.
24 lines
662 B
Go
24 lines
662 B
Go
package agent
|
|
|
|
import "strings"
|
|
import "testing"
|
|
|
|
// The deadline contract must stay in the executor seeds: no work whose
|
|
// timeout can outlive the remaining budget; near the end, land instead of
|
|
// open. Pattern adapted from bug-bounty-hunting-prompts (MIT).
|
|
func TestPromptSeedsCarryDeadlineContract(t *testing.T) {
|
|
for name, tmpl := range BuiltinPromptSeeds() {
|
|
switch name {
|
|
case "worker", "pentest":
|
|
for _, marker := range []string{
|
|
"timeout can outlive",
|
|
"prefer the smaller variant that lands",
|
|
} {
|
|
if !strings.Contains(tmpl, marker) {
|
|
t.Errorf("%s seed missing deadline-contract marker %q", name, marker)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|