fix(delegation): close the caller loop — default poke-back ON + deliver to a live caller (v0.223.0)#372
Merged
Merged
Conversation
vikasprogrammer
force-pushed
the
feat/poke-caller-default
branch
from
July 16, 2026 09:27
150d801 to
b75cf2d
Compare
…er (v0.223.0) An agent that dispatched a task to another agent never learned it finished unless a human said "check that task status" — two compounding gaps: 1. poke_on_done was opt-in/off and no agent set it, so caller_agent was never recorded (null on every prod task) and the caller was never woken. task_create now defaults the async wake ON for an agent→agent hand-off (opt out with poke_on_done:false; wait:true still supersedes; a self-assignment never wakes, guarded server-side too). 2. pokeCaller skipped a still-live caller on the wrong assumption it would "see the result itself" — an interactive/resident caller sits idle at the prompt and observes nothing. It now injects the result into the live pane (idle→runs now, mid-turn→queues) and only --resumes a caller that exited. Verified: MCP default truth table, server self-poke guard, and an in-memory TaskStore round-trip (caller fields persist; a done status-notice carries them to maybePokeCaller). Typecheck + 68/68 governance conformance green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vikasprogrammer
force-pushed
the
feat/poke-caller-default
branch
from
July 16, 2026 09:28
b75cf2d to
1b00f8d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
When an agent dispatched a task to another agent (caller → callee), the caller was never notified when the callee finished — you had to manually type "check that task status pls" for it to poll and find out.
Root cause — two compounding gaps
The mechanism never engaged.
poke_on_donewas opt-in and defaulted off, and the live instapods data confirms no agent ever set it —caller_agentis null on every task, and there are zeroagent.pokedevents in the whole audit history. So the caller was never recorded and never woken; only the human owner got atask.notifiedDM.Even when it fired, a live caller was skipped.
pokeCallerskipped delivery when the caller's session was still alive, on the assumption it "will observe the outcome itself." But an interactive/resident caller (the session you're chatting with) sits idle at the prompt after ending its turn — it observes nothing. That's the exact symptom.The fix
task_createdefaults the async wake ON for an agent→agent hand-off, so the delegation loop closes itself. Opt out withpoke_on_done: false;wait: truestill supersedes with a synchronous block; a self-assignment never wakes (guarded server-side too).pokeCallerdelivers into a live caller by injecting the result into its pane (idle → runs now, mid-turn → queues to the next turn boundary) via the same production-proveninjectToSessionprimitive that powers console Quick Shortcuts /deliverToResident— falling back to a--resumeonly when the caller has already exited.Verification
TaskStoreround-trip: caller fields persist and adonestatus-notice carries them tomaybePokeCaller— ✅npm run typecheckclean ·npm run buildclean · 68/68 governance conformance — ✅🤖 Generated with Claude Code