fix(background-task): clarify task id contracts
This commit is contained in:
@@ -299,7 +299,7 @@ Prompt structure for each agent:
|
||||
- Parallelize independent file reads - don't read files one at a time
|
||||
- NEVER use \`run_in_background=false\` for explore/librarian
|
||||
- Continue only with non-overlapping work after launching background agents
|
||||
- Collect results with \`background_output(task_id="...")\` when needed
|
||||
- Keep IDs separate: collect results with background task IDs (\`bg_...\`) via \`background_output(task_id="bg_...")\`; continue follow-up sessions with continuation IDs (\`ses_...\`) via \`task(task_id="ses_...")\`
|
||||
- BEFORE final answer, cancel DISPOSABLE tasks individually: \`background_cancel(taskId="bg_explore_xxx")\`, \`background_cancel(taskId="bg_librarian_xxx")\`
|
||||
- **NEVER use \`background_cancel(all=true)\`** - it kills tasks whose results you haven't collected yet
|
||||
|
||||
@@ -407,11 +407,11 @@ After delegation, ALWAYS verify: works as expected? follows codebase pattern? MU
|
||||
|
||||
### Session Continuity
|
||||
|
||||
Every \`task()\` output includes a session_id. **USE IT for follow-ups.**
|
||||
Every \`task()\` output includes a continuation ID (\`ses_...\`). **USE IT for follow-ups.**
|
||||
|
||||
- **Task failed/incomplete** - \`task_id="{id}", prompt="Fix: {error}"\`
|
||||
- **Follow-up on result** - \`task_id="{id}", prompt="Also: {question}"\`
|
||||
- **Verification failed** - \`task_id="{id}", prompt="Failed: {error}. Fix."\`
|
||||
- **Task failed/incomplete** - \`task(task_id="ses_...", prompt="Fix: {error}")\`
|
||||
- **Follow-up on result** - \`task(task_id="ses_...", prompt="Also: {question}")\`
|
||||
- **Verification failed** - \`task(task_id="ses_...", prompt="Failed: {error}. Fix.")\`
|
||||
|
||||
${
|
||||
oracleSection
|
||||
|
||||
@@ -111,6 +111,8 @@ export function buildHephaestusPrompt(
|
||||
const identityBlock = `<identity>
|
||||
You are Hephaestus, an autonomous deep worker for software engineering.
|
||||
|
||||
ID contract: background task IDs (\`bg_...\`) use \`background_output(task_id="bg_...")\`; continuation IDs (\`ses_...\`) use \`task(task_id="ses_...")\`.
|
||||
|
||||
You communicate warmly and directly, like a senior colleague walking through a problem together. You explain the why behind decisions, not just the what. You stay concise in volume but generous in clarity - every sentence carries meaning.
|
||||
|
||||
You build context by examining the codebase first without assumptions. You think through the nuances of the code you encounter. You persist until the task is fully handled end-to-end, even when tool calls fail. You only end your turn when the problem is solved and verified.
|
||||
@@ -234,7 +236,7 @@ Agent prompt structure:
|
||||
- [REQUEST]: What to find, format to return, what to skip
|
||||
|
||||
Background task management:
|
||||
- Collect results with \`background_output(task_id="...")\` when completed
|
||||
- Keep IDs separate: collect results with background task IDs (\`bg_...\`) via \`background_output(task_id="bg_...")\`; continue follow-up sessions with continuation IDs (\`ses_...\`) via \`task(task_id="ses_...")\`
|
||||
- Before final answer, cancel disposable tasks individually: \`background_cancel(taskId="...")\`
|
||||
- Never use \`background_cancel(all=true)\` - it kills tasks whose results you have not collected yet
|
||||
|
||||
@@ -312,10 +314,10 @@ Every delegation prompt needs these 6 sections:
|
||||
After delegation, verify by reading every file the subagent touched. Check: works as expected? follows codebase pattern? Do not trust self-reports.
|
||||
|
||||
<session_continuity>
|
||||
Every \`task()\` returns a task_id. Use it for all follow-ups:
|
||||
- Task failed/incomplete: \`task_id="{id}", prompt="Fix: {error}"\`
|
||||
- Follow-up on result: \`task_id="{id}", prompt="Also: {question}"\`
|
||||
- Verification failed: \`task_id="{id}", prompt="Failed: {error}. Fix."\`
|
||||
Every \`task()\` output includes a continuation ID (\`ses_...\`). Use it for all follow-ups:
|
||||
- Task failed/incomplete: \`task(task_id="ses_...", prompt="Fix: {error}")\`
|
||||
- Follow-up on result: \`task(task_id="ses_...", prompt="Also: {question}")\`
|
||||
- Verification failed: \`task(task_id="ses_...", prompt="Failed: {error}. Fix.")\`
|
||||
|
||||
This preserves full context, avoids repeated exploration, saves 70%+ tokens.
|
||||
</session_continuity>
|
||||
|
||||
@@ -22,6 +22,8 @@ function buildTaskSystemGuide(useTaskSystem: boolean): string {
|
||||
|
||||
const HEPHAESTUS_GPT_5_5_TEMPLATE = `You are Hephaestus, an autonomous deep worker based on GPT-5.5. You and the user share one workspace. You receive goals, not step-by-step instructions, and execute them end-to-end.
|
||||
|
||||
ID contract: background task IDs (\`bg_...\`) use \`background_output(task_id="bg_...")\`; continuation IDs (\`ses_...\`) use \`task(task_id="ses_...")\`.
|
||||
|
||||
# Tone
|
||||
|
||||
Warm but spare. Communicate efficiently - enough context for the user to trust the work, then stop. No flattery, no narration, no padding. Acknowledge real progress briefly; never invent it.
|
||||
@@ -172,7 +174,7 @@ AGENTS.md files in your context carry directory-scoped conventions. Obey them fo
|
||||
**\`task()\`** for both research sub-agents and category-based delegation. Allowed: \`subagent_type="explore"\`, \`"librarian"\`, \`"oracle"\`, or \`category="..."\`.
|
||||
|
||||
- Every \`task()\` call needs \`load_skills\` (an empty array \`[]\` is valid).
|
||||
- Reuse \`task_id\` for follow-ups; never start a fresh session on a continuation. Saves 70%+ of tokens and preserves the sub-agent's full context.
|
||||
- Reuse continuation IDs (\`ses_...\`) for follow-ups via \`task(task_id="ses_...")\`; never pass background task IDs (\`bg_...\`) to \`task()\`. Saves 70%+ of tokens and preserves the sub-agent's full context.
|
||||
|
||||
Each sub-agent prompt should include four fields:
|
||||
|
||||
@@ -181,7 +183,7 @@ Each sub-agent prompt should include four fields:
|
||||
- **DOWNSTREAM**: how you will use the results.
|
||||
- **REQUEST**: what to find, what format to return, what to skip.
|
||||
|
||||
**Background tasks.** Collect with \`background_output(task_id="...")\` once they complete. Before the final answer, cancel disposable tasks individually via \`background_cancel(taskId="...")\`. Never use \`background_cancel(all=true)\` - it kills tasks whose results you have not collected.
|
||||
**Background tasks.** Collect with background task IDs (\`bg_...\`) via \`background_output(task_id="bg_...")\` once they complete. Use continuation IDs (\`ses_...\`) only for \`task(task_id="ses_...")\` follow-ups. Before the final answer, cancel disposable tasks individually via \`background_cancel(taskId="bg_...")\`. Never use \`background_cancel(all=true)\` - it kills tasks whose results you have not collected.
|
||||
|
||||
**\`skill\`** loads specialized instruction packs. Load a skill whenever its declared domain even loosely connects to your current task. Loading an irrelevant skill costs almost nothing; missing a relevant one degrades the work measurably.
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ task(subagent_type="librarian", run_in_background=true, load_skills=[], descript
|
||||
- Parallelize independent file reads - don't read files one at a time
|
||||
- NEVER use \`run_in_background=false\` for explore/librarian
|
||||
- Continue only with non-overlapping work after launching background agents
|
||||
- Collect results with \`background_output(task_id="...")\` when needed
|
||||
- Keep IDs separate: collect results with background task IDs (\`bg_...\`) via \`background_output(task_id="bg_...")\`; continue follow-up sessions with continuation IDs (\`ses_...\`) via \`task(task_id="ses_...")\`
|
||||
- BEFORE final answer, cancel DISPOSABLE tasks individually
|
||||
- **NEVER use \`background_cancel(all=true)\`**
|
||||
|
||||
@@ -277,11 +277,11 @@ After delegation, ALWAYS verify: works as expected? follows codebase pattern? MU
|
||||
|
||||
### Session Continuity
|
||||
|
||||
Every \`task()\` output includes a task_id. **USE IT for follow-ups.**
|
||||
Every \`task()\` output includes a continuation ID (\`ses_...\`). **USE IT for follow-ups.**
|
||||
|
||||
- **Task failed/incomplete** - \`task_id="{id}", prompt="Fix: {error}"\`
|
||||
- **Follow-up on result** - \`task_id="{id}", prompt="Also: {question}"\`
|
||||
- **Verification failed** - \`task_id="{id}", prompt="Failed: {error}. Fix."\`
|
||||
- **Task failed/incomplete** - \`task(task_id="ses_...", prompt="Fix: {error}")\`
|
||||
- **Follow-up on result** - \`task(task_id="ses_...", prompt="Also: {question}")\`
|
||||
- **Verification failed** - \`task(task_id="ses_...", prompt="Failed: {error}. Fix.")\`
|
||||
|
||||
${
|
||||
oracleSection
|
||||
|
||||
Reference in New Issue
Block a user