Skip to content

fix(native-chat): read OMP ask fields wrapped in a matching <label for> - #52501

Merged
nwparker merged 1 commit into
stablyai:mainfrom
Aeternologist:fix/omp-ask-label-for-wrapping-control
Nov 29, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
Aeternologist:fix/omp-ask-label-for-wrapping-control

Conversation

@Aeternologist

@Aeternologist Aeternologist commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When the OMP agent asks you something, it sends a small web form. If a text box sat inside the label that also pointed at that same box by name, Orca skipped the box, so the question never showed up. OMP 19.3.0 now reads those boxes, and so does Orca, so the question card appears.

What Changed

  • Before: in an OMP ask form, a field inside a <label for> that names it, such as <label for="n">Anything to add? <input id="n" name="n"></label>, was dropped. When it was the form's only field, parseAskFromToolInput / parseInteractivePrompt returned null, so no card appeared in desktop native chat or on mobile while OMP waited in the terminal. In mixed forms the question was missing from the list and from the dashboard's ask summary.
  • After: the field is read like any field inside its label. The card appears and the question list matches OMP 19.3.0.
  • Mechanism: OmpAskFormReader.label() (src/shared/native-chat/input/questions/omp-ask-form-sections.ts) returned early for every <label for> that is its control's labelFor target, before checking whether the label holds a control. That early return now runs only for labels that hold no control (a detached label, which still titles its control and stays out of the text flow). The reader's upstream version comment moves to v19.3.0.

Why

Orca's reader mirrors OMP's html-form rules so the card shows what OMP's terminal asks. OMP fixed this exact rule in v19.3.0 (oh-my-pi commit 2f6adc9d69, "fix(ask): preserved controls wrapped by matching labels"); this change moves the same check the same way, which fixes the root cause in the reader itself rather than patching parse results.

Alternative considered: keep the v19.2.1 rule for older OMP. On 19.2.1 a form whose only field is wrapped this way fails at once ("no named controls"), so there is no working case to preserve.

Linked Issue

Fixes #52500

Visual Proof

A throwaway fixture (not part of this PR) passes the OMP ask input above through the real parseInteractivePrompt into NativeChatInteractiveCard. The card component itself is unchanged; mobile reads the form with the same parser.

Before (main): no card After
Dark Fixture on main: the OMP ask input line and no card below it Fixture with this change: the OMP ask card with the Answer in terminal button
Light Fixture on main, light theme: the input line and no card Fixture with this change, light theme: the input line and the OMP card

Testing

  • Reproduced with the new test in omp-ask-form-input.test.ts: on main it fails (expected null to deeply equal { questions: [ { …(3) } ] }, 1 failed / 9 passed); with this change 10/10 pass.

  • The test also covers a wrapped <label for> next to a detached <label for> placed after its control, and expects exactly ['Anything to add?', 'Who owns this?'], matching OMP 19.3.0's wrapping and detached labels with for each appear once test.

  • Upstream parity: ran OMP's real parseHtmlForm (oh-my-pi origin/main) and Orca's reader on 11 edge-case forms (wrapped textarea with a default body, wrapped select, input with a value, wrapped radios, for naming a different control, nested labels, duplicate labels, label in a table cell, mixed forms). This branch matches upstream on all 11; main differs on 8.

  • vitest run src/shared/native-chat/input: 8 files, 42 tests pass. oxlint, oxfmt, anti-slop oxlint, native-plugins oxlint, ast-grep and the changed-code quality gate are clean on both files.

  • Platform: macOS (shared TypeScript, no platform APIs).

  • 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

Performance

None, because the reader does the same work per label (one check moved), and parse results are memoized per form HTML, so it runs once per unique ask. Measured (tsx, old vs new reader): a typical 3-field form is unchanged within noise (~0.008 ms). A 2000-field form of wrapped <label for> fields goes from ~0.45 ms to ~2.25 ms mean only because those 2000 fields are now read instead of dropped, the same cost as an existing 2000-field plain-label form (~2.5 ms). No I/O, subprocesses, polling, or renderer/store/cache changes, so no per-tab fanout.

Risk

Level: Low

  • Only a <label for> that wraps a control behaves differently: that control is now read. Labels without a control inside behave as before.
  • With OMP 19.2.1 and older, a mixed form containing such a field shows one more question in Orca's card than the terminal asks (display only; answers are given in the terminal). Older Orca mobile or remote builds keep dropping these fields, as today.
  • Back out with a plain revert.

Review

  • Cross-platform: shared TypeScript with no platform or DOM APIs.
  • SSH/remote: no host, protocol or storage change.
  • Agents and integrations: only OMP ask forms with a <label for> around its control.
  • Security: no new parsing path; the same bounded reader.

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.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

