Skip to content

fix(tui): accept valid terminal capability output in test gates - #158748

Merged
fuller-stack-dev merged 2 commits into
mainfrom
fix/tui-terminal-evidence-contract
Sep 26, 2026
Merged

fuller-stack-dev merged 2 commits into
mainfrom
fix/tui-terminal-evidence-contract

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes TUI test gates failing when the host terminal enables native hyperlinks and image capability probing.

Related: #158673. These gate failures are separate from the original Odin Mac lockup.

User Impact

No user-visible rendering change. TUI gates validate the same link and sanitization behavior across supported terminal capabilities.

Why This Change Was Made

Pinned pi-tui emits ST-terminated OSC8 links and queries cell pixels with ESC[16t before rendering on image-capable terminals. The BTW and narrow PTY tests assumed BEL; the PTY evidence parser rejected that exact startup query.

BTW assertions now use the existing column-level OSC8 decoder in both capability modes. PTY assertions authenticate linked glyphs and exact destinations on the current screen, including wrapped URLs. The replay owner accepts only the exact cell-size query outside synchronized frames. Other window operations, response sequences, embedded controls, C1 forms and in-frame queries remain rejected. The parser moved to a focused test-support module to respect the existing file-size limit.

Parallel safety exercises now settle all sibling cleanup before returning. Historical-frame checks run after input completes, avoiding dangling assertion promises on input failure.

Evidence

Fresh canonical reproduction base: 67adcce7e3043601354eacea4444d3361ee729c4. Candidate: 79948808ff651a9b973581a1b8684636a3b698e9, preserving published 89a9c4b68afaca1cb0e4e79eb426f58f735f92bc ancestry. The original branch started on freshly fetched efef0989b7f9682c010a6d36cd390f9cda79f75c. Fresh main before this correction was 2d5c68187a38db0c3bbe4cc18be77c12b0f54727; the intervening package cleanup and plugin-reload changes leave this contract unchanged. Intervening changes leave the rendering/PTY contract unchanged; the TUI CLI hunk only consolidates help formatting.

  • With PI_HYPERLINKS=1, the original BTW assertion failed while preserving the exact URL/text in a complete ST link: 1 failed, 5 passed.
  • With PI_IMAGE_PROTOCOL=kitty PI_HYPERLINKS=1, the original startup/narrow PTY cases both failed. With none/0, those same cases passed. This isolates capability selection from rendering corruption.
  • Exact correction-head focused component/parser/support checks passed 113 tests in 6.93 seconds. Published predecessor focused checks passed 113 tests in 5.42 seconds. The original two PTY cases passed with capabilities enabled.
  • Source-blind validation passed 24 URL renders, 20 control inputs, update/error/recovery and RTL cases. An independent replay of a real private 28×18 PTY capture verified all 97 URL columns across four current-screen rows, exact destinations, intact Unicode, and unlinked surrounding text. Five legal query cases passed and fourteen negative controls were rejected. Private fixture paths were absent after cleanup.
  • API-routed autoreview: no actionable findings through P2 on the full repair and on the subsequent unused re-export correction. Completed ClawSweeper review of the published predecessor also found no actionable defect.
  • The full fake-backend PTY lane passed all 110 tests in 9 files with capabilities enabled, in 343.84 seconds before the patch-identical rebase. The only later change removes an unused forwarding export; internal calls and execution remain unchanged. Targeted lint and formatting passed. Local changed-file checks passed through the test-temp report, then stopped because the typecheck boundary rejects the host-required shared pnpm graph. Hosted production and test typechecks passed on the published predecessor. Its dependency check found one unused forwarding export, now removed. Replacement exact-head CI36229417230 and openclaw/ci-gate passed on 79948808ff651a9b973581a1b8684636a3b698e9, including dependency checks. No duplicate local graph was allocated.
Reproduction and test audit
PI_HYPERLINKS=1 node scripts/run-vitest.mjs src/tui/components/btw-inline-message.test.ts
PI_IMAGE_PROTOCOL=kitty PI_HYPERLINKS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-pty-harness.e2e.test.ts -t 'shows startup activity|renders long Unicode output'
PI_IMAGE_PROTOCOL=none PI_HYPERLINKS=0 node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-pty-harness.e2e.test.ts -t 'shows startup activity|renders long Unicode output'

Escaped raw link evidence from the original failure:

Expected opening: ESC]8;;https://example.test/tui/btw?copy=caf%C3%A9 BEL
Actual complete link: \x1b]8;;https://example.test/tui/btw?copy=caf%C3%A9\x1b\\https://example.test/tui/btw?copy=caf%C3%A9\x1b]8;;\x1b\\
PTY rejection: unsupported CSI in TUI PTY evidence: "\u001b[16t"

