Skip to content

fix(acp): match a slash command against the prompt ledger it was rebuilt from - #643

Open
Adam-Dalloul wants to merge 2 commits into
xintaofei:mainfrom
Adam-Dalloul:fix/duplicate-goal-turn
Open

fix(acp): match a slash command against the prompt ledger it was rebuilt from#643
Adam-Dalloul wants to merge 2 commits into
xintaofei:mainfrom
Adam-Dalloul:fix/duplicate-goal-turn

Conversation

@Adam-Dalloul

@Adam-Dalloul Adam-Dalloul commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Sending /goal <objective> renders the whole turn twice while it streams: the prompt bubble and its reply both appear a second time, one copy completed and one still running.

The background watcher tells a turn codeg sent apart from out-of-turn work by matching a transcript record's initiator text against the prompt ledger. A slash command has no readable initiator text, so slash_command_display rebuilds it from the command tags as the name, one space, and the trimmed args. That drops whatever separator the sender actually typed, and the composer already inserts a space after a command badge, so a sender who types their own sends two. The rebuilt text no longer starts with the fingerprint, the command classifies as an out-of-turn initiator, and the wire-rendered turn comes back as a background overlay beside itself. Same duplicate that the submission window already covers for a command's side records, reached through the command record itself.

The match now also runs over collapsed whitespace, which stays exact in words and order. Two tests: the end-to-end goal turn sent with an extra space must not surface an overlay, and the ledger must still refuse different words and still consume an entry exactly once.

Adam-Dalloul and others added 2 commits September 2, 2026 16:57
…ilt from

The background watcher decides whether a transcript record belongs to a turn
codeg sent (the wire renders it) or to out-of-turn work it has to surface as
an overlay, by matching the record's initiator text against the prompt ledger.
A slash command has no readable initiator text: the CLI persists the
invocation as command tags, so slash_command_display rebuilds it as the name,
one space, and the trimmed args. That drops whatever separator the sender
actually typed, and the composer already inserts a space after a command badge
so a sender who types their own sends two. The rebuilt text then does not
start with the fingerprint, the command classifies as an out-of-turn
initiator, and the whole wire-rendered turn comes back as a background overlay
beside itself, which is the duplicated /goal turn again by a different route.

Compare on collapsed whitespace as well as bytes, which keeps the match exact
in words and order.
@xintaofei

Copy link
Copy Markdown
Owner

codeg work task 150 is done — #643 (1 file, +111/-49).

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.

2 participants