Skip to content

Approve flagged Sidekick replies in the REPL - #1327

Open
taras wants to merge 1 commit into
mainfrom
codex/sidekick-reply-approval-correction
Open

taras wants to merge 1 commit into
mainfrom
codex/sidekick-reply-approval-correction

Conversation

@taras

@taras taras commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Why

When secret detection flags a completed Sidekick reply, the REPL can already preserve the conversation by withholding the reply. This change lets the person inspect the finding and decide whether to keep the original reply and continue.

Refs #1311.

The feature is restacked on main at 8c71b35b6 after the Agent extraction in #1343.

What changes

A flagged reply opens a foreground approval drawer. It shows the detection rule and position and masks the match until the person chooses Reveal. Withhold, closing the drawer, and stopping the turn preserve the withheld completion. Accept saves the exact original reply, resumes the same turn, and permits ordinary ACP output and automatic feedback.

How it works

Completed Sidekick reply
  → Record a safe withheld completion
  → Wait for the foreground decision in the held turn
  → Accept saves the original reply before evaluation
    Withhold ends the turn with the safe completion

Review guide

Start with the “Review a withheld Sidekick reply” section in specs/repl-spec.md and the “Sidekick reply approval” mounted suite.

  1. Trace the decision through packages/agent/src/reply-review.ts and packages/agent/src/conversation.ts.
  2. Check the acceptance record and replay in packages/agent/src/reply-acceptance.ts.
  3. Follow canonical Elicit acknowledgement, output, and feedback through packages/cli/src/repl/sidekick/control-outcomes.ts and packages/core/src/secrets/reply-grant.ts.
  4. Check foreground rendering and action handling in packages/cli/src/repl/application.ts and packages/cli/src/repl/program.ts.

What must stay true

  • Pending reply text stays inside the live decision. The mounted suite checks both journals, attached ACP updates, and the frame before acceptance commits.
  • Acceptance authorizes the exact reply and its proven copies. Agent conversation and Core protection tests cover independent and crossing matches, final composed feedback, protected fields, and replay.
  • The initial completion establishes the receipt. Tests cover cold reopen, stale actions, interrupted review, and storage errors at both appends.

How to verify it

  • deno task test --filter 'Tier CW' packages/agent/tests/agent-conversation.test.ts exercises the continuation, journal, and scoped secret policy.
  • The full Sidekick ACP suite passed all 71 cases on Deno, Node, and Bun on 737601c97, including the 14 reply-approval cases and the feedback acknowledgement-loss regression. It covers same-turn acceptance through real ACP, protected questions, TODO feedback, and Reveal at three terminal sizes.
  • The Agent conversation suite passed all 91 cases on Deno, Node, and Bun. The focused Keep Sidekick usable after secret detection in xmd repl #1311 recovery suite, Deno typecheck, and JSR dry run also passed.
  • The managed Architect and Planner passed 737601c97. The original independent Fable reviewer re-reviewed the same commit and returned PASS.

New abstractions

  • The scoped reply hold carries a foreground decision to the existing Prompt continuation.
  • The acceptance record and shared reader restore the same turn after reopen.
  • The canonical Elicit outcome reader lets live output, feedback, and cold recovery use the same acknowledged result.

Risks and limitations

  • A finding that spans approved text and a separate Output region can still stop the REPL. The combined match crosses the original approval boundary.

Scope confirmation

  • Every changed file supports the purpose described above.
  • Unrelated cleanup and formatting changes are excluded.
  • Generated or mechanical changes are clearly identified.
  • The description matches the final diff and test results.

Visual verification

Both clean builds received the same Check the reply. prompt and synthetic credential-like reply through the mounted REPL harness. The real scanner and renderer handled both turns. The 120×30 and 72×20 frames were captured after resizing from 160×36 at the withholding checkpoint.

  • Base 853e86268353937db2f746e47e3824b2a48c5f50
  • Candidate used for these captures 11f3c8a70093454d25bb55501fdc9d3f97383259
Viewport Before After
160×36 Saved turn with a withheld reply at 160x36 Masked reply approval drawer at 160x36
120×30 Saved turn with a withheld reply at 120x30 Masked reply approval drawer at 120x30
72×20 Saved turn with a withheld reply at 72x20 Masked reply approval drawer at 72x20

The base shows that it withheld the reply. The PR head identifies the rule and position, masks the matched value, and offers Reveal, Withhold, and Accept. At 72×20, scroll the drawer to reach the decision controls.

The mounted test accepted the reply at 160×36 and saw the original output appear in the same turn. It withheld the reply at 120×30 and 72×20 and verified the output stayed withheld. Each decision ran with one provider prompt.

REPL typing latency

One local paired run on macOS arm64 with Deno 2.9.7, using the same pinned base and head. The benchmark measured from a keystroke until the new composer text appeared at 200×52. Each workload ran 40 edits, with the first 10 excluded as warm-up.

Workload Baseline median / p95 Candidate median / p95 Delta median / p95
small · 2 rounds 10.66 / 11.10 ms 10.48 / 11.66 ms -0.19 / 0.56 ms
wrapping · 52 rounds 16.79 / 19.00 ms 16.68 / 18.46 ms -0.11 / -0.54 ms

Median latency changed by under 0.2 ms on both workloads. The small-history p95 rose 0.56 ms, and the wrapping-history p95 fell 0.54 ms in this run. The four focused typing regression tests also passed on the PR head.

Restack the reviewed #1327 reply approval feature (tree delta
853e862..35dcb34, previously at 88703be) onto main after the Agent
package extraction (#1343), without the #1337 extraction spike.

Agent owns the conversation, reply review, acceptance record and replay
(packages/agent/src/reply-acceptance.ts, reply-review.ts, exported from
@executablemd/agent/host). Core keeps the generic pieces the feature needs:
the accepted-reply copy grants, reply secret location and text checks,
Elicit answer readers, and executeInstalledBound with the evaluator that
takes an AcceptedRootReply, all exported from @executablemd/core/host.
Core imports nothing from the Agent package.

The approval drawer takes precedence over main's Sidekick inspection view,
and the chat projection keeps both main's request reading and the
feature's control outcomes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@taras
taras force-pushed the codex/sidekick-reply-approval-correction branch from 88703be to 737601c Compare November 16, 2026 05:05

This branch has not been deployed

No deployments
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