The rule follows oh-my-pi's html-form parser (MIT, can1357/oh-my-pi, v19.3.0).

Original fix by @Aeternologist in #52501.

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)

@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Reads controls inside a matching <label for> instead of skipping them.

  • OMP ask forms now include fields wrapped in a matching <label for>.

No actionable issues found. Tests were inspected, not run.

Reviews (2) · Last reviewed commit: "fix(native-chat): read OMP ask fields wr..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The OMP form reader now processes a control inside a <label> when the label’s for attribute references that control. Tests check that nested and detached controls produce questions with the label text and no options. The reader documentation now identifies OMP html-form version 19.3.0.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 154be

The OMP ask form reader now recognizes a field wrapped by a matching label, so the question card appears for such forms. No merge-blocking risk was identified, and the change is small and easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its scope: OMP ask fields wrapped in a matching label for. The changeset adds a test and changes the label handling in OmpAskFormReader to skip only labels without a contro…
Description check Passed The description follows the template sections: ELI5, What Changed, Why, Linked Issue (Fixes #52500), Visual Proof, Testing, Performance, Risk with level, AI Disclosure, Review, upstream boundary, Note…
Linked Issues check Passed Linked issue #52500 requires that Orca skip a <label for> only when it holds no control, so a control inside its own for label is read. At the reviewed head, OmpAskFormReader.label() in `src/sha…
Out of Scope Changes check Passed The whole-PR changes, per the raw summary and the head source of label(), are: (1) the label() condition change in omp-ask-form-sections.ts that implements #52500; (2) a doc comment update namin…
Full details: Title check

Explanation

The title names the fix and its scope: OMP ask fields wrapped in a matching label for. The changeset adds a test and changes the label handling in OmpAskFormReader to skip only labels without a control. The title matches the main change and uses the repository's conventional prefix.

Full details: Description check

Explanation

The description follows the template sections: ELI5, What Changed, Why, Linked Issue (Fixes #52500), Visual Proof, Testing, Performance, Risk with level, AI Disclosure, Review, upstream boundary, Notes, and Checklist. It gives a clear before and after, the mechanism, alternatives, and a risk assessment with a revert path. The Visual Proof section links images for before and after. The template's Testing checkbox for manual testing stays unchecked, and the author states the testing was done on Linux (WSL2) only. Those points are minor gaps, not missing required content.

Full details: Linked Issues check

Explanation

Linked issue #52500 requires that Orca skip a &lt;label for&gt; only when it holds no control, so a control inside its own for label is read. At the reviewed head, OmpAskFormReader.label() in src/shared/native-chat/input/questions/omp-ask-form-sections.ts checks holdsControl first. A label that holds a control is flushed, and each control inside it is read with the label text from textOf(label). Only a label without a control that is the labelFor target of its control is skipped, and that label still titles the control through detachedLabel. For the Anything to add? example, the label text is Anything to add? and the input is read as a text field, so the result is not null. I re-read the source file at head and confirmed this logic. I could not read the test diff this run (the diff tool was unavailable), so the added test in omp-ask-form-input.test.ts rests on the raw summary and the earlier assessment. Non-coding items in the issue (manual OMP 19.3.0 run) do not apply.

Full details: Out of Scope Changes check

Explanation

The whole-PR changes, per the raw summary and the head source of label(), are: (1) the label() condition change in omp-ask-form-sections.ts that implements #52500; (2) a doc comment update naming OMP html-form v19.3.0 in the same reader; and (3) one added test case in omp-ask-form-input.test.ts for the wrapped-field form and the detached for label. The screenshots and fixture reference in the PR description document the same behavior. No unrelated code change was identified. The test file was not read directly this run, so this rests partly on the raw summary.

  • 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

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: 6a9adda6-e937-440c-8288-0a60cc3e073c
Commits

Reviewing files that changed from the base of the PR and between cd0488f and 154be24.

Files selected for processing: 1

  • src/shared/native-chat/input/questions/omp-ask-form-input.test.ts

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

OmpAskFormReader.label() returned early for any <label for> naming a
control before checking whether the label wraps controls, so a field
inside such a label was dropped (and a form with only that field parsed
to null, showing no question card). Run the early return only for labels
that hold no control, matching OMP html-form v19.3.0 (oh-my-pi 2f6adc9d69).

Fixes stablyai#52500

Co-authored-by: Neil <[email protected]>
@nwparker
nwparker force-pushed the fix/omp-ask-label-for-wrapping-control branch from cd0488f to 154be24 Compare November 29, 2026 12:33
@nwparker
nwparker merged commit 4aa1ba9 into stablyai:main Nov 29, 2026
58 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.

[Bug][Mobile]: OMP ask drops a field inside a <label for> that names it (oh-my-pi 19.3.0+)

2 participants