Skip to content

fix(tui): prewarm agent runtime before first send#86981

Closed
vincentkoc wants to merge 1 commit into
fix/harness-runtime-prewarmfrom
fix/tui-runtime-prewarm
Closed

fix(tui): prewarm agent runtime before first send#86981
vincentkoc wants to merge 1 commit into
fix/harness-runtime-prewarmfrom
fix/tui-runtime-prewarm

Conversation

@vincentkoc

@vincentkoc vincentkoc commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Start agent runtime prewarm during the first TUI history load.
  • Show warming runtime and block submit until the warmup settles.
  • Keep history rendering tolerant: prewarm failures log a system message and do not break history load.

Verification

  • git diff --check origin/main
  • git diff --check fix/harness-runtime-prewarm..HEAD
  • node scripts/test-projects-serial.mjs src/agents/harness/prewarm.test.ts src/tui/tui-session-actions.test.ts src/tui/tui.test.ts
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-codex.config.ts extensions/codex/index.test.ts

Stack

Stacked on #86930. This PR contains only the TUI consumer wiring for the generic harness prewarm hook.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels May 26, 2026
@vincentkoc vincentkoc force-pushed the fix/harness-runtime-prewarm branch from 1036441 to 961a0f6 Compare May 26, 2026 17:20
@vincentkoc vincentkoc force-pushed the fix/tui-runtime-prewarm branch from e5a588e to aaa2bb9 Compare May 26, 2026 17:20
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed May 29, 2026, 1:18 AM ET / 05:18 UTC.

Summary
The branch adds optional TUI backend runtime prewarm wiring, starts it during initial history load, shows warming runtime, blocks submit for that status, and adds focused TUI tests.

PR surface: Source +56, Tests +52. Total +108 across 6 files.

Reproducibility: yes. for the review finding: source inspection shows the PR's new activityStatus check depends on a field the real runTui caller does not pass. No runtime execution was needed to establish that caller-path mismatch.

Review metrics: 2 noteworthy metrics.

  • Stack Dependency: 1 closed unmerged base PR. The TUI consumer imports the generic prewarm hook from the stack, so maintainers need the base hook accepted or retargeted before main landing.
  • Busy Status Surface: 1 added TUI activity status. The new status controls first-submit availability, so caller wiring and focused proof matter before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🌊 off-meta tidepool
Patch quality: 🧂 unranked krab
Result: blocked by patch quality or review findings.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Pass activityStatus through the real TUI submit path and cover that caller path in a focused test.
  • Resolve the closed base prewarm-hook dependency before treating this as landable on main.

Risk before merge

  • [P1] The PR is stacked on a closed, unmerged base hook, so current main does not yet have the generic harness prewarm API this consumer wiring imports.
  • [P1] The intended first-submit availability guard is not wired through the real TUI submit path, so users can still submit while runtime warmup is active.
  • [P1] The codegraph conflict comment names overlapping TUI edits in related open PRs, so maintainers should coordinate those state-machine changes before merge.

Maintainer options:

  1. Wire The Submit Gate (recommended)
    Pass the current activity status into canSubmitTuiChatMessage or gate sendMessage directly, then add a caller-level test that fails without that wiring.
  2. Resolve The Stack Base
    Reopen or land the generic harness prewarm hook, or retarget this PR after that hook exists on main so the TUI consumer is not stranded on a closed base branch.
  3. Accept Startup Blocking Deliberately
    If maintainers want first TUI submit to wait on runtime warmup, accept the availability tradeoff only with evidence that failures settle and do not leave the TUI stuck.

Next step before merge

  • [P2] Maintainers need to resolve the closed stacked base and decide the startup availability tradeoff; this is not a safe standalone automated repair lane.

Security
Cleared: The diff only changes TUI runtime wiring and tests; it does not alter dependencies, workflows, lockfiles, secrets handling, or package execution paths.

Review findings

  • [P1] Pass activity status through the real submit gate — src/tui/tui.ts:382-384
Review details

Best possible solution:

Land this only after the generic harness prewarm hook exists on the target branch and the real TUI submit path passes or otherwise enforces the warmup busy state with focused TUI proof.

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

Yes for the review finding: source inspection shows the PR's new activityStatus check depends on a field the real runTui caller does not pass. No runtime execution was needed to establish that caller-path mismatch.