Audited every case, assertion, helper, fixture, import, setup/teardown and skip in btw-inline-message.test.ts, tui-pty-harness-assertion-test-support.test.ts, tui-pty-harness-assertion-test-support.ts, tui-pty-test-support.ts, and tui-pty-terminal-evidence-test-support.ts. Existing layout, initial/update/error, RTL, empty/control-only fallback, malformed-control, stale/erased/unfinished-frame and process-disposal coverage remains. Added link metadata is cleared by overwrite/erase and follows scrolling. Capability state is restored in finally. No cases were deleted, no retries/timeouts/skips changed, and no dependency or production-renderer changes were made. The replaced raw-byte assertions now prove complete visible links instead of one terminator spelling or aggregate redraw counts.

The overlapping #158714 BTW edit only simplifies an empty-error fixture; it does not repair these assertions.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 26, 2026 08:05
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 4:25 AM ET / 08:25 UTC (Revision 2).

ClawSweeper review

What this changes

The branch updates TUI component and PTY test support to accept valid terminal capability output while checking visible hyperlinks and their destinations.

Merge readiness

✅ Ready for maintainer review

Current main and the latest release still contain the capability-sensitive test gates. Neither related PR owns this correction, and the reviewed patch has no identified blocking defect.

Priority: P2
Reviewed head: 79948808ff651a9b973581a1b8684636a3b698e9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused before-and-after PTY evidence and no identified correctness or security blocker.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The changed owner is the TUI test evidence replay. The PR body records baseline escape output and after-fix checks through the real TUI loop in a PTY with a fake backend and terminal capabilities enabled; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed owner is the TUI test evidence replay. The PR body records baseline escape output and after-fix checks through the real TUI loop in a PTY with a fake backend and terminal capabilities enabled; no stored-data contract changes.
Evidence reviewed 7 items Changed hyperlink assertion: The test checks the URL's linked terminal columns and destination in both hyperlink capability modes.
Changed PTY evidence boundary: The replay admits the exact CSI 16 t query as a lifecycle sequence, rejects lifecycle CSI inside a synchronized frame, and reconstructs linked cells on the current screen.
Dependency signal: The changed component test imports pi-tui's capability setters, column decoder, and width calculation; the component itself also imports pi-tui.
Findings None None.
Security None None.

How this fits together

OpenClaw's terminal UI renders components into terminal escape sequences. A PTY test harness captures that output, reconstructs the visible screen, and uses it to decide whether rendering and sanitization checks pass.

flowchart LR
A[Terminal capabilities] --> B[TUI renderer]
B --> C[PTY output]
C --> D[Evidence parser]
D --> E{Valid screen and links?}
E --> F[Test gate result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +127. Total +127 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 5 426 299 +127
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 426 299 +127

Review metrics

None.

Technical review

Best possible solution:

Keep the test gate anchored to visible linked cells and the exact image-capability query while preserving rejection of other terminal controls.

Do we have a high-confidence way to reproduce the issue?

Yes. The PR gives exact capability settings and failing baseline output, and the pinned dependency source explains both sequences; this read-only review did not execute the tests.

Is this the best way to solve the issue?

Yes. The patch corrects the test evidence boundary and checks rendered link destinations without changing the production renderer or broadly accepting terminal controls.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6c7544adc982.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs capability-dependent TUI test failures without changing user-visible rendering.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed owner is the TUI test evidence replay. The PR body records baseline escape output and after-fix checks through the real TUI loop in a PTY with a fake backend and terminal capabilities enabled; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed owner is the TUI test evidence replay. The PR body records baseline escape output and after-fix checks through the real TUI loop in a PTY with a fake backend and terminal capabilities enabled; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-26T08:12:06.551Z sha 89a9c4b :: needs maintainer review before merge. :: none

@fuller-stack-dev
fuller-stack-dev merged commit e91fd2e into main Sep 26, 2026
117 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/tui-terminal-evidence-contract branch September 26, 2026 08:35
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant