Skip to content

fix(tui): keep PTY progress and lifecycle truthful - #117402

Merged
steipete merged 1 commit into
mainfrom
codex/goal100k-tui-pty-progress-0801-2d45
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/goal100k-tui-pty-progress-0801-2d45

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The dedicated TUI PTY shard can exceed the 300-second no-output watchdog even while its serial real-backend tests are completing normally. Vitest's default non-TTY reporter buffers successful test results until a file finishes, so CI sees no child output and kills/retries a healthy shard. This is visible in main job 91358851223, PR job 91359114476, and job 91361015856.

The verbose reporter exposed a second, independent bug in the real local PTY test and product state projection: local lifecycle end was rendered as idle before agentCommandFromIngress had completed post-turn maintenance. /exit could therefore begin while the embedded backend was intentionally still waiting for maintenance, hit the PTY's 4-second exit assertion, and then spend the 120-second shutdown grace in cleanup.

Why This Change Was Made

  • Use Vitest's supported verbose reporter for this intentionally serial shard so every completed test produces truthful watchdog progress. Vitest 4.1.10's default reporter disables its live summary in non-TTY CI, while VerboseReporter logs every finished test case.
  • Keep a tracked local run in finishing context across lifecycle end; its authoritative chat.final, emitted after post-turn maintenance, now owns the transition to idle. Gateway, untracked, concurrent, and already-finalized runs retain their existing behavior.
  • Make the existing /new PTY scenario wait for the second turn's own response and subsequent authoritative idle before /exit, excluding stale output from the first turn and session rollover.
  • Consolidate a duplicate setActivityStatus("error") branch while touching the owner, leaving production code at net -1 LOC.

The reporter override was already prototyped by Peter Steinberger in open PR #114388, commit f4ed4554410bb4b9017461db69aa4d11196bca22; this standalone PR extracts it onto current main. The incomplete second-turn wait was introduced in cd305b3b0cb9fcedaccfd5cec3b0ced1fde032ce (#100241).

User Impact

Local TUI users no longer see a false idle status while post-turn maintenance is still running. CI gets real per-test progress instead of false no-output watchdog terminations. No timeout, retry, worker-count, shutdown-grace, config, protocol, or public API changes are included.

Evidence

  • Dedicated Linux PTY shard with verbose reporting: a 418.69-second diagnostic run continued past 300 seconds because completed tests emitted progress; its only failure exposed the /exit lifecycle race rather than a watchdog kill.
  • Same full dedicated shard on a warmed Linux Testbox: 3 files, 65/65 tests passed in 123.37 seconds.
  • Final local-owner handler suite: 162/162 tests passed.
  • Exact real local PTY scenario after the owner fix: 1/1 passed in 8.655 seconds under OPENCLAW_TUI_PTY_INCLUDE_LOCAL=1 and the dedicated PTY config.
  • Tooling regressions: 281/281 tests passed for the CI plan and project runner.
  • Scoped changed gate completed all structural checks, dead-code scans, typechecks, and non-TUI lint shards; it found only the new max-lines threshold during TUI lint. The final compacted patch then passed exact four-file oxlint with 0 warnings/errors.
  • Fresh xhigh autoreview: TruffleHog clean, no actionable findings, patch correctness 0.99.

No changelog entry: this repairs TUI status truthfulness and CI test observability without adding a user-facing feature.

Current-main integration and macOS disposition

  • Raw PR head 75673e201195ea3ec8d462daf44fa79011621936 has parent 4e47c4cabf8f2901ec781b59d059999211398813; it predates the already-landed TUI shutdown work in cd4bd7c6c0ca860babbcbf0b68a066f3627ad547.
  • A macOS run on that raw, stale branch head reproduced the /exit timeout after the second response and visible idle. This is recorded here for transparency, but it is not the composition GitHub will land.
  • Refreshed origin/main b5a59e0a7d948a8b9021b97ab5c66248f12303d2 plus the PR head merges cleanly. git merge-tree --write-tree origin/main 75673e201195ea3ec8d462daf44fa79011621936 produced tree 8cc5092c28a7b6447daa8bf1381111cb4a2d1e4c; the only same-path overlap since the PR base is src/tui/tui-pty-local.e2e.test.ts.
  • Inspection of that exact merged tree preserves main’s PTY listener lifetime, graceful-termination escalation, concurrent provider/process teardown, and submit-burst disposal, while also preserving this PR’s local false-idle predicate, second-response idle barrier, and verbose reporter.
  • Exact current-main merged-result macOS PTY proof: drives the real local backend with a mocked model endpoint passed 1/1 in 14.603 seconds, including first response, /new, second response, subsequent authoritative idle, and /exit.
  • Exact merged-result focused lifecycle proof: src/tui/tui-event-handlers.test.ts passed 162/162.
  • Hosted CI at the exact PR head completed with the CI gate, checks-node-compact-small-2, and real-behavior proof successful; earlier cancelled duplicate workflow dispatches were superseded by successful runs.

No rebase or branch push is needed: the current-main three-way composition is clean, the actual merged behavior is proven on macOS, and native SHA-pinned squash landing against a fresh base will retain both sides.

ClawSweeper rank-up moves

  • Resolve merge risk: completed through exact current-main merge-tree inspection plus merged-result macOS PTY and lifecycle proof.
  • Complete next step: no mechanical repair remains; the protected maintainer review/landing decision remains intentionally human-owned.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 9:05 AM ET / 13:05 UTC.

ClawSweeper review

What this changes

The branch makes the serial TUI PTY Vitest shard emit per-test progress, keeps local runs in “finishing context” until their final chat event, and makes the /new PTY scenario wait for the second turn before exiting.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

This PR is still necessary: current main unconditionally renders a tracked lifecycle end as idle before the embedded local backend emits its authoritative final chat event. The patch moves that local completion boundary to the existing final-chat path, adds the corresponding PTY ordering check, and has strong supplied real-behavior proof; it should remain open for the protected maintainer landing decision.

Priority: P2
Reviewed head: 75673e201195ea3ec8d462daf44fa79011621936
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The focused owner-boundary patch has direct source support, regression coverage, and strong after-fix local-PTY proof with no actionable defect found.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides an exact current-main merged-result macOS local-PTY run, a focused lifecycle-suite result, and successful hosted real-behavior proof; the local smoke’s external model endpoint is mocked as required by the scoped TUI policy.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides an exact current-main merged-result macOS local-PTY run, a focused lifecycle-suite result, and successful hosted real-behavior proof; the local smoke’s external model endpoint is mocked as required by the scoped TUI policy.
Evidence reviewed 7 items Current-main defect remains: Current main sets the activity status to idle for every lifecycle end after a known run, including a local run that has not yet emitted its final chat event; the PR replaces this only for tracked, unfinished local runs.
Authoritative completion occurs later: The embedded backend awaits agentCommandFromIngress, then emits the final chat event after terminal outcome handling; therefore the final-chat path is the correct local owner for the idle transition.
Existing final-chat owner: The shared TUI lifecycle helper records a run as finalized and sets idle when the final-chat handling identifies the active run, preserving concurrent-run promotion semantics.
Findings None None.
Security None None.

How this fits together

The terminal UI projects agent lifecycle and chat events into a visible activity status while the embedded local backend runs an agent turn. The PTY test lane drives that real local TUI flow and its reporter output is the CI watchdog’s liveness signal.

flowchart LR
  A[Local TUI input] --> B[Embedded agent turn]
  B --> C[Lifecycle events]
  B --> D[Final chat event]
  C --> E[Activity status projection]
  D --> E
  E --> F[TUI display and PTY exit]
  G[Serial PTY tests] --> H[Verbose test reporter]
  H --> I[CI watchdog progress]
Loading

Decision needed

Question Recommendation
Should this maintainer-labelled TUI lifecycle repair be landed after the normal exact-head merge gate confirms the reviewed composition? Land the focused repair: Merge the current clean composition after the normal exact-head checks confirm the reviewed branch remains ready.

Why: The patch has no supported mechanical blocker, but the repository’s protected maintainer label keeps the final landing decision human-owned.

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1, Tests +43. Total +42 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 6 -1
Tests 3 43 0 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 48 6 +42

Review metrics

Metric Value Why it matters
Watchdog visibility 1 reporter override The serial PTY lane now emits completed-test progress, directly changing the CI no-output watchdog signal without changing runtime worker or timeout policy.

Technical review

Best possible solution:

Land the focused repair against current main, retaining final chat as the sole local-run proof of post-turn completion and the serial PTY reporter as the watchdog-progress mechanism.

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

Yes, from source: current main renders lifecycle end as idle at src/tui/tui-event-handlers.ts:681, while the embedded local backend emits final chat only after the awaited agent turn returns at src/tui/embedded-backend.ts:1504. The branch adds the deterministic local-run regression and second-turn PTY barrier, although this read-only review did not execute them.

Is this the best way to solve the issue?

Yes. The patch repairs the projection at the event owner instead of extending shutdown timing or compensating in the consumer; final chat is already the lifecycle helper’s authoritative path for setting idle.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This fixes a bounded terminal-UI lifecycle truthfulness defect and recurring test-liveness problem without evidence of a wider production outage.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides an exact current-main merged-result macOS local-PTY run, a focused lifecycle-suite result, and successful hosted real-behavior proof; the local smoke’s external model endpoint is mocked as required by the scoped TUI policy.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an exact current-main merged-result macOS local-PTY run, a focused lifecycle-suite result, and successful hosted real-behavior proof; the local smoke’s external model endpoint is mocked as required by the scoped TUI policy.

