Skip to content

fix(prompt): show the approval card of an omp run from its npm package, and close the omp Ask review follow-ups (#2280, #2233) - #2320

Merged
devswha merged 1 commit into
mainfrom
fix/omp-prompt-followups
Oct 29, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/omp-prompt-followups

Conversation

@devswha

@devswha devswha commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Closes #2280. Closes #2233.

What it does for the user

  • fix(prompt): an omp started from its npm package's dist/cli.js gets no approval card (from #2245 review) #2280: an omp started from its npm package shows its approval card in Chat again. bunx and npx run the package's bin, node_modules/@oh-my-pi/pi-coding-agent/dist/cli.js, under bun or node. Before this, the foreground-ownership check from fix(prompt): read omp's approval panel over every composer shape (#2059) #2245 did not count that process as omp, so the card was hidden and the answer had to be given in the terminal.
  • fix(prompt): follow-ups from the omp Ask Markdown review (#2220) #2233: the follow-ups from the fix(prompt): show an omp Ask card in the agent's own Markdown (#1644) #2220 review.
    • Mermaid: an omp Ask question with a ```mermaid fence keeps the card as drawn. The chat would draw a diagram where omp shows the code.
    • Look-alike options: an Ask card whose options would read alike on the card also stays as drawn. Examples: spacing twins, one link's words with two addresses, rows that differ only by case.
    • Cross-script look-alikes: a typed answer no longer picks one of two rows that look alike across scripts, such as Keep **production** beside Keep **prоduction** with a Cyrillic о, or Greek ο, capital Cyrillic Р or І, and the digit 0 beside o. Typing either name gives the typed answer, or is refused when the card has none.
    • Row numbers (the relaxation the issue offered): a typed row number picks its row even when that row's name looks like another row's. The card shows each row's number, so typing it is the same as clicking the row. This brings back a typed way to choose between look-alike rows. A row whose own name is that number still comes first.
    • Separators only: on a multiple choice, ,,, or spaces alone are the typed text (or refused), never {option_indices: []}, which made answerKeys throw.

How

  • server/conversation.ts agentProcesses: recognises an agent's npm entry point (NPM_ENTRIES; only omp's for now) when bun or node runs it, like PI_NPM_ENTRY in server/pi.ts. Python running that path is not omp. ompOwnsInput, outcome binding and agentProcessInFront all pick from here.
  • server/omp-ask.ts: a mermaid fence in the question is undrawn, so the card stays as drawn. After a call matches, the card's option labels as the card draws them (cardDrawn, folded like spaced in promptAnswer) must be distinct; otherwise the card stays as drawn.
  • src/lib/promptAnswer.ts:
    • skeleton() folds case first (D146, as before), then maps every letter Unicode's confusables.txt (UTS feat: gjc chat, gjc and omo marks #39) draws like one ASCII letter or digit to it, then folds again. Folding first keeps case twins together: a capital I stays i.
    • The table is src/lib/confusables.generated.ts, 1363 entries. It holds only the subset whose target is one ASCII letter or digit.
    • A typed number reads only literal row names before the number, not skeleton look-alikes.
  • scripts/generate-confusables.ts: new; it generates that table.
  • Source pins: scripts/generate-case-folding.ts and the new script check the source's SHA-256 before parsing. Both the download and --source are refused when the bytes differ from the reviewed file, verified against the official 17.0.0 files. generate:confusables is in package.json, and the regeneration steps in docs/development.md.
  • server/omp.contract.test.ts: setup and the handoff test now wait on herdr event subscriptions instead of polling. The stand-in notes its key before it draws the screen the test waits for. A new contract test starts a stand-in at .../node_modules/@oh-my-pi/pi-coding-agent/dist/cli.js under bun; it names itself omp through prctl, as omp 18.13.2 does. The test asserts the approval card. It runs on Linux only.

Verification

  • Tests that fail before the fix:
  • After the fix:
    • bun run check fast: green, 8431 unit tests pass, 0 fail;
    • bun run check run bun test --timeout 15000 ./server/omp.contract.test.ts on the isolated herdr: 6 pass;
    • generate:case-folding --check and generate:confusables --check both pass.
  • Remote bundle (fix(prompt): follow-ups from the omp Ask Markdown review (#2220) #2233's open point):
    • bun run build:remote built herdr-web-ui-linux-x64.tgz, which carries shared/markdown.ts.
    • The bundle's own Bun (1.4.3) and Bun 1.4.2 both load it. Each draws the recorded 18.13.2 Ask card in Markdown and recognises the npm entry.
    • scripts/remote-bundle-smoke.ts fails on this host, and on origin/main too (no bridge descriptor there, a 404 from /api/bridge here), so it is not evidence either way. On this PR, CI's Remote PC bundles workflow built and smoke-tested the bundle on linux-x64, linux-arm64, both macOS runners and Windows: all green.
  • REMOTE_BUNDLE_VERSION: not raised. Per docs/development.md, a release PR raises it.

Reviews

omo-native-code-reviewer: one HIGH and four LOW.

  • HIGH H1: look-alike letters were mapped before case folding, so I became l and case twins split. Fixed by folding first; regression cases and a property that every case-folding pair keeps one skeleton are added.
  • L1: the contract test is Linux-only with a 30 s timeout. Done.
  • L2: the alike check also refuses case-only twins and equal labels with different descriptions. Kept; the card then shows omp's own rows.
  • L3: node --inspect …/cli.js is not recognised. This fails safe: no card and no keys.
  • L4: the forged test inputs are large. Kept; they are the minimum the entry count needs.

Codex Sol 6.1 fast xhigh:

  • Round 1: three MEDIUM.
    • Python running the npm entry was accepted. Fixed: bun and node only.
    • Same as H1, with the pair Keep API. / Keep api!. Fixed.
    • Row numbers were refused for digit-shaped labels (I, l, typed 1). Fixed: skeleton-only look-alikes no longer block a number.
  • Round 2, on the new code only: APPROVE, all three verified.

Known limits (from #2233)

  • Over-refusal: names that differ only by punctuation or spacing (Keep production vs Keep [production], Keep-production, <https://…> vs a bare URL) still share a skeleton, so typing either name gives the typed answer. Their row numbers and a click pick them.
  • Not covered by confusables: confusions that are not one ASCII letter or digit, such as two non-Latin letters, or m and rn.
  • Compatibility characters: math-bold 𝐈 takes its plain letter's skeleton (i), not l.
  • Polling left: the other polling in omp.contract.test.ts (the stopped-omp test) already used subscriptions. Nothing else polls there now.

…e, and close the omp Ask review follow-ups (#2280, #2233)

- agentProcesses takes bun or node running @oh-my-pi/pi-coding-agent's
  dist/cli.js as omp, so its approval card shows again (#2280).
- An omp Ask question with a mermaid fence, or options the card would
  show alike, keeps the card as drawn.
- A typed answer's skeleton folds Unicode confusables (ASCII-target
  subset of confusables.txt) after case folding: rows alike across
  scripts name neither; a typed row number picks its row; separators
  alone are the typed text.
- The case folding and new confusables generators refuse a source whose
  SHA-256 is not the pinned one.
- omp.contract.test.ts waits on herdr subscriptions instead of polling,
  with a contract test for the npm entry point.
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 010a44d and a4a0ae5.

Files ignored due to path filters: 1
  • src/lib/confusables.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 13
  • changelog.d/omp-prompt-followups.md
  • docs/development.md
  • package.json
  • scripts/generate-case-folding.test.ts
  • scripts/generate-case-folding.ts
  • scripts/generate-confusables.ts
  • server/agent-process.test.ts
  • server/conversation.ts
  • server/omp-ask.test.ts
  • server/omp-ask.ts
  • server/omp.contract.test.ts
  • src/lib/promptAnswer.test.ts
  • src/lib/promptAnswer.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 29, 2026

Copy link
Copy Markdown
Owner Author

CodeRabbit's review is rate-limited on this PR ("Review limit reached"), so these code-review agent reviews stand in for it. Each finding is listed below with how it was resolved.

omo-native-code-reviewer (adversarial, read-only) on a4a0ae5's first version

HIGH H1: src/lib/promptAnswer.ts skeleton() mapped look-alike letters before case folding.

  • The table maps I→l, so Keep Index. / Keep index and Keep Straße Index / Keep STRASSE index no longer shared a skeleton. A typed name then picked a row that main refused.
  • Fixed: case folding comes first (D146 as before), then the confusables, then folding again.
  • Tests added: both pairs, single and multiple choice; a property that every CaseFolding.txt pair keeps one skeleton; and the confusables property restated for letters with their own case or a compatibility form.

LOW findings:

  • L1: the new fix(prompt): an omp started from its npm package's dist/cli.js gets no approval card (from #2245 review) #2280 contract test uses Linux's prctl through dlopen("libc.so.6"). Fixed: it.skipIf(platform !== "linux") and a 30 s timeout.
  • L2: the server's alike check also falls back for case-only twins and for equal labels with different descriptions. Kept as fail-closed: the card then shows omp's own rows, which still answer.
  • L3: node --inspect …/cli.js is not recognised. This fails safe (no card and no keys) and matches PI_NPM_ENTRY's shape.
  • L4: the forged generator inputs are large. Kept; each must pass the version and entry-count checks so that the SHA-256 check alone refuses it.

Clean: pin bypass (none), skeleton idempotence (a fuzz over U+0000–U+2FFFF found 0), mermaid, contract-test races, project rules.

Codex Sol 6.1 fast xhigh

Round 1: three MEDIUM.

  1. Python running .../@oh-my-pi/pi-coding-agent/dist/cli.js was taken as omp. Fixed: only bun or node runs an npm entry; a regression case is added.
  2. The same issue as H1, with Keep API. / Keep api! and no typed answer. Fixed as above; a regression case is added.
  3. A typed row number was refused when the digits only looked like a row's name (rows I and l, typed 1; rows l and l). Fixed: for all-digit input and for number tokens, only a row literally named so takes precedence; skeleton look-alikes no longer block a number. Regression cases are added.

Round 2, on the new code only: APPROVE. All three fixes were verified with Bun, with no new findings.

After the fixes

  • bun run check fast: green, 8431 unit tests pass, 0 fail.
  • omp.contract.test.ts on the isolated herdr: 6 pass.

@devswha

devswha commented Oct 29, 2026

Copy link
Copy Markdown
Owner Author

Merging a4a0ae5 (closes #2280 and #2233). omp started from its npm package (node/bun running @oh-my-pi/pi-coding-agent/dist/cli.js, as bunx and npx do) is now recognised as omp, so its approval card appears. The omp Ask card falls back to the terminal's own rows when two options would look the same on the card (spacing, Unicode look-alikes, one link's words to two addresses) or when it holds a ```mermaid fence, which the chat draws as a diagram rather than omp's code. A typed answer's name skeleton now also maps Unicode look-alike letters to their Latin form (UTS #39 confusables, after case folding), so two rows that read alike are never picked by a typed name; their numbers and a click still pick them. The Unicode tables come from SHA-256-pinned generators (bun run generate:confusables, `generate:case-folding`). The lane's evidence: tests fail before; check fast green; omp contract 6/6; omo's HIGH and Codex's three MEDIUMs fixed, Codex round 2 APPROVE. The merge pass read the diff.

@devswha
devswha merged commit 001ef16 into main Oct 29, 2026
22 checks passed
@devswha
devswha deleted the fix/omp-prompt-followups branch October 29, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant