Skip to content

fix(delegation): close the caller loop — default poke-back ON + deliver to a live caller (v0.223.0)#372

Merged
vikasprogrammer merged 1 commit into
mainfrom
feat/poke-caller-default
Jul 16, 2026
Merged

fix(delegation): close the caller loop — default poke-back ON + deliver to a live caller (v0.223.0)#372
vikasprogrammer merged 1 commit into
mainfrom
feat/poke-caller-default

Conversation

@vikasprogrammer

Copy link
Copy Markdown
Owner

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

  1. The mechanism never engaged. poke_on_done was opt-in and defaulted off, and the live instapods data confirms no agent ever set itcaller_agent is null on every task, and there are zero agent.poked events in the whole audit history. So the caller was never recorded and never woken; only the human owner got a task.notified DM.

  2. Even when it fired, a live caller was skipped. pokeCaller skipped 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_create defaults the async wake ON for an agent→agent hand-off, so the delegation loop closes itself. Opt out with poke_on_done: false; wait: true still supersedes with a synchronous block; a self-assignment never wakes (guarded server-side too).
  • pokeCaller delivers 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-proven injectToSession primitive that powers console Quick Shortcuts / deliverToResident — falling back to a --resume only when the caller has already exited.

Verification

  • MCP default truth table (agent hand-off ON, opt-out, wait supersedes, self-assign / open / human assignee never wake) — ✅
  • Server self-poke guard (cross-agent stamped, self-poke dropped, human not stamped) — ✅
  • In-memory TaskStore round-trip: caller fields persist and a done status-notice carries them to maybePokeCaller — ✅
  • npm run typecheck clean · npm run build clean · 68/68 governance conformance — ✅

🤖 Generated with Claude Code

@vikasprogrammer
vikasprogrammer force-pushed the feat/poke-caller-default branch from 150d801 to b75cf2d Compare July 16, 2026 09:27
…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
vikasprogrammer force-pushed the feat/poke-caller-default branch from b75cf2d to 1b00f8d Compare July 16, 2026 09:28
@vikasprogrammer
vikasprogrammer merged commit bd26ae3 into main Jul 16, 2026
1 check passed
@vikasprogrammer
vikasprogrammer deleted the feat/poke-caller-default branch July 16, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant