Skip to content

fix(amp,droid): surface Approve-with-Notes feedback instead of dropping it - #1146

Open
Souptik96 wants to merge 1 commit into
backnotprop:mainfrom
Souptik96:fix/1137-approved-notes-amp-droid
Open

fix(amp,droid): surface Approve-with-Notes feedback instead of dropping it#1146
Souptik96 wants to merge 1 commit into
backnotprop:mainfrom
Souptik96:fix/1137-approved-notes-amp-droid

Conversation

@Souptik96

Copy link
Copy Markdown

Fixes #1137 — Amp and Droid collapsed every decision: "approved" to a bare "Approved.", silently dropping the feedback field that Approve with Notes (#1092) attaches.

Root cause

There were actually three drop sites, one more than the issue lists:

  1. apps/droid-plugin/lib/run-plannotator.jsemitAnnotateDecision's approved branch printed "Approved.\n" and returned, never reading parsed.feedback (the annotated branch right below it handles feedback properly).
  2. apps/amp-plugin/plannotator.tsformatAnnotationFeedback opened with if (decision.decision !== "annotated") return null;, so approved decisions could never format.
  3. apps/amp-plugin/plannotator.tshandleAnnotateResult also early-returned ctx.ui.notify("Approved.") before formatAnnotationFeedback was ever called, so fixing (2) alone would not have fixed Amp.

Change

Both adapters now surface approved-with-notes feedback using the same prompt text as DEFAULT_ANNOTATE_APPROVED_WITH_NOTES_PROMPT in packages/shared/prompts.ts (the wording the OpenCode and Pi adapters already emit via getAnnotateApprovedWithNotesPrompt). Since the Amp plugin and the Droid lib/ are self-contained and don't import packages/shared, the text is mirrored locally with a keep-in-sync comment, the same pattern the Amp plugin already uses for its fileFeedback / messageFeedback defaults.

  • Amp: formatAnnotationFeedback handles approved + feedback (file annotations get a File: <path> context line, matching buildAnnotatePromptFromBridgeOutcome in the OpenCode adapter); handleAnnotateResult appends the formatted notes to the thread, and only note-less approvals keep the plain "Approved." notify. The config override key is approvedWithNotes under prompts.annotate (and prompts.annotate.runtimes.amp), matching the shared prompt config shape.
  • Droid: emitAnnotateDecision emits the approved-with-notes block when feedback is present; blank/absent feedback still prints "Approved.\n".

Deliberately preserved: dismissed stays silent even if a feedback field is somehow present, and raw-output fallback for non-JSON stdout is untouched.

Tests

  • Amp (plannotator.test.ts, +3): message-kind approved-with-notes formats the full prompt; file-kind includes the File: context; note-less / blank / dismissed all stay null.
  • Droid (run-plannotator.test.js, new file, 7 tests): pins the whole decision→stdout contract — plain approved, approved-with-notes, blank-feedback approved, dismissed, annotated, empty output, non-JSON passthrough.

Verification (Windows, bun 1.3.13)

# with the fix
bun test apps/amp-plugin/plannotator.test.ts apps/droid-plugin/lib/run-plannotator.test.js
  27 pass, 0 fail   (17 pre-existing + 3 new amp + 7 new droid)

# negative control: revert ONLY the two source files, keep the tests
  24 pass, 3 fail   (exactly the three approved-with-notes tests)

Full bun test on this branch: 2283 pass / 72 fail / 14 errors across 225 files, vs pristine main on the same machine: 2274 pass / 71 fail / 14 errors across 224 files — the delta is exactly the 10 added tests (9 pass; the one extra "fail", commit-history.test.ts "pages with before and reports hasMore honestly", is unrelated to these files and passes in isolation on this branch, so it appears load-flaky on this box). The ~71 baseline failures are pre-existing Windows-environment failures (workspace/symlink-heavy suites), identical either side.

bun run typecheck doesn't cover apps/amp-plugin (no tsconfig there and it's not in the script's project list), so as a proxy I ran the same standalone tsc --strict invocation over plannotator.ts on both pristine and this branch: 37 errors both sides, byte-identical sets (all pre-existing module-resolution noise from checking the file outside its build context — nothing introduced).

Not verified live: I don't have Amp or Droid (Factory) installed, so this is exercised through the exported helpers/unit contract rather than an end-to-end annotate session.

…ng it

The Approve with Notes flow (backnotprop#1092) emits decision:"approved" with a
feedback field, but both adapters collapsed every approved decision to a
bare "Approved." -- the reviewer's notes were silently lost.

Amp had two drop sites: formatAnnotationFeedback returned null for
anything not "annotated", and handleAnnotateResult early-returned on
approved before formatting was ever reached. Droid's
emitAnnotateDecision printed only "Approved."

Both adapters now emit the shared approved-with-notes prompt (mirroring
DEFAULT_ANNOTATE_APPROVED_WITH_NOTES_PROMPT in
packages/shared/prompts.ts); note-less approvals keep the old behavior.
The amp config override key approvedWithNotes matches the shared prompt
config shape.

Fixes backnotprop#1137
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.

Amp and Droid adapters ignore the feedback field on approved annotate decisions

1 participant