Is this the best way to solve the issue?

No. The prewarm direction is plausible, but the current diff does not wire the submit gate through the real caller and depends on a closed unmerged base hook.

Full review comments:

  • [P1] Pass activity status through the real submit gate — src/tui/tui.ts:382-384
    The new warming runtime check only looks at params.activityStatus, but the real editor submit path still calls canSubmitTuiChatMessage without that field, and the params type in this file does not declare it. As a result users can still submit during warmup, and a typecheck should reject the new property access. Thread the current activity status through this caller or gate the send path directly.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 309fdd95dad5.

Label changes

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This is a maintainer-authored draft PR, so the external contributor real-behavior-proof gate does not apply; the PR body lists focused local verification instead.
  • remove rating: 🌊 off-meta tidepool: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority TUI startup/send-path improvement with limited blast radius but real user-visible availability impact.
  • merge-risk: 🚨 availability: Merging changes first TUI startup and submit availability around runtime prewarm, and an incorrectly wired or unproven gate can stall or race first send.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This is a maintainer-authored draft PR, so the external contributor real-behavior-proof gate does not apply; the PR body lists focused local verification instead.
Evidence reviewed

PR surface:

Source +56, Tests +52. Total +108 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 59 3 +56
Tests 2 52 0 +52
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 111 3 +108

What I checked:

  • Repository policy read: Root OpenClaw review policy and TUI/runtime guidance were read before review; scoped TUI and agents guides are relevant because this PR changes TUI startup and agent runtime prewarm behavior. (AGENTS.md:1, 309fdd95dad5)
  • Scoped TUI guidance read: The TUI guide says fake-backend PTY tests do not prove embedded backend runtime, providers, session persistence, or live streaming, which matters for this startup/runtime change. (src/tui/AGENTS.md:1, 309fdd95dad5)
  • PR diff adds warmup submit gate: The PR diff adds a warming runtime check inside canSubmitTuiChatMessage and a test that directly passes activityStatus, making caller wiring part of the behavior being reviewed. (src/tui/tui.ts:382, aaa2bb980b2a)
  • Real TUI caller omits activityStatus: Current runTui constructs the canSubmitTuiChatMessage argument without activityStatus; the PR diff does not update this caller, so the new warmup gate is not reached by the real editor submit path. (src/tui/tui.ts:1328, 309fdd95dad5)
  • Current helper type has no activityStatus field: Current main's canSubmitTuiChatMessage parameter type does not include activityStatus; the PR's new property access needs the type and caller updated together. (src/tui/tui.ts:370, 309fdd95dad5)
  • Current main lacks prewarm symbols: A targeted search on current main finds no prewarmAgentHarnessRuntime, prewarmAgentRuntime, or warming runtime symbols, matching the PR body's statement that this is stacked on the separate harness prewarm hook. (309fdd95dad5)

Likely related people:

  • RomneyDa: Current-main blame for the TUI submit helper/session actions points at Dallin Romney, and related open TUI PRs in the provided context modify the same createSessionActions/runTui surface. (role: recent adjacent TUI contributor; confidence: medium; commits: 5a6472718da9, 21f2ff2ccdff; files: src/tui/tui.ts, src/tui/tui-session-actions.ts)
  • steipete: Peter Steinberger has recent history on shared session model resolution and broader TUI refactors that the embedded backend prewarm path relies on. (role: adjacent refactor owner; confidence: medium; commits: 32ebaa37574e, 38752338dcbc; files: src/tui/embedded-backend.ts, src/tui/tui-session-actions.ts)
  • vignesh07: Vignesh Natarajan authored recent TUI optimistic-message and busy-state related work, which is adjacent to the first-submit blocking behavior changed here. (role: TUI submit/session-state feature contributor; confidence: medium; commits: 61a0b0293104, fca0467082cb; files: src/tui/tui.ts, src/tui/tui-session-actions.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress.

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.
What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@BingqingLyu

This comment was marked as spam.

@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels May 29, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels May 29, 2026
@RomneyDa

RomneyDa commented Jun 9, 2026

Copy link
Copy Markdown
Member

Closing as underlying stacked PR was closed and #90782 is alternative

@RomneyDa RomneyDa closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants