fix(agents): fix checkpoint permissions + simplify dispatch to eliminate per-task API calls
- Change checkpoint from echo (blocked by 'echo $*' pattern) to sleep 0 - Rewrite dispatch step to launch ONE worker at a time sequentially instead of batching, reducing cognitive load on the model - Simplify implementation supervisor worker parameters: always pass default tier values (tier 1/haiku, is_first_attempt=true) and let the worker's dispatcher mode handle escalation logic by reading comments itself. This eliminates 14+ API calls the supervisor was supposed to make before each dispatch cycle.
This commit is contained in:
@@ -230,27 +230,17 @@ worker parameters:
|
||||
- `work_type`: Whether this is a PR fix ("pr_fix") or new issue implementation ("issue_impl")
|
||||
- `work_number`: The PR or issue number to handle
|
||||
- `work_title`: The title of the PR or issue
|
||||
- `escalation_tier`: The current escalation tier (-2 to 4); determined from the PR/issue comment history; defaults to 0 (gpt-5-mini) for first attempts
|
||||
- `tier_agent`: The tier selector agent to dispatch; derived from `escalation_tier`
|
||||
- `is_first_attempt`: True if no prior "Implementation Attempt" comments were found for this work item; triggers the estimator in the worker on first dispatch
|
||||
- `escalation_tier`: Always pass `1` — the worker determines the actual tier itself
|
||||
- `tier_agent`: Always pass `tier-haiku` — the worker determines the actual tier itself
|
||||
- `is_first_attempt`: Always pass `true` — the worker determines this itself by reading comments
|
||||
|
||||
worker parameter fetch algorithms:
|
||||
- `work_type`: "pr_fix" for tasks from the `failing_ci_pr` group; "issue_impl" for tasks from `request_changes_pr` or `new_issue` groups
|
||||
- `work_number`: Taken directly from the task item (PR or issue number)
|
||||
- `work_title`: Taken directly from the task item (PR or issue title)
|
||||
- `escalation_tier` and `is_first_attempt`: Read all comments on the PR or issue. Find comments matching the "Implementation Attempt" pattern (posted by workers). Determine as follows:
|
||||
1. No previous attempt comments found → `escalation_tier = 1`, `is_first_attempt = true`
|
||||
2. Prior attempts found; most recent consecutive attempt comments at tier N all show the same failure with no progress → `escalation_tier = N+1` (capped at 4), `is_first_attempt = false`
|
||||
3. Prior attempts found; most recent attempt at tier N shows a different error or incremental progress (new tests passing, reviewer feedback addressed, different failure mode) → `escalation_tier = N`, `is_first_attempt = false`
|
||||
4. At tier 4 with 3 or more consecutive same-failure attempts and no progress → do NOT dispatch a worker; instead post a human escalation comment explaining what was attempted across all tiers and what the persistent problem is; mark this item as blocked from further dispatch
|
||||
- `tier_agent`: Derived from `escalation_tier`:
|
||||
- -2 → `tier-gpt5-nano`
|
||||
- -1 → `tier-o4-mini`
|
||||
- 0 → `tier-gpt5-mini`
|
||||
- 1 → `tier-haiku` (default for first attempts)
|
||||
- 2 → `tier-codex`
|
||||
- 3 → `tier-sonnet`
|
||||
- 4 → `tier-opus`
|
||||
- `escalation_tier`: Always `1` (the worker's dispatcher mode reads comments and adjusts the tier before forwarding)
|
||||
- `tier_agent`: Always `tier-haiku` (the worker's dispatcher mode may override this based on estimator results)
|
||||
- `is_first_attempt`: Always `true` (the worker's dispatcher mode determines the actual value)
|
||||
|
||||
task groups in priority order: `failing_ci_pr`, `request_changes_pr`, `new_issue`
|
||||
|
||||
|
||||
@@ -100,12 +100,12 @@ Startup steps:
|
||||
**CRITICAL: Every step below MUST produce at least one tool call. Never output text between steps without a tool call. After each tool result returns, immediately make the next tool call — do not pause to summarize or narrate.**
|
||||
|
||||
1. Fetch the task list for every task group using its respective fetch algorithm, ensure you fetch **every** task group up front.
|
||||
2. After ALL task groups are fetched, run `bash("echo DISPATCH_PHASE")` to checkpoint, then immediately count the tasks in each group.
|
||||
2. After ALL task groups are fetched, run `bash("sleep 0")` to checkpoint, then immediately count the tasks in each group.
|
||||
3. If no task groups have any pending tasks, call the bash tool as `bash("sleep {idle_sleep_interval}", timeout=360000)` then go to step 8
|
||||
4. Determine how many worker slots are available by asking the subagent `async-agent-util` to find sessions by prefix `{tag_prefix}` with `--exclude-supervisor`, then compute: available = `{max_pool}` minus the number of busy worker sessions returned.
|
||||
5. If no worker slots are available, skip to step 8
|
||||
6. For each available slot, dispatch a new worker using the `async-agent-util` subagent to launch the agent named `{worker_subagent_name}`, passing it the next task from the highest priority non-empty group. You MUST make the dispatch tool call — do not describe the dispatch, execute it.
|
||||
7. After dispatching, run `bash("echo DISPATCH_COMPLETE")` to checkpoint.
|
||||
6. For each available slot dispatch ONE worker at a time: call the `async-agent-util` subagent to launch `{worker_subagent_name}` with the next task from the highest priority non-empty group. Make the Task tool call NOW — do not describe it, do not plan it, just call it. After async-agent-util returns, immediately dispatch the next worker (or proceed to step 7 if all slots are filled or all tasks are assigned).
|
||||
7. After dispatching, run `bash("sleep 0")` to checkpoint.
|
||||
8. Monitor all running workers — see the section below titled "Workers" and specifically subsection "How to monitor".
|
||||
9. If `{status_interval}` seconds have elapsed since the last status update was generated, generate a new status update now
|
||||
10. Go to step 1
|
||||
|
||||
Reference in New Issue
Block a user