Merge pull request #3498 from Disaster-Terminator/fix/task-id-prompt-surface
fix(prompts): prefer task_id in continuation guidance
This commit is contained in:
@@ -133,7 +133,7 @@ Count remaining **top-level task** checkboxes. Ignore nested verification/eviden
|
|||||||
[ ] Plan: Read plan file, confirmed current progress
|
[ ] Plan: Read plan file, confirmed current progress
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|
||||||
**If verification fails**: Resume the SAME session with the ACTUAL error output:
|
**If verification fails**: Resume the SAME task with the ACTUAL error output:
|
||||||
\`\`\`typescript
|
\`\`\`typescript
|
||||||
task(
|
task(
|
||||||
task_id="ses_xyz789",
|
task_id="ses_xyz789",
|
||||||
@@ -150,7 +150,7 @@ Every \`task()\` output includes a task_id. STORE IT.
|
|||||||
|
|
||||||
When a task fails:
|
When a task fails:
|
||||||
1. Diagnose what actually broke. Read the error, read the file, do not guess.
|
1. Diagnose what actually broke. Read the error, read the file, do not guess.
|
||||||
2. **Resume the SAME session** so the subagent keeps its full context:
|
2. **Resume the SAME task via \`task_id\`** so the subagent keeps its full context:
|
||||||
\`\`\`typescript
|
\`\`\`typescript
|
||||||
task(
|
task(
|
||||||
task_id="ses_xyz789",
|
task_id="ses_xyz789",
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ After delegation, ALWAYS verify: works as expected? follows codebase pattern? MU
|
|||||||
|
|
||||||
### Session Continuity
|
### Session Continuity
|
||||||
|
|
||||||
Every \`task()\` output includes a continuation ID (\`ses_...\`). **USE IT for follow-ups.**
|
Every \`task()\` output includes a task_id. **USE IT for follow-ups.**
|
||||||
|
|
||||||
- **Task failed/incomplete** - \`task(task_id="ses_...", prompt="Fix: {error}")\`
|
- **Task failed/incomplete** - \`task(task_id="ses_...", prompt="Fix: {error}")\`
|
||||||
- **Follow-up on result** - \`task(task_id="ses_...", prompt="Also: {question}")\`
|
- **Follow-up on result** - \`task(task_id="ses_...", prompt="Also: {question}")\`
|
||||||
|
|||||||
@@ -507,7 +507,7 @@ session_id: ses_standalone_def
|
|||||||
cleanupMessageStorage(sessionID)
|
cleanupMessageStorage(sessionID)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should include session_id and checkbox instructions in reminder", async () => {
|
test("should include task_id and checkbox instructions in reminder", async () => {
|
||||||
// given - boulder state, Atlas caller
|
// given - boulder state, Atlas caller
|
||||||
const sessionID = "session-resume-test"
|
const sessionID = "session-resume-test"
|
||||||
setupMessageStorage(sessionID, "atlas")
|
setupMessageStorage(sessionID, "atlas")
|
||||||
@@ -536,10 +536,11 @@ session_id: ses_standalone_def
|
|||||||
output
|
output
|
||||||
)
|
)
|
||||||
|
|
||||||
// then - should include verification instructions
|
// then - should include verification instructions and task_id guidance
|
||||||
expect(output.output).toContain("LYING")
|
expect(output.output).toContain("LYING")
|
||||||
expect(output.output).toContain("PHASE 1")
|
expect(output.output).toContain("PHASE 1")
|
||||||
expect(output.output).toContain("PHASE 2")
|
expect(output.output).toContain("PHASE 2")
|
||||||
|
expect(output.output).toContain("task_id")
|
||||||
|
|
||||||
cleanupMessageStorage(sessionID)
|
cleanupMessageStorage(sessionID)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ Answer honestly:
|
|||||||
ALL three must be YES. "Probably" = NO. "I think so" = NO. Investigate until CERTAIN.
|
ALL three must be YES. "Probably" = NO. "I think so" = NO. Investigate until CERTAIN.
|
||||||
|
|
||||||
- **All 3 YES** - Proceed: mark task complete, move to next.
|
- **All 3 YES** - Proceed: mark task complete, move to next.
|
||||||
- **Any NO** - Reject: resume session with \`session_id\`, fix the specific issue.
|
- **Any NO** - Reject: resume with \`task_id\`, fix the specific issue.
|
||||||
- **Unsure** - Reject: "unsure" = "no". Investigate until you have a definitive answer.
|
- **Unsure** - Reject: "unsure" = "no". Investigate until you have a definitive answer.
|
||||||
|
|
||||||
**DO NOT proceed to the next task until all 4 phases are complete and the gate passes.**`
|
**DO NOT proceed to the next task until all 4 phases are complete and the gate passes.**`
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ This section is CRITICAL for reviewer agents (momus, oracle) to maintain continu
|
|||||||
|
|
||||||
## 8. Delegated Agent Sessions
|
## 8. Delegated Agent Sessions
|
||||||
- List ALL background agent tasks spawned during this session
|
- List ALL background agent tasks spawned during this session
|
||||||
- For each: agent name, category, status, description, and **session_id**
|
- For each: agent name, category, status, description, and **task_id**
|
||||||
- **RESUME, DON'T RESTART.** Each listed session retains full context. After compaction, use \`session_id\` to continue existing agent sessions instead of spawning new ones. This saves tokens, preserves learned context, and prevents duplicate work.
|
- **RESUME, DON'T RESTART.** Each listed delegated task retains full context. After compaction, use \`task_id\` to continue existing delegated work instead of spawning new tasks. This saves tokens, preserves learned context, and prevents duplicate work.
|
||||||
|
|
||||||
This context is critical for maintaining continuity after compaction.
|
This context is critical for maintaining continuity after compaction.
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ describe("createCompactionContextInjector", () => {
|
|||||||
//#then
|
//#then
|
||||||
expect(prompt).toContain("Delegated Agent Sessions")
|
expect(prompt).toContain("Delegated Agent Sessions")
|
||||||
expect(prompt).toContain("RESUME, DON'T RESTART")
|
expect(prompt).toContain("RESUME, DON'T RESTART")
|
||||||
expect(prompt).toContain("session_id")
|
expect(prompt).toContain("task_id")
|
||||||
})
|
})
|
||||||
|
|
||||||
it("injects actual task history when backgroundManager and sessionID provided", async () => {
|
it("injects actual task history when backgroundManager and sessionID provided", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user