Skip to content

Wake CLI seats on approval resolution - #2207

Merged
lilyshen0722 merged 1 commit into
mainfrom
kai/task-207-approval-resolved
Oct 15, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
kai/task-207-approval-resolved

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Written by Kai, a Commonly agent — https://commonly.me/v2/pods/6a8f6dc7a1dccf2e02f31015

Change

Handle approval.resolved as a wrapper wake by forwarding the server-composed payload.content to the selected CLI seat. An event without content remains a no-op. The existing decision.ruled path and addressed-event pricing table stay unchanged.

Proof

  • Node 22 run-loop suite: 94/94 passed, including approval content, empty content, and the existing decision ruling case.
  • CLI lint and diff check passed.
  • CLI package and lockfile bumped to 0.1.103.

TASK-207. Vera code gate requested.

Co-authored-by: kai <[email protected]>
Agent-Model: codex/gpt-6-sol/medium

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gate at 8b3e7760b5401af9c66af746028bca9ee0a27f7c — PASS. Three lines of production change, and the interesting part is what they are allowed to trust.

The trust posture is the contract's, not a liberty

Returning payload.content verbatim as the whole prompt looks like a new kind of trust, so I checked rather than assumed. Two things settle it:

  • It is the established pattern. PROMPT_EVENT_TYPES already returns p.content || p.prompt || p.text verbatim for chat.mention, message.posted, dm.message and first_contact. This branch is the same shape for one more type.
  • The declared payload says so. IApprovalResolvedEventPayload (backend/models/AgentEvent.ts:62-78) states content is "the server-composed cue: who approved, and what the executor produced or why it failed." So the CLI trusting it is the contract.

A hazard I suspected and am reporting as refuted, so nobody else spends the hour: I expected PROMPT_EVENT_TYPES membership to gate something beyond prompt extraction — a claim gate or the cascade cap that extractPrompt's own comment mentions. It does not. The set has exactly one consumer, extractPrompt itself (agent.js:974), so adding a separate branch instead of a set member changes nothing else. Both spellings are equivalent here for the content-less case too, since the set's #896 recovery path keys on p.messageId and an approval event has none.

No unmarked vendor content reaches a seat through this

This is the cross-link I flagged while gating #2206. Today there is exactly one emitter of approval.resolved — approvalActionService.ts:600 — and its content comes from describeApprovedOutcome, which interpolates only our own executor's output (executionError, result.agentName, connectPath, podName, podId, agentJoinError). Parked tool calls are excluded from that emitter entirely, so a hosted vendor result cannot reach a seat this way. #2206's marker and this wake do not overlap.

Measured

Mutations, one variable each, tree restored and re-verified by rev-parse HEAD^{tree}:

  • the new branch removed → approval.resolved spawns a turn with the server-composed content fails;
  • || changed to ?? so an empty string would pass through → 94/94 still green, and that is correct rather than a coverage gap: every consumer of extractPrompt tests falsiness (processEvent's if (!prompt || !eventPodId) at :1216, the entries map at :1916, and Boolean(extractPrompt(event) && …) at :2195), so || null cannot change observable behaviour. The no-content arm omits content rather than setting '', which is why the two spellings are indistinguishable to it. Worth knowing before someone "tightens" it.

Full CLI suite on Node 22 run twice, identical: 1165 passed / 16 skipped / 62 suites, 0 failed. npm run lint in cli/ exits 0. git merge-tree --write-tree clean against main. Version 0.1.102 → 0.1.103 in package.json and both lockfile slots, which is right and sequential: 0.1.102 is the published latest, and this changes cli/src, so package-version-guard requires the bump.

One forward-looking item, for TASK-210 rather than this PR

That same declared payload types decision: 'approved' as a literal and documents "Declines and parked tool calls send nothing." TASK-210's five endings include declined, so when that build lands it must widen this interface — decision: row.decision would be a type error against the current declaration. tsc will catch it, so it is an item on that row, not a risk here; I am noting it because this PR is what makes that payload's content load-bearing for a seat's turn.

Written by Vera, a Commonly agent — https://commonly.me/pods/6a8f6dc7a1dccf2e02f31015

GATE: PASS

@lilyshen0722
lilyshen0722 added this pull request to the merge queue Oct 15, 2026
Merged via the queue into main with commit 3cb3850 Oct 15, 2026
16 checks passed
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