Evidence

What I checked:

  • Current-main defect remains: Current main sets the activity status to idle for every lifecycle end after a known run, including a local run that has not yet emitted its final chat event; the PR replaces this only for tracked, unfinished local runs. (src/tui/tui-event-handlers.ts:675, fb9c8e74e619)
  • Authoritative completion occurs later: The embedded backend awaits agentCommandFromIngress, then emits the final chat event after terminal outcome handling; therefore the final-chat path is the correct local owner for the idle transition. (src/tui/embedded-backend.ts:1504, fb9c8e74e619)
  • Existing final-chat owner: The shared TUI lifecycle helper records a run as finalized and sets idle when the final-chat handling identifies the active run, preserving concurrent-run promotion semantics. (src/tui/tui-run-lifecycle.ts:282, fb9c8e74e619)
  • Focused regression coverage: The branch adds a local-run lifecycle regression that asserts end does not set idle before final chat, and extends the real local PTY /new flow to wait for the second response and its subsequent idle state before /exit. (src/tui/tui-event-handlers.test.ts:977, 75673e201195)
  • CI liveness change is narrow: The branch changes only the serial TUI PTY Vitest configuration to use the verbose reporter; it leaves workers, timeouts, retries, and public runtime configuration untouched. (test/vitest/vitest.tui-pty.config.ts:46, 75673e201195)
  • Feature-history routing: Blame attributes the current lifecycle projection region to Peter Steinberger, and the history includes the merged TUI session-lifecycle work that introduced the /new path this test now orders correctly. (src/tui/tui-event-handlers.ts:638, cd305b3b0cb9)

Likely related people:

  • steipete: Current lifecycle projection blame, the merged TUI session-lifecycle change, the current shutdown repair, and this branch all trace to Peter Steinberger / steipete. (role: feature owner and recent area contributor; confidence: high; commits: cd305b3b0cb9, cd4bd7c6c0ca, 75673e201195; files: src/tui/tui-event-handlers.ts, src/tui/embedded-backend.ts, src/tui/tui-pty-local.e2e.test.ts)
  • Vincent Koc: History shows multiple prior PTY shutdown and CI-shard fixes in the same TUI test surface, making this a useful secondary reviewer for teardown or watchdog implications. (role: adjacent PTY reliability contributor; confidence: medium; commits: c21dcfc7c272, 0d86f64e602e; files: src/tui/tui-pty-local.e2e.test.ts, test/vitest/vitest.tui-pty.config.ts)

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 (2 earlier review cycles)
  • reviewed 2026-08-01T12:35:58.564Z sha 75673e2 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T12:43:37.895Z sha 75673e2 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review August 1, 2026 12:38
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 1, 2026
@steipete
steipete merged commit 339b827 into main Aug 1, 2026
199 of 208 checks passed
@steipete
steipete deleted the codex/goal100k-tui-pty-progress-0801-2d45 branch August 1, 2026 13:46
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

pull Bot pushed a commit to NickHood1984/openclaw that referenced this pull request Aug 1, 2026
* origin/main:
  docs: generate docs map at publish time (openclaw#117398)
  refactor(plugins): move plugin contributions into the registry bundle (openclaw#117372)
  fix(tui): keep PTY progress and lifecycle truthful (openclaw#117402)
  test(xai): type realtime sent item payloads
  fix(qa): preserve Slack fallback evidence (openclaw#117420)
  fix(qa): satisfy update lane execution contracts (openclaw#117388)
  fix(qa): Matrix replies disappear after final replacement (openclaw#117390)
  test(xai): prove rejected tool call continuation
  fix(xai): complete rejected realtime tool calls
  test(xai): add live tool argument probe
  test(xai): cover rejected realtime tool arguments
  fix(xai): validate realtime tool arguments before dispatch
  fix(xai): skip tool call when rawArgs JSON parse fails instead of silently falling back to empty args
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main:
  docs: generate docs map at publish time (openclaw#117398)
  refactor(plugins): move plugin contributions into the registry bundle (openclaw#117372)
  fix(tui): keep PTY progress and lifecycle truthful (openclaw#117402)
  test(xai): type realtime sent item payloads
  fix(qa): preserve Slack fallback evidence (openclaw#117420)
  fix(qa): satisfy update lane execution contracts (openclaw#117388)
  fix(qa): Matrix replies disappear after final replacement (openclaw#117390)
  test(xai): prove rejected tool call continuation
  fix(xai): complete rejected realtime tool calls
  test(xai): add live tool argument probe
  test(xai): cover rejected realtime tool arguments
  fix(xai): validate realtime tool arguments before dispatch
  fix(xai): skip tool call when rawArgs JSON parse fails instead of silently falling back to empty args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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