Skip to content

fix(pi): support questionnaire prompt cards - #2003

Merged
devswha merged 2 commits into
devswha:mainfrom
philipprass-prog:fix/pi-questionnaire
Oct 27, 2026
Merged

devswha merged 2 commits into
devswha:mainfrom
philipprass-prog:fix/pi-questionnaire

Conversation

@philipprass-prog

Copy link
Copy Markdown
Contributor

Change

Fix a gap in Pi prompt-card compatibility: Pi's custom questionnaire extension renders its own ctx.ui.custom widget, distinct from Pi's native dialogs and rpiv's ask_user_question. Previously it was only usable through the terminal, particularly awkward on a phone.

  • Bridge the installed questionnaire drawing through the existing prompt card: options and descriptions, custom answers, allowOther: false, question chips/back navigation, and a semantic multi-question review before submission.
  • Bind each card to a verified pending native questionnaire tool call and the observed widget state. Read again before committing input and during navigation; do not infer progress from numeric labels or guess a current tab.
  • Fail closed on stale calls, incomplete/clipped drawings, ambiguous active tabs, terminal-owned drafts, and control characters. Incomplete reviews cannot submit.
  • Reuse the existing question-card design and answer endpoint (the app's established Claude/Codex-style question flow); no new UI concept, setting, dependency, or HTTP/WS format.
  • Add isolated parser/route regressions, a browser regression registered in CI, and a changelog fragment.

This is compatibility support for an existing Pi tool, not a replacement extension. The installed tool and running sessions are not modified. The screen fixtures follow the installed widget's renderer; no extension implementation is copied into the bridge.

Validation

  • bun run check fast — passed: generated type/theme checks, workflow syntax, both typechecks, build and unit suite (7,234 passed, 24 skipped). Source fingerprint checked against the final implementation.
  • Focused parser, route, Pi-tree and surrounding dialog suite — 685 passed.
  • bun scripts/pi-questionnaire-browser-regression.ts — passed at 390px and 1440px with synthetic/demo fixtures; mobile custom-answer and review screenshots inspected.
  • git diff --check — passed.
  • Independent read-only review found two P2 edge cases (abandoned Pi branches and whitespace-colliding review labels); both were fixed with regressions. Follow-up review: no new findings, both original findings resolved for persisted branch changes; the leaf-only branch-visibility limitation below remains explicit.
  • Isolated native-widget harness using an unchanged copy of the installed extension and the actual Pi Editor at 28 columns — passed original option values, wrapped free text, incomplete-review refusal, back navigation, allowOther: false, answer edits and final submission. RPC transport was synthetic, not a real PTY.

Limitations: this deliberately requires verified pending-tool-call evidence and an unambiguous drawing; otherwise Terminal remains available. Multiline/control-character custom answers and existing terminal-owned drafts are refused. Browser coverage is Chromium emulation, not a physical iOS/Android device. Pi does not persist leaf-only /tree navigation until another entry is appended; the reader follows the existing last-written-branch convention plus current-widget matching. No production sessions were used, and the complete integration/browser lanes have not been run locally.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: devswha/ovis
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 4d2e360
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bc1eaff5-c78b-4f3a-92ed-eca0442fa640

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: devswha/ovis
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 4d2e360
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1d395e32-7544-4f9d-9f17-e57502966ad3
Commits

Reviewing files that changed from the base of the PR and between 4d2e360 and 6197c23.

Files selected for processing: 17
  • changelog.d/pi-questionnaire.md
  • scripts/ci-browser.sh
  • scripts/pi-questionnaire-browser-regression.ts
  • server/dialogs/index.ts
  • server/dialogs/live.ts
  • server/dialogs/pi-ask-tabs.ts
  • server/dialogs/pi-questionnaire-route.test.ts
  • server/dialogs/pi-questionnaire.test.ts
  • server/dialogs/pi-questionnaire.ts
  • server/dialogs/registry.test.ts
  • server/dialogs/registry.ts
  • server/dialogs/shared.ts
  • server/fixtures/pi-questionnaire.json
  • server/pi-questionnaire.test.ts
  • server/pi-questionnaire.ts
  • server/prompt.ts
  • tsconfig.tools.json

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

📝 Summary

Summary by CodeRabbit

  • New Features

    • Pi questionnaires now appear as interactive prompt cards, supporting option selection, free-text answers, multi-question navigation and review, and narrow layouts.
    • Answers are matched to the active questionnaire, and incomplete reviews cannot be submitted.
  • Bug Fixes

    • Ambiguous or outdated questionnaire prompts are no longer presented as answerable, helping prevent answers from going to the wrong tool call.
  • Tests

    • Added browser and automated coverage for questionnaire navigation, custom answers, review, and validation.

Adds support for Pi’s installed questionnaire tool. The change validates pending calls against the active transcript branch, parses questionnaire screens, routes verified prompts and answers, and adds parser, route, and browser regression coverage.

Changes: Pi questionnaire support

Layer / File(s) Summary
Verify pending questionnaire calls
server/pi-questionnaire.ts, server/pi-questionnaire.test.ts
Adds lookup for unresolved questionnaire calls on the indexed Pi branch. Tests cover branch ancestry, tool results, transcript rewrites, and invalid ancestry.
Parse questionnaire screens and register readers
server/dialogs/shared.ts, server/dialogs/pi-questionnaire.ts, server/dialogs/pi-ask-tabs.ts, server/dialogs/index.ts, server/dialogs/live.ts, server/dialogs/registry.ts, server/dialogs/registry.test.ts, server/fixtures/pi-questionnaire.json, server/dialogs/pi-questionnaire.test.ts
Adds questionnaire validation and screen parsing for questions, custom input, and review. Registers the readers and tests parsing across input, navigation, review, and narrow layouts.
Bind prompts to verified calls and route answers
server/prompt.ts, server/dialogs/pi-questionnaire-route.test.ts, scripts/pi-questionnaire-browser-regression.ts, scripts/ci-browser.sh, tsconfig.tools.json, changelog.d/pi-questionnaire.md
Matches Pi screens to pending calls before exposing prompts and adds questionnaire answer handling. Adds route and browser regression coverage, includes the browser test in CI and TypeScript tooling, and records the feature in the changelog.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Possibly related PRs

  • devswha/ovis#1714: Adds Pi questionnaire support for the rpiv widget, including custom answers, multi-question navigation, and review. This PR covers the installed questionnaire.ts widget and uses piActiveTab.

Suggested reviewers: 767251930, devswha

Merge Risk: Minimal · previous review 6197c

No merge-blocking issue was established; an unverified questionnaire state falls back to Terminal rather than sending an answer.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 14 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: adding Pi questionnaire prompt-card support.
Description check Passed The description includes the required Change and Validation sections. It explains the compatibility gap, resulting behavior, fail-closed conditions, test coverage, limitations, and unrun integration l…
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.
Full details: Description check

Explanation

The description includes the required Change and Validation sections. It explains the compatibility gap, resulting behavior, fail-closed conditions, test coverage, limitations, and unrun integration lanes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 14 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • 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 26, 2026

Copy link
Copy Markdown
Owner

Thanks @philipprass-prog. The maintainer approved this feature for merging once it passes the merge-pass gate. The gate passed typecheck, 123 focused tests, the conventions checks, and the new browser regression at 390px and 1440px. It reproduced two problems that need fixing first:

  1. An old questionnaire hint hides a live native menu (server/dialogs/pi-questionnaire.ts:20-24, server/dialogs/live.ts:207). When a questionnaire hint is still in scrollback above a valid native Pi menu, the menu's card no longer shows. Main returns "Choose a color", and this branch returns null. Please limit detection to the active drawing, the bottom of the screen where the current prompt is, and add a regression for an old hint above a live menu.
  2. The caption scan can block the server (server/dialogs/pi-questionnaire.ts:111). Finding the review caption copies and normalizes screen suffixes again and again, with no screen budget. A malformed screen of 648,828 bytes blocked parsing synchronously for 2,604 ms before it was rejected, and the cost grows quadratically. Please bound the input, for example by scanning only the last N lines or bytes, avoid rebuilding suffixes repeatedly, and add a test for an oversized screen.

(No changelog credit is needed in the fragment; a maintainer adds it at release.)

@philipprass-prog

Copy link
Copy Markdown
Contributor Author

[babysit-pr] Addressed both findings from #2003 (comment) in 009e48c.

  1. Questionnaire detection now anchors to the active bottom-of-screen hint (with its bottom rule/Pi footer), rather than treating an old hint anywhere in scrollback as ownership of the current input. Added parser and answer-route regressions for an old questionnaire above a live native "Choose a color" menu; malformed active drawings still fail closed.
  2. The parser now rejects screens above 64 Ki characters or 512 lines before questionnaire parsing. Hint/caption matching scans backward once instead of repeatedly joining and normalizing growing suffixes. Added oversized-input, line-budget and missing-caption regressions, including refusal before pending-call access and without fallback terminal controls. Oversized drawings intentionally remain Terminal-only.

Validation on the final unchanged source:

  • bun test server/dialogs server/pi-questionnaire.test.ts server/pi-tree.test.ts server/prompt.test.ts: 690 passed.
  • bun run typecheck: passed.
  • bun scripts/pi-questionnaire-browser-regression.ts: passed at 390px and 1440px.
  • bun run check fast: passed, 7,239 passed / 24 skipped; source fingerprint 5ba464a0211a322b998a4b38c6b46cde09091451a4bbda4d67ac5e2e80a9868c.
  • git diff --check: passed.
  • Independent review: no findings in the incremental fixes.

Only the parser and its two existing test files changed. No live sessions, installed extensions or services were modified. CI for this new commit is separate from the previous head's successful CI run.

@devswha

devswha commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Merge pass review report. Overall: PASSED. This outside contribution from @philipprass-prog shows Pi questionnaire prompts as prompt cards, and their answers go through /api/pane/prompt/answer. The maintainer approved the merge. It touches the prompt-answer path, so it went through the Astra gate (omo-native-gate-reviewer, gpt-6-astra).

First gate round (REJECT): typecheck, 123 focused tests, the conventions checks and the new browser regression at 390px and 1440px all passed. Two blockers were reproduced:

  1. A questionnaire hint left in scrollback suppressed a live native Pi menu's card.
  2. The review-caption search was unbounded: a malformed 648,828-byte screen blocked parsing for 2,604 ms, and the cost grew quadratically.

Fix 009e48c, re-reviewed on that range only (APPROVE):

  • Hint and menu: the B1 reproduction returns "Choose a color" again, and all 23 questionnaire fixtures still parse.
  • Parsing bound: the 648 KB malformed screen is now rejected in 0.584 ms, with processing capped.
  • Regression tests: both blocker tests fail when the old parser is substituted. A supplemental route test for an oversized screen proves route safety, not the performance bound.
  • Full run: merged locally with origin/main, typecheck passes, all 49 questionnaire tests pass, and the unit suite passes 7518/0.

A maintainer adds the changelog credit when the release folds the fragments (changelog.d/README.md).

@devswha
devswha merged commit 13272d0 into devswha:main Oct 27, 2026
19 checks passed
@devswha devswha mentioned this pull request Oct 27, 2026
devswha added a commit that referenced this pull request Oct 27, 2026
## Release 0.4.19

The release PR, made by the steps in
[docs/development.md#releasing](docs/development.md#releasing), on main
9d76cca (#2078):

- **Version:** `version` is 0.4.19 in `package.json` and
`herdr-plugin.toml`.
- **Changelog:** `bun scripts/changelog-fold.ts 0.4.19` moved the
`changelog.d` fragments of 54 PRs into CHANGELOG.md, with PR links, and
deleted them.
- Outside contributors are credited: #1955 @YuuuXie, #1957 @Noobear,
#1984 @bonecool999, #2003 @philipprass-prog, #2016 @kyop21, #2024
@YuuuXie, #2025 @YuuuXie, #2027 @jpcarranza94, #2030 @phlips5437, #2031
@yaaayaaa, #2034 @jpcarranza94, #2035 @nahwan-kim, #2041 @odfalik, #2045
@mattmarcin, #2052 @jpcarranza94, #2057 @kyop21, #2061 @YuuuXie.
- **Release summaries:** `release-summaries.json` has the 0.4.19 entry
in en, ko, ja and zh, with the same lists in each: 5 new, 5 improved, 5
fixed. Every English line is at most 70 characters.
- **Remote bundle:** `REMOTE_BUNDLE_VERSION` goes from 37 to 38 in
`shared/machines.ts`, because the remote bundle's inputs changed since
`remote-v37`. Once this merges, `remote-v38` is pushed on the merge
commit, and the Remote PC bundles workflow has to finish before the
Release run.

`bun scripts/release-guards.ts` reports: "Release 0.4.19: remote bundle,
telemetry Worker and release metadata are in order." No telemetry Worker
deploy is needed. `bun run check fast` passes locally.

**Not checked on a real Windows PC:** #1989 (Git for Windows' OpenSSH
for remote PCs) and #2016 (Antigravity chat on Windows through the
Restart Manager) ship without their real-device Windows checks, because
the maintainer's Windows test PC is off. The owner accepted releasing
without them. Both will be checked on the real PC when it is back.

The owner approved this release.
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.

2 participants