Skip to content

feat(items): tip the bot when its Needs you ask is hard to read - #44902

Merged
AmethystLiang merged 8 commits into
mainfrom
AmethystLiang/needs-you-ask-readability
Nov 19, 2026
Merged

AmethystLiang merged 8 commits into
mainfrom
AmethystLiang/needs-you-ask-readability

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When a bot sets an item to Needs you, it now gets a one-line tip back if its question looks hard to read: choices written into the text instead of as buttons, no actual question, a long question or context, or hashes and IDs. The bot rules also give the limits. The ask is still posted exactly as written.

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​300 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​300
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​312 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​309

What Changed

  • Before: bots were told to give choices as --ask/--option buttons, but with no length guidance and no feedback when an ask came out as a wall of text.
  • After:
    • The bot rules and orca bot item set --help give the limits:
      • Each question is one line under 140 characters, ending in "?".
      • --comment context is at most 5 short lines or a link.
      • Plain words, not hashes, IDs or review labels; link those instead.
    • After a Needs-you bots.items.set succeeds, the host checks the bot's own text (src/shared/bots/bot-item-ask-advice.ts). The result gains an optional advice: { codes, tip }, and the CLI prints the tip as a second line, e.g. Posted. Tip: Give the choices as buttons with --ask and --option, not in the text. Set Needs you again if you rewrite it.
  • What the check looks for, in priority order (only the first one fires as a tip): prose_choices, no_question, long_question (over 140 characters, or a prose ask whose first paragraph is over 300), long_context (over 300 characters or 5 lines), jargon (12+ hex characters, ctx_/task_/msg_ IDs, run-together words).
  • What the check ignores: text inside closed code spans and fences, closed link targets, URLs and paths. Review labels like D4 or P2 are left to the rule text.
  • Unchanged: nothing is refused, and the stored text, mail and notifications are the same as before. Plain comments and owner writes are not checked.

Why

A sample of 229 Needs-you asks from three days:

  • Before --ask reached the app (feat(items): show waiting questions as cards on the item page #44262), 223 asks:
    • 0 used --ask.
    • 67% wrote the choices in prose ("Reply yes, or wait", "A) … B) …").
    • 52% had no question mark.
    • The median ask was 424 characters.
  • After it, 6 asks: all 6 used buttons. Their remaining weak spot is a dense context paragraph.

The structure now exists. What was missing was a stated length limit and any feedback to the bot. On that sample, the tip fires on 192 of the 223 old prose asks and on none of the 6 new button asks.

Alternatives rejected:

  • Refusing hard-to-read asks: a refused write may never be retried.
  • Lowering the question's character limit: that refuses writes too.
  • Rewriting asks with a model: it adds cost and delay and can change the meaning.
  • Computing the tip in the CLI: RPC and --json callers would miss it.
  • Clamping long questions in the card: the ask card already clamps them, with Show more.

Linked Issue

N/A (maintainer change).

Visual Proof

N/A: no UI change. The only visible output is one extra line in the bot's CLI result.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

  • bot-item-ask-advice.test.ts (46 tests):

    • Each code, with fixed inputs.
    • Clean --ask input and code, links, paths and camelCase names give no tip.
    • Priority order, and the 8,000-character scan limit.
    • --ask questions and context are checked the same way as prose: a "?" inside a URL or code does not count, choices written into them are flagged, and each field is masked on its own.
    • A table of masking cases: unclosed or mismatched backticks, links with no label, nested and adjacent links, and URLs. Text outside a properly closed construct always stays visible.
    • New cases failed against the earlier versions of the classifier.
  • bots-items.test.ts: a Needs-you set with prose choices is stored exactly as sent and returns advice; a clean --ask set returns none. This fails with the handler change reverted.

  • Affected test files pass 84 of 84, and pnpm typecheck and pnpm lint pass locally on macOS. The classifier was also run over the sample above, counting results only.

  • The design, code and tip wording were reviewed before opening.

Performance

  • Cost per write: bounded multiple linear passes. The admitted formatted ask is at most 8,000 UTF-16 units, plus at most 2,500 extra prompt units, because each --ask field is masked on its own and each prompt is checked again for its question mark. This runs only on Needs-you set writes, after the write and its side effects have finished. There is no I/O, no state and no model call.
  • Code, link and URL masking: done by single-pass scanners rather than backtracking regexes.
  • Measured locally: at commit 08328c8, run over prose comments, time grew linearly with input (ordinary prose: 0.04/0.08/0.15/0.28 ms at 1k/2k/4k/8k characters), and each tested adversarial comment shape (unclosed brackets, link openers, backtick and fence runs, URLs, short tokens) stayed under 1 ms at 8k. The final per-field --ask path was not timed separately.

Risk

Level: Low

  • Behavior: the write itself is unchanged. The riskiest part is a misleading tip, which bots may act on by re-asking.
  • Compatibility: advice is optional. Older CLIs ignore it, and newer CLIs talking to older hosts simply get no tip. The serving host computes it, so local, paired and remote hosts behave the same.
  • Bot rules: the rule text grows by about 60 words. Running chats get it through the existing rules update.
  • Rollback: a plain revert backs it out.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

After a Needs you write, the host checks the bot's own ask and returns one
advisory tip: choices written in prose, no question, a long question or context,
or hashes and ids. The ask is stored, mailed and shown exactly as sent. The bot
rules and CLI help now give the limits: one question line under 140 characters,
context in up to 5 short lines or a link.
The URL and link-target masks rescanned to the end of a long word from every
position; they now cut each word once. "reply with a summary" no longer reads
as option A, and ids inside ../, Windows and bracketed or quoted paths no
longer count as jargon.
A link's target is cut but what follows it in the same word stays, so 'Is
[fix](x)?' still has its question and an id after a link is still seen; a URL
keeps its trailing punctuation. 'reply/answer/say' match in any case while the
option letter must be a capital or a digit.
An unclosed link target, backtick or fence now hides nothing, and text before a
URL in the same word stays visible, so a question mark or an id there is still
read. Pinned by a table of mask cases.
Code is hidden only between backtick runs of the same length (a span stays on
one line), and a link target only after a [label] on the same line with a
target free of spaces, brackets and parentheses. Anything else is read as text,
and a backtick no longer hides an id it touches.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds botItemAskAdvice to check bot item comments and structured ask fields for specified content patterns and limits. The RPC handler adds advice to qualifying needs_you results. The CLI formatter displays the advice tip when present. Bot guidance and tests are updated to reflect and verify these behaviors.

Merge Risk: Minimal · up to e18d0

Adds optional readability tips when a bot sets an item to Needs you. The ask is still posted unchanged and older clients ignore the tip. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: when a bot sets an item to Needs you, the host now returns a readability tip if the ask is hard to read. It uses the conventional feat(scope) prefix, is 63 characters,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description covers the ELI5, what changed, why, testing, performance, and risk. It describes the advice feature, the limits in the bot rules and help text, and the masking behavior. It also explai…
Full details: Title check

Explanation

The title names the main change: when a bot sets an item to Needs you, the host now returns a readability tip if the ask is hard to read. It uses the conventional feat(scope) prefix, is 63 characters, and is a single sentence. The title is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description covers the ELI5, what changed, why, testing, performance, and risk. It describes the advice feature, the limits in the bot rules and help text, and the masking behavior. It also explains the rejected alternatives and the rollback plan. The template's Visual Proof section is marked N/A with a reason. The Linked Issue section says N/A (maintainer change), but the template asks for a linked issue for outside contributors, and the Fixes # line is left blank. The Review, Notes, and AI Disclosure sections are not filled in. The Testing checklist also contains an unchecked manual-testing box. The description states that tests cover 46 tests, but the objectives state 43 tests, and the description reports 84 of 84 while the objectives report 76/76. These counts conflict, so the author should reconcile them. The Risk section lists a level and a rollback method, but it does not clearly cover the bot-rules text change in every detail. Overall the description is mostly complete with a few gaps.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

The configuration directory could not be loaded. This review used the available YAML and UI settings; directory instructions and checks were not evaluated.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 72a6fd0a-bbd5-4058-b4e0-30085bd28994
Commits

Reviewing files that changed from the base of the PR and between b433f4e and e18d080.

Files selected for processing: 2

  • src/shared/bots/bot-item-ask-advice.test.ts
  • src/shared/bots/bot-item-ask-advice.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ec1d7a3e-c7e7-4578-bd43-bb42421078bf
Commits

Reviewing files that changed from the base of the PR and between 9730028 and 08328c8.

Files selected for processing: 8

  • src/cli/bots/bot-items-format.ts
  • src/cli/specs/bot-items.ts
  • src/main/bots/bot-preamble.ts
  • src/main/runtime/rpc/methods/bots-items-write-methods.ts
  • src/main/runtime/rpc/methods/bots-items-write-support.ts
  • src/main/runtime/rpc/methods/bots-items.test.ts
  • src/shared/bots/bot-item-ask-advice.test.ts
  • src/shared/bots/bot-item-ask-advice.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment thread src/shared/bots/bot-item-ask-advice.ts Resolved
Comment thread src/shared/bots/bot-item-ask-advice.ts Resolved
The orcad server bundle must be ASCII; the punctuation sets held literal curly
quotes and an ellipsis.
A question mark inside a URL or code no longer counts as the ask's question, and
choices written into an --ask question or its context get the buttons tip too;
option labels are never checked for it.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3bb87bea-2740-4181-a222-c63fdf223b61
Commits

Reviewing files that changed from the base of the PR and between b9c7364 and b433f4e.

Files selected for processing: 2

  • src/shared/bots/bot-item-ask-advice.test.ts
  • src/shared/bots/bot-item-ask-advice.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Comment thread src/shared/bots/bot-item-ask-advice.ts Resolved
An unclosed backtick run in one question no longer pairs with one in another
and hides the text between them.
@AmethystLiang
AmethystLiang merged commit 55cf957 into main Nov 19, 2026
53 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