docs(coding-agent): updated background job guidance for automatic completion flow

- Updated bash, job, and task prompts to state that background results are delivered automatically when complete.
- Removed guidance encouraging repeated `jobs://` polling and clarified `job` with `poll` should be used only when a task is blocking.
- Changed the bash tool confirmation message to recommend doing other work while waiting for background jobs and polling only if needed.
This commit is contained in:
can1357
2026-05-12 03:19:31 +02:00
parent 975c0eacdb
commit 8fb0495017
4 changed files with 10 additions and 17 deletions
@@ -10,16 +10,6 @@ Executes bash command in shell session for terminal operations like git, bun, ca
{{#if asyncEnabled}}
- Use `async: true` for long-running commands when you don't need immediate output; the call returns a background job ID and the result is delivered automatically as a follow-up.
{{/if}}
{{#if autoBackgroundEnabled}}
- Long-running non-PTY commands may auto-background after ~{{autoBackgroundThresholdSeconds}}s and continue as background jobs.
{{/if}}
{{#if asyncEnabled}}
- Inspect background jobs with `read jobs://` (`read jobs://<job-id>` for detail). To wait for results, call `job` (with `poll`) — do NOT poll `read jobs://` in a loop or yield and hope for delivery.
{{else}}
{{#if autoBackgroundEnabled}}
- For auto-backgrounded jobs, inspect with `read jobs://` and call `job` (with `poll`) to wait — do NOT poll in a loop.
{{/if}}
{{/if}}
</instruction>
<output>
@@ -1,11 +1,11 @@
Manages background jobs: poll to wait for completion, cancel to stop running jobs.
You **MUST** use the `job` tool (in a loop, if necessary) instead of manually reading in a loop or issuing sleep commands.
Background job results are delivered automatically when possible. Read the `jobs://` URI, or `jobs://<id>` for detail, only for inspection when useful — not for waiting.
Pass `poll` to wait for one or more background jobs to finalize. If the timeout elapses before any job changes state, it returns the current snapshot (still-running jobs and any already-completed deliveries) without erroring — call `job` again to keep waiting. Calling with no `poll` and no `cancel` waits on every running background job.
If you are genuinely blocked on a background job result, pass `poll` to wait for one or more jobs to finalize. If the timeout elapses before any job changes state, it returns the current snapshot (still-running jobs and any already-completed deliveries) without erroring. Calling with no `poll` and no `cancel` waits on every running background job.
You **MUST NOT** poll the same job repeatedly without evidence of progress. Between calls, inspect `read jobs://<id>` to confirm new output or activity. If a job is stalled, has hung, or is producing nothing useful, cancel it via `cancel` and try a different approach instead of waiting indefinitely.
You **MUST NOT** wait by repeatedly reading the `jobs://` URI or `jobs://<id>` URI. If a job is stalled, has hung, or is producing nothing useful, cancel it via `cancel` and try a different approach instead of waiting indefinitely.
Pass `cancel` to stop one or more running background jobs (started via async tool execution or bash auto-backgrounding). You **SHOULD** cancel jobs that are no longer needed or stuck. You **MAY** inspect jobs first with `read jobs://` or `read jobs://<job-id>`.
Pass `cancel` to stop one or more running background jobs (started via async tool execution or bash auto-backgrounding). You **SHOULD** cancel jobs that are no longer needed or stuck. You **MAY** inspect the `jobs://` URI, or `jobs://<job-id>`, first.
`poll` and `cancel` may be combined in a single call: cancellations apply first, then polling waits on the remaining ids. When only `cancel` is provided the call returns immediately without waiting.
@@ -1,8 +1,9 @@
Launches subagents to parallelize workflows.
{{#if asyncEnabled}}
- `read jobs://` for state, `read jobs://<id>` for detail.
- Use `job` (with `poll`) to wait. **MUST NOT** poll `read jobs://` in a loop.
- Results are delivered automatically when complete.
- If genuinely blocked on task completion, wait with `job` using `poll`; otherwise continue with another task when possible.
- You can also read the `jobs://` URI for manager state and `jobs://<id>` for detail only when inspection is useful.
{{/if}}
Subagents have no conversation history. Every fact, file path, and decision they need **MUST** be explicit in {{#if contextEnabled}}`context` or `assignment`{{else}}each `assignment`{{/if}}.
+3 -1
View File
@@ -326,7 +326,9 @@ export class BashTool implements AgentTool<BashToolSchema, BashToolDetails> {
}
lines.push(`Background job ${jobId} started: ${label}`);
lines.push("Result will be delivered automatically when complete.");
lines.push(`If blocked, use \`job\` with \`poll\`; inspect with \`read jobs://${jobId}\` or cancel with \`job\`.`);
lines.push(
`You can use \`job\` to poll until complete, but prefer to continue with another task in the meanwhile if it's not blocking.`,
);
return {
content: [{ type: "text", text: lines.join("\n") }],
details,