Repository navigation
Shorten GroupMind confirmation/choice room cards - #132
Merged
Merged
Conversation
petrus, 22 Sep 2026: "Stop these huge confirmation messages pls" - a Bash
confirmation's prompt (the question plus whatever the caller pasted after
it, often the full shell command) was posted verbatim to the room, running
to hundreds of characters.
Adds shortRoomBody(prompt, {options}), a pure function that keeps the first
line (the question) verbatim, reduces the rest to the first non-plumbing
line (skipping bare cd/echo/var-assignment/comment lines) capped at
COMMAND_SNIPPET_MAX (160) chars plus a fixed "full command in CodeWatch"
note, and caps the whole thing at ROOM_BODY_MAX (600). For a choice card the
option labels (the buttons / typed-reply targets) are never shortened; if
they alone would meet the budget, the description is dropped instead of
truncated.
Only the GroupMind room body changes. The stored intent prompt, the
CodeWatch push, and /intents keep the full text untouched - covered by a
negative-control test.
makeGroupmindAnnouncer now delegates to a new buildGroupmindBody() so the
assembled card is testable without a network round trip.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
What
petrus, 22 Sep 2026: "Stop these huge confirmation messages pls" — a Bash
confirmation's
prompt(the question plus whatever the caller pasted afterit, often the full shell command or a heredoc) was posted verbatim into the
GroupMind room, running to hundreds of characters.
Adds
shortRoomBody(prompt, {options}), a pure function insrc/confirmations.mjs:non-plumbing line — skipping lines that are only a comment, a bare
cd,a bare
echo ..., or a bareVAR=valueassignment — capped atCOMMAND_SNIPPET_MAX(160 chars), followed by a fixedfull command in CodeWatchnote./choose <id> <option>) are never shortened or truncated. If the optionsalone would already meet or exceed the budget, the description is dropped
entirely rather than truncated.
ROOM_BODY_MAX(600 chars).makeGroupmindAnnouncernow delegates to a new exportedbuildGroupmindBody()helper so the assembled card is testable without a network round trip.
What is tested
test/short-room-body.test.mjs(new, 10 cases):CodeWatch, and the resulting body stays under
ROOM_BODY_MAX.cd/echo/ variable-assignment / comment lines are skipped tofind the real command line.
cd/assignment but goes on todo real work (the actual shape from the reported card) is kept, not
skipped.
buildGroupmindBody()end-to-end: a 900-char shell command yields anassembled room body under 600 chars that opens with the verbatim
question and still contains the intent id and every option label.
untouched prompt — this is the test that would catch a future "fix" that
truncates at the source instead of only in the room body.
(
git checkout -- src/confirmations.mjs, temporarily): with the fixreverted, the whole test file fails to even load (missing exports), so
every case fails; restored the fix and re-ran to confirm all 10 pass again.
npm test→ 746 tests, 51 suites, 0 failures, exit code 0.What is NOT touched / NOT tested here
promptfield, the CodeWatch push payload, and the/intentsHTTP listing all keep the full, unshortened text — only thetext posted to the GroupMind room changes. This is the property the
negative-control test guards.
metadata.intent_promptfield (used by richerclients, not the visible chat bubble) is left as the full prompt too —
only the visible
bodyis shortened./intentsHTTP handling, or the MCPtool schemas for
request_confirmation/request_choice.🤖 Generated with Claude Code