fix(acp): match a slash command against the prompt ledger it was rebuilt from - #643
Open
Adam-Dalloul wants to merge 2 commits into
Open
fix(acp): match a slash command against the prompt ledger it was rebuilt from#643Adam-Dalloul wants to merge 2 commits into
Adam-Dalloul wants to merge 2 commits into
Conversation
…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.
Owner
|
codeg work 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.
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_displayrebuilds 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.