Repository navigation
fix(annotate): a bare Done starts no agent turn on any plugin host; submits count every document's and message's comments - #1701
Merged
Conversation
…s count every document's comments - The editor marks a Done whose payload is the zero-state sentence with nothingToSend: true. Both annotate servers carry it onto the decision only next to empty annotation arrays (isNothingToSendFeedbackBody), and the Claude Code mod's host result record turns it into noop. Plain stdout, --json, strict gates, OpenCode and Pi output are unchanged. - The mod's legacyResult treats the zero-state sentences an older CLI prints as a no-op. - The submit body's annotations now carry every document's comments (folder sessions, linked documents, multi-message annotate-last) via collectSubmittedAnnotations, so annotationCount, the mod's 'N comments' and the feedback archive counts match the feedback text. Comments on another document carry the additive documentPath field, recorded by the archive.
- Pi: classifyAnnotateOutcome reads a nothingToSend decision as 'Annotation closed (no feedback).' (no follow-up message). - OpenCode embedded handlers (handleAnnotateCommand, handleAnnotateLastCommand) send no prompt for it. - The CLI adds an additive nothingToSend: true to the non-strict annotate --json record and the opencode-annotate-last record in that case only; the OpenCode CLI bridge (OC1 CLI runtime, OC2 native commands) honors it. Plaintext, --hook, the strict-gate record and exit codes are unchanged.
…ries external comments - Amp (formatAnnotationFeedback) and Droid (emitAnnotateDecision) read annotate --json too: an annotated record marked nothingToSend now sends nothing. Records from an older CLI (no field) behave as before. - Multi-message annotate-last built its entries from local annotations only, so SSE external (agent / WebMCP) comments were missing from the exported feedback, the submit body and the archive, and a session holding only such a comment posted the no-feedback sentence marked nothing to send. mergeExternalsIntoMessageEntries puts them on the current message; the header's has-annotations check counts them too.
1 task
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.
Two bugs from the 0.28.1 smoke tests. Both were already in 0.28.0. Target: 0.28.2.
1. Done with nothing to send started a Claude turn (Claude Code mod)
Clicking Done in an annotate session with no annotations made Claude start a turn that contradicted itself: "Plannotator: notes.md — Feedback." followed by "User reviewed the document and has no feedback. Please address the annotation feedback above."
Cause: for a bare Done, the editor posts the zero-state sentence as
feedback, andannotateHostResultonly treated empty feedback asnoop.Fix: the server now recognizes this case from the request structure instead of matching the English sentence:
nothingToSend: trueto the/api/feedbackbody when its payload is the zero-state sentence. Content-bearing bodies are byte-identical to before.annotationsandcodeAnnotationsare empty (isNothingToSendFeedbackBodyinpackages/shared/annotate-decision.ts). A body that carries annotations is never treated as "nothing".annotateHostResultturns the flag intonoop: truewith an emptymessage. The mod then logs "notes.md closed with no annotations. Nothing was sent to Claude." and starts no turn.legacyResult(used when the CLI is older than the host result file) now treats the two zero-state sentences as no-ops.delivery.test.tschecks them against the editor's own constants.Outputs for Done with nothing to send, before and after
User reviewed the document and has no feedback.--json(non-strict){"decision":"annotated","feedback":"User reviewed…"}"nothingToSend":trueonly in this case--require-approval/--result-file)--gatethe empty primary is Approve on/api/approve--hook{"decision":"block","reason":"User reviewed…"}noop:false, a turn with "…Please address the annotation feedback above."noop:true,message:"", log line onlynothingToSendfrom the--json/opencode-annotate-lastrecord)commands.ts)/plannotator-annotate,/plannotator-last)followUpfeedback prompt containing the sentenceformatAnnotationFeedback, reads--json)emitAnnotateDecision, reads--json)decision: "feedback"plus a sidecar holding the sentenceAlso checked:
noop, and an annotated decision with zero annotations is alreadynoop.nothingToSend, which is correct because the reviewer chose to discard everything.Not changed:
feedbackwith a sidecar, not as a decision-only line. Fixing that is not a one-place change in the normalizer: both servers would have to pass the flag, and it needs a decision value for "done". So it is left as is.--jsonfield, so the mod, the OpenCode CLI bridge, Amp and Droid still start the turn until the binary updates. The OpenCode embedded runtime and Pi ship their own server, so they are fixed as soon as the plugin is.2. Folder session: "Feedback · 1 comment" for 2 comments
The posted
annotationsarray held only the open document's comments. As a result,annotationCount, the mod's "N comments" and the archive'scounts.annotationsall undercounted.Fix: a new
collectSubmittedAnnotations(packages/editor/feedbackDocuments.ts) builds the array from the sameresolveFeedbackSectionssplit the feedback text is exported from:Multi-message annotate-last and external comments: each message's entry was built from LOCAL annotations only (
snapshotSession). SSE external comments (agent / WebMCP) were therefore missing from the exported feedback, the submit body and the archive. A session holding only such a comment posted the "no feedback" sentence markednothingToSend. A newmergeExternalsIntoMessageEntriesmerges them into the CURRENT message's entry, falling back to the latest message, and dedupes them against draft-restored copies. The export and the collector both read it. The header's has-annotations check now counts externals in this mode too, so the primary reads Send Feedback.It is used by both
/api/feedbackand/api/approvebodies.Archive: each comment on a document other than the session's own target carries the new additive
documentPath, and the archive normalizer records it. This follows the cross-tool contract: the field is added, not repurposed.filekeeps its existing meaning, a code annotation's file. AGENTS.md is updated.Verification
Headless Chromium against the real CLI (temp
PLANNOTATOR_DATA_DIR,--use-mock-keychain --password-store=basic, freshly builtapps/hook/dist):a.mdandb.md:annotationsholds 2 entries, each with itsdocumentPathannotationCount: 2counts.annotations: 2anddocumentPathper record--jsonis{"decision":"annotated",…}nothingToSend: truenoop: true,message: ""New tests:
apps/hook/server/annotate-host-result.test.ts: real CLI process in plain and--jsonmodes, the flag ignored when annotations are present, and a folder session with the archive on. With the host-result change reverted, the two no-op tests fail.host-result.test.ts,annotate-decision.test.ts,feedbackDocuments.test.ts(collectSubmittedAnnotations).App.decisionControl.test.tsx: Done carries the flag; a note does not.delivery.test.ts(legacy sentences),controller.test.ts(the CLI's record through the in-memory Host gives a log and no submit; the legacy stdout path likewise).annotate-output.test.ts:--jsongains the field only for a bare Done; plaintext,--hookand the strict serializer stay byte-identical.annotate-outcome.test.ts(a bare Done delivers nothing).plannotator.test.ts(registered annotate/last commands append nothing for a bare Done). Droid:run-plannotator.test.js(prints "Annotation session closed.").feedbackDocuments.test.ts:mergeExternalsIntoMessageEntries. An external comment reaches the export, which is no longer the sentence, and the submit body. Draft-restored copies are not doubled.commands.test.ts: embedded annotate and last send no prompt.cli-bridge.test.ts: no prompt from anothingToSendrecord.annotate-done-cli.test.ts: the bridge runs the REAL CLI. A bare Done sends no prompt, and real feedback still does; with the bridge check removed, the Done test fails.Suites:
bun run typecheck, including the mod typecheck: clean.bun test: 6155 pass, 0 fail.apps/opencode-plugin: 301 pass.apps/pi-extension: 358 pass.apps/hook: 446 pass (includes the mod's bun tests).apps/amp-plugin: 30 pass.apps/droid-plugin: 8 pass.DOM_TESTS=1 bun test packages/editor: 264 pass.scripts/test-claude-code-mod.sh: 14 pass on the earlier commits. On the last rerun Claude Code refused to load hooks modules ("the rollout switch was saved off … not refreshed yet"), which is an environment issue. That commit touches no mod files.