Skip to content

feat(tool): contract v2 with session ids, list and close - #1709

Merged
backnotprop merged 5 commits into
mainfrom
feat/tool-contract-v2-list-close
Oct 5, 2026
Merged

backnotprop merged 5 commits into
mainfrom
feat/tool-contract-v2-list-close

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Part of the 0.29 agent-sessions work (design: .product/drafts/agent-sessions-0.29/DESIGN.md).

What it does

  • plannotator tool contract v2 (packages/shared/plannotator-tool.ts, plus the mod's copy): annotate target accepts a list, new list and close actions, reply reserved for the comment loop. Results and decision headings carry a session id (pn-…).
  • /api/host/status and /api/host/close on the Bun and Pi servers, guarded like the pull bridge (loopback host, no Origin, bearer token). An agent's close works like the reviewer's Close, keeps the draft, and tells the open tab.
  • Claude Code mod: list and close only see this session's own reviews. Older CLIs fall back to stopping the process, which keeps the draft too.
  • Plan, annotate and code review show "Closed by the Agent" with the count of unsent comments.

Not in this PR: several files in one review (the server mode), the Pi and OpenCode 2 tool, and the comment loop. Each lands in a later PR.

backnotprop and others added 5 commits October 5, 2026 08:18
…tatus/close endpoints

- plannotator tool contract v2 (packages/shared/plannotator-tool.ts + mod copy):
  target accepts a list for annotate, new list/close actions, reply reserved,
  pn- session ids in results and decision headings, shared list/close texts.
- /api/host/status and /api/host/close on the Bun and Pi servers, guarded like
  the pull bridge; close is the reviewer's Close marked closedBy agent, keeps
  the draft, and tells the tab over the external-annotation SSE.
- Claude Code mod: list/close scoped to the session's own launches, TERM
  fallback for older CLIs, session ids in tool results and decision turns.
- Editor and review app show 'Closed by the Agent' with the unsent count.
…er Plannotator

- An older CLI's app page (200 text/html, before the /api/* 404 guard) or a
  JSON 404 no longer reads as closed; only a JSON answer with a numeric
  unsentAnnotations does (classifyHostCloseAnswer).
- TERM fallback: never on a failed connection; the stop script skips the kill
  when result.json/exit is already there and when the pid no longer names a
  plannotator process.
- After Claude's close, a decision record without closedBy (or an older CLI's
  exit 0) is the reviewer's and is delivered, not swallowed.
- Engine-harness case for list/close through $.http.fetch (GET, no body).

Co-Authored-By: Claude <noreply@anthropic.com>
…e reviewer's comments

- /api/feedback and /api/exit answer 409 after the session is decided (a host
  close included) on Bun and Pi, like annotate, so a tab left open neither
  deletes the kept draft nor gets ok for feedback nobody receives.
- countUnsentDraftComments skips source-tagged entries (review agents, WebMCP,
  linters) and counts PR description and PR comment notes.
- Host control is not tied to the pull bridge: it still answers under
  PLANNOTATOR_AI=disabled (comments corrected).

Co-Authored-By: Claude <noreply@anthropic.com>
…is conversation's reviews

- Tab and tool-result copy say the comments are saved as a draft; the tab
  promises a restore only for the same unchanged document (annotate) or the
  same changes (code review).
- Tool description: list/close cover reviews opened in this conversation,
  including slash-command ones; the invalid-action error lists "reply".
- AGENTS.md: list/close under Version skew with the remaining old-CLI TERM
  window; host control answers under PLANNOTATOR_AI=disabled; 409 after close.

Co-Authored-By: Claude <noreply@anthropic.com>
- Host control turned off (remote mode, no token) answers
  404 { code: "host_control_disabled" } in both runtimes; the mod reads it as
  turned off, not as an older CLI, and tells Claude to close it from the tab.
- STOP_SCRIPT checks that ps can describe its own pid first; where it cannot
  (no procps, BusyBox ps without -p) it signals nothing (exit 6) and the close
  says the review was left running.
- AGENTS.md: both cases under Version skew and Host session control.

Co-Authored-By: Claude <noreply@anthropic.com>
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