Skip to content

Shorten GroupMind confirmation/choice room cards - #132

Merged
ThinkOffApp merged 1 commit into
mainfrom
fix/short-room-cards
Sep 22, 2026
Merged

ThinkOffApp merged 1 commit into
mainfrom
fix/short-room-cards

Conversation

@ThinkOffApp

Copy link
Copy Markdown
Owner

What

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 or a heredoc) was posted verbatim into the
GroupMind room, running to hundreds of characters.

Adds shortRoomBody(prompt, {options}), a pure function in
src/confirmations.mjs:

  • Keeps the prompt's first line (the question) verbatim.
  • For a confirmation, reduces everything after the first line to the first
    non-plumbing line — skipping lines that are only a comment, a bare cd,
    a bare echo ..., or a bare VAR=value assignment — capped at
    COMMAND_SNIPPET_MAX (160 chars), followed by a fixed full command in CodeWatch note.
  • For a choice card, the option labels (the buttons / typed-reply targets,
    /choose <id> <option>) are never shortened or truncated. If the options
    alone would already meet or exceed the budget, the description is dropped
    entirely rather than truncated.
  • The whole shortened block is capped at ROOM_BODY_MAX (600 chars).

makeGroupmindAnnouncer now delegates to a new exported buildGroupmindBody()
helper so the assembled card is testable without a network round trip.

What is tested

  • test/short-room-body.test.mjs (new, 10 cases):
    • A short single-line prompt passes through unchanged.
    • A prompt whose first line is a question keeps that question verbatim.
    • A 900-character command line is cut to the snippet cap with a pointer to
      CodeWatch, and the resulting body stays under ROOM_BODY_MAX.
    • Bare cd / echo / variable-assignment / comment lines are skipped to
      find the real command line.
    • A compound line that merely starts with cd/assignment but goes on to
      do real work (the actual shape from the reported card) is kept, not
      skipped.
    • Choice-card option labels are never touched by the shortening.
    • When options alone meet/exceed the budget, the description is dropped.
    • buildGroupmindBody() end-to-end: a 900-char shell command yields an
      assembled room body under 600 chars that opens with the verbatim
      question and still contains the intent id and every option label.
    • Negative control: the CodeWatch push still carries the full,
      untouched prompt — this is the test that would catch a future "fix" that
      truncates at the source instead of only in the room body.
  • Verified each new behavioral test fails when the change is reverted
    (git checkout -- src/confirmations.mjs, temporarily): with the fix
    reverted, 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.
  • Full suite: npm test → 746 tests, 51 suites, 0 failures, exit code 0.

What is NOT touched / NOT tested here

  • The stored intent's prompt field, the CodeWatch push payload, and the
    /intents HTTP listing all keep the full, unshortened text — only the
    text posted to the GroupMind room changes. This is the property the
    negative-control test guards.
  • The GroupMind message metadata.intent_prompt field (used by richer
    clients, not the visible chat bubble) is left as the full prompt too —
    only the visible body is shortened.
  • No changes to CodeWatch rendering, /intents HTTP handling, or the MCP
    tool schemas for request_confirmation / request_choice.

🤖 Generated with Claude Code

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>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@ThinkOffApp
ThinkOffApp merged commit 0f1cb43 into main Sep 22, 2026
2 of 3 checks passed
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