Repository navigation
fix(kimi): recognize the sessionless startup composer - #22726
kinescoper wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
ℹ️ No critical issues — one deferred observation on the matcher's forward compatibility.
Reviewed changes
Kimi 2 creates its session lazily, so its sessionless startup composer has no SessionStart/Stop hook and tui-idle waits timed out. This PR recognizes the captured startup screen and lets Kimi's own status outrank a retained startup frame. Reviewed the complete diff at 624f78e:
- New Kimi readiness matcher (
kimi-terminal-readiness.ts): locates the lastwelcome to kimi code!, requires the sessionless notice after it withdirectory:/model:/version:in between, then requires the tail after the notice to be exactly three non-blank rows (notice,╭─╮,│ > │). - Wired into tier-1 evidence (
terminal-wait-detection.ts): added tofindKnownReadyPromptIndex. - Kimi-specific precedence (
tui-idle-evidence.ts): a fresh working/blocked/waiting first-party status now returnsfalsebefore the tier-1 positive check, so Kimi's own account of itself outranks the retained startup frame. - Two captured fixtures + sidecars and a 8-case transcript suite covering pre-registered waits, local and simulated-SSH panes, repeated waits, model-picker refusal, retained-tail veto under fresh status, and ordinary-output refusal.
I traced the tail normalization: the fixture's trailing cursor-up ([3A) splices the rows below the input line, so the retained tail genuinely is the three-row composer — the lines.length !== 3 guard is what rejects both the model-picker and ordinary-output fixtures. Tests pass (new suite 8/8; related suites 78/78), and oxlint is clean on the changed sources. The Kimi-specific precedence is consistent with the existing delivery gate (a working agent should not be typed into), and the guard correctly does not fire during the initial sessionless wait, where firstPartyStatus is null.
ℹ️ The exact-row match silently reverts the fix when Kimi's screen shifts
The matcher is a byte-exact three-row tail (kimi-terminal-readiness.ts:24-31). That is the right call for pinning a captured screen, but it also means the failure mode is invisible: a Kimi patch that adds a hints row, wraps the notice at a narrower width, or a different --cols all make recognition stop, and the wait simply returns to the original silent timeout with no signal that the screen changed. The author already flagged that later revisions will need new fixtures; worth deciding now whether a cheap fallback (a looser body match held to quiescence, like the Muse lane) or at least a distinguishable timeout reason is warranted before this ships as the only signal for sessionless Kimi readiness.
Technical details
# Kimi sessionless match has no degradation path
## Affected sites
- `src/main/runtime/kimi-terminal-readiness.ts:24-31` — `lines.length !== 3` plus the two exact row regexes is the whole match; no partial/looser evidence tier.
## Required outcome
- Decide whether a screen the matcher no longer recognizes should fail identically to "agent never became ready" (current behavior: a bare `timeout`), or whether it should degrade to a weaker signal or surface a distinct reason so the regression is diagnosable.
## Open questions for the human
- Is the three-row tail stable across the Kimi versions/terminal sizes Orca targets, or is a capture per size expected?
- Would a lower-tier "startup banner seen, stream quiet" fallback (mirroring `hasQuietMuseReadyPrompt`) be acceptable, or does it risk the mid-turn settle the model-picker fixture guards against?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds fixtures and detection for Kimi’s sessionless ready prompt. Runtime readiness checks now pass pane-agent identity to known-ready prompt detection. Kimi idle checks treat any non-null first-party status other than Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The reviewed startup-readiness change is mergeable after normal checks. An unidentified pane will wait for Kimi identity to be confirmed rather than report readiness from its screen alone. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to This changes when automated work may proceed. Identity checks and activity-state checks limit false readiness, but the freshness of some screen reads remains unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: bd93029a-eeaf-4732-80e1-f2c8e4801022
📒 Files selected for processing (8)
src/main/runtime/__fixtures__/kimi-sessionless-model-picker.meta.jsonsrc/main/runtime/__fixtures__/kimi-sessionless-model-picker.txtsrc/main/runtime/__fixtures__/kimi-sessionless-ready.meta.jsonsrc/main/runtime/__fixtures__/kimi-sessionless-ready.txtsrc/main/runtime/kimi-readiness-transcripts.test.tssrc/main/runtime/kimi-terminal-readiness.tssrc/main/runtime/terminal-wait-detection.tssrc/main/runtime/tui-idle-evidence.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
|
||
| function findKnownReadyPromptIndex(normalized: string): number | null { | ||
| const indexes = [ | ||
| findKimiSessionlessReadyPromptIndex(normalized), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '70,135p' src/main/runtime/terminal-wait-detection.ts
sed -n '35,190p' src/main/runtime/tui-idle-evidence.ts
sed -n '40,110p' src/main/runtime/runtime-terminal-wait.ts
rg -n 'findKnownReadyPromptIndex|isKnownReadyPromptPreview|isTuiIdleSatisfied' src/main/runtimeRepository: stablyai/orca
Length of output: 19366
🏁 Script executed:
sed -n '1,75p' src/main/runtime/terminal-wait-detection.ts
sed -n '1,130p' src/main/runtime/kimi-terminal-readiness.ts
sed -n '320,440p' src/main/runtime/terminal-wait-detection.test.ts
sed -n '1,130p' src/main/runtime/kimi-readiness-transcripts.test.ts
sed -n '95,220p' src/main/runtime/orca-runtime-resolve-exit-waiters.ts
sed -n '105,215p' src/main/runtime/runtime-terminal-idle-polls.ts
rg -n "getPaneAgent|resolve.*Agent|TuiAgent|agent.*kimi|kimi" src/main/runtime src/main/shared src/sharedRepository: stablyai/orca
Length of output: 42067
🏁 Script executed:
rg -n "getPaneAgentForTuiIdle|getPaneAgent|createTranscriptPane|launchAgent|paneTitle|foregroundProcess" src/main src/shared --glob '*.ts' | head -240
sed -n '130,210p' src/main/runtime/tui-idle-evidence.ts
sed -n '1,180p' src/main/runtime/agent-transcript-pane-test-harness.tsRepository: stablyai/orca
Length of output: 32159
Exclude Kimi readiness from known non-Kimi panes.
getPaneAgentForTuiIdle resolves the pane agent from launchAgent or foregroundAgent, but isKnownReadyPromptPreview does not receive that identity. A known non-Kimi pane can therefore match the Kimi welcome metadata and empty-composer frame in its retained transcript.
All tui-idle callers treat this match as positive evidence before the general non-done status veto. The wait can resolve while the non-Kimi pane is still active. The same predicate also gates mailbox delivery, which can inject input into a running pane.
Pass the resolved agent to the detector from every tui-idle caller. Suppress only the Kimi candidate for known non-Kimi agents. Keep it available for unknown agents because an unknown pane may be a sessionless Kimi pane.
Suggested fix
+import type { TuiAgent } from '../../shared/tui-agent'
+
-export function isKnownReadyPromptPreview(preview: string): boolean {
+export function isKnownReadyPromptPreview(
+ preview: string,
+ agent?: TuiAgent | null
+): boolean {
const normalized = preview.toLowerCase()
- const readyIndex = findKnownReadyPromptIndex(normalized)
+ const readyIndex = findKnownReadyPromptIndex(normalized, agent)
@@
-function findKnownReadyPromptIndex(normalized: string): number | null {
+function findKnownReadyPromptIndex(
+ normalized: string,
+ agent?: TuiAgent | null
+): number | null {
const indexes = [
- findKimiSessionlessReadyPromptIndex(normalized),
+ agent === null || agent === undefined || agent === 'kimi'
+ ? findKimiSessionlessReadyPromptIndex(normalized)
+ : null,
findCodexReadyPromptIndex(normalized),
findAntigravityReadyPromptIndex(normalized),
findCursorReadyPromptIndex(normalized)There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 4c038bc2-4cbe-4119-973e-fc933895477c
📒 Files selected for processing (8)
src/main/runtime/kimi-readiness-transcripts.test.tssrc/main/runtime/orca-runtime-resolve-exit-waiters.tssrc/main/runtime/orca-runtime-start-tui-idle-visible-read-probe.tssrc/main/runtime/orca-runtime-stop-structured-session-process.tssrc/main/runtime/runtime-terminal-agent-presence.tssrc/main/runtime/runtime-terminal-idle-polls.tssrc/main/runtime/runtime-terminal-wait.tssrc/main/runtime/terminal-wait-detection.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run covers the delta since the prior pullfrog review (624f78e): commit 967b9af scopes the Kimi startup matcher to the pane's resolved agent and adds three regression cases.
- Agent-gated Kimi matcher —
isKnownReadyPromptPreviewnow takes the pane's resolvedTuiAgent, andfindKnownReadyPromptIndexruns the Kimi sessionless finder only when the agent iskimior unresolved. A known Codex/Claude pane can no longer settle on a quoted Kimi frame. - Agent threaded through every satisfaction site — the resolved pane agent (launch authority, then foreground) is now passed at each
isTuiIdleSatisfied/ presence / visible-read call site, so the immediate check and the poll agree about the same pane. - Three regression cases — a working Codex and Claude pane displaying the Kimi capture must time out, and an unknown-agent pane with the same capture must still settle.
I confirmed the new gate is load-bearing rather than decorative: removing it makes the two cross-agent cases resolve satisfied: true where a timeout is required, so the tests genuinely fail with the bug present. The agent value is sourced identically everywhere (ptysById.get(ptyId)?.launchAgent ?? foregroundAgent, including getTrackedPty in the presence path), so no site can rank the same pane differently. The Kimi suite is 11/11 and the related readiness suites pass (87 tests). The Kimi precedence early return and the narrow exact-row match are unchanged from the reviewed commit.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run covers the delta since the prior pullfrog review (967b9af): commit 32c8f0c closes a stale-snapshot race in the single-shot visible-screen probe and adds a six-case suite.
- Live-status recheck in the visible-screen probe — the probe bypasses
isTuiIdleSatisfied, so after the async screen read returns it now re-resolves the pane agent and, for Kimi, refuses to settle on a ready snapshot when a fresh working/blocked/waiting first-party status arrived while the read was in flight. The guard is skipped whenblockedReasonis set, so a blocked prompt still reports. - Six regression cases (
kimi-visible-probe-status.test.ts) — working/blocked/waiting arriving mid-read must not settle, a ready snapshot with no status settles, working→done settles on the latest status, and a waiting status with a blocked tail still reportsagent-trust-workspace.
I confirmed the guard is load-bearing: forcing its condition false makes the three mid-read cases resolve satisfied: true where a timeout is required. I also traced every direct buildTerminalWaitResult/buildPtyTerminalWaitResult site and every other tui-idle settle path routes through isTuiIdleSatisfied, so the visible probe was the only path bypassing the Kimi status veto. New suite 6/6; related suites (kimi-readiness-transcripts, terminal-wait-detection, tui-idle-evidence) 69/69; oxlint clean on both changed files.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Reject a visible snapshot when the effective… · orca-runtime-start-tui-idle-visible-read-probe.ts:84-101
src/main/runtime/orca-runtime-start-tui-idle-visible-read-probe.ts:84-101
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winReject a visible snapshot when the effective agent changes.
An adopted PTY can keep the same handle while its
foregroundAgentchanges. The probe captures the original agent beforereadTerminalstarts, then classifies the completed snapshot with that captured agent. The current-agent check only rejects fresh Kimi working status. An old Kimi ready snapshot can therefore resolve the current wait as idle after the PTY changes to another agent.Suggested fix
+ const ptyId = + this.getLivePtyForHandle(waiter.handle)?.pty.ptyId ?? + this.getLiveLeafForHandle(waiter.handle).leaf.ptyId + const liveAgent = this.getPaneAgentForTuiIdle(ptyId) + if (liveAgent !== agent) { + return + } const snapshotText = - agent === 'antigravity' + liveAgent === 'antigravity' ? [...projection.tail, projection.draft ?? ''].join('\n') : projection.tail.join('\n') const blockedReason = detectTerminalWaitBlockedReason(snapshotText) const ready = - agent === 'antigravity' + liveAgent === 'antigravity' ? isAntigravityReadyPromptSnapshot(snapshotText) - : isKnownReadyPromptPreview(snapshotText, agent) + : isKnownReadyPromptPreview(snapshotText, liveAgent) if (!blockedReason && !ready) { return } // The agent can become busy while the provider's screen read is in flight. - const ptyId = - this.getLivePtyForHandle(waiter.handle)?.pty.ptyId ?? - this.getLiveLeafForHandle(waiter.handle).leaf.ptyId - const liveAgent = this.getPaneAgentForTuiIdle(ptyId) ?? agent if (
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 31ba5139-d5d5-4f57-9e49-391070d87a05
📒 Files selected for processing (2)
src/main/runtime/kimi-visible-probe-status.test.tssrc/main/runtime/orca-runtime-start-tui-idle-visible-read-probe.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/runtime/orca-runtime-start-tui-idle-visible-read-probe.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run covers the delta since the prior pullfrog review (32c8f0c): commit 1f32bb0 makes the Kimi status veto age-independent and re-resolves the pane's live identity in the single-shot visible-screen probe.
- Age-independent Kimi status veto —
hasUnfinishedKimiTurnreplaces the freshness-bounded check inisTuiIdleSatisfied, so a Kimiworking/blocked/waitingstatus keeps vetoing readiness past the 30-minute window; only a subsequentdonestatus or the provider-generation reset clears it. - Live pane identity in the visible-screen probe — after the async read returns, the probe re-resolves
ptyIdand the pane's current agent and classifies the snapshot with it (isAntigravityReadyPromptSnapshotorisKnownReadyPromptPreview(text, liveAgent)), then applies the samehasUnfinishedKimiTurnveto. A pane that changes identity mid-read is now ranked by its current agent, so a retained Kimi frame cannot settle a pane that has since become Codex/Claude. - Regression coverage — aged (31-minute) working/blocked/waiting statuses in both the transcript and probe paths, unknown→Codex/Claude/Kimi identity changes during a read, and completion after an aged working status.
I confirmed the new age-independence tests are load-bearing: under the old freshness gate a 31-minute-old working status would not veto, so tier-1 body evidence would settle where these tests require a timeout. Traced both call sites — the isTuiIdleSatisfied early return (which already outranked tier-1 body evidence for Kimi) only loses the freshness window, and the probe's veto is still skipped when blockedReason is set, so blocked prompts keep reporting. Suites pass: kimi-readiness-transcripts 14/14, kimi-visible-probe-status 13/13, terminal-wait-detection 50/50, tui-idle-evidence 8/8; oxlint clean on the four changed files.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: f4e2d799-f657-4317-ae5f-16bc2fbb5e2a
📒 Files selected for processing (4)
src/main/runtime/kimi-readiness-transcripts.test.tssrc/main/runtime/kimi-visible-probe-status.test.tssrc/main/runtime/orca-runtime-start-tui-idle-visible-read-probe.tssrc/main/runtime/tui-idle-evidence.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| const ptyId = | ||
| this.getLivePtyForHandle(waiter.handle)?.pty.ptyId ?? | ||
| this.getLiveLeafForHandle(waiter.handle).leaf.ptyId | ||
| const liveAgent = this.getPaneAgentForTuiIdle(ptyId) ?? agent |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Inspect whether a waiter and screen read can survive PTY replacement.
set -euo pipefail
rg -n -C 5 'getLivePtyForHandle\(|getLiveLeafForHandle\(|startTuiIdleVisibleReadProbe\(' src/main/runtime
rg -n -C 5 'terminalWaiters\.(resolve|reject|delete|remove|clear)|registerPty\(|visibleScreenOnly' src/main/runtimeRepository: stablyai/orca
Length of output: 45667
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- probe ---'
cat -n src/main/runtime/orca-runtime-start-tui-idle-visible-read-probe.ts | sed -n '1,135p'
printf '%s\n' '--- waiter symbols ---'
rg -n -C 8 'type TerminalWaiter|interface TerminalWaiter|terminalWaiters|startTuiIdleVisibleReadProbe|readTerminal\(' src/main/runtime -g '*.ts' -g '!*.test.ts'
printf '%s\n' '--- replacement and registration symbols ---'
rg -n -C 10 'registerPty|replace.*Pty|rebind|handleByPtyId|handles\.set|onPtyExit|waiter' src/main/runtime -g '*.ts' -g '!*.test.ts' | head -n 1600
printf '%s\n' '--- provider read implementation ---'
cat -n src/main/runtime/orca-runtime-capture-provider-terminal-buffer.ts | sed -n '120,190p'Repository: stablyai/orca
Length of output: 45647
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- candidate files ---'
rg -l 'class .*Waiter|terminalWaiters|registerPty\(|bindPty|rebind.*handle|handleByPtyId' src/main/runtime -g '*.ts' -g '!*.test.ts' | sort -u
printf '%s\n' '--- waiter-store definitions ---'
rg -n -C 12 'class .*Waiter|terminalWaiters\s*=|rejectHandle\(|remove\(waiter|resolve\(waiter|rejectAll\(' src/main/runtime -g '*.ts' -g '!*.test.ts' | head -n 1200
printf '%s\n' '--- register/rebind definitions ---'
rg -n -C 15 '^[[:space:]]*(protected |private |public )?(async )?(registerPty|bindPty|rebindPty|replacePty|onPtyExit)\b|registerPty\s*\(' src/main/runtime -g '*.ts' -g '!*.test.ts' | head -n 1600Repository: stablyai/orca
Length of output: 42728
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- waiter registry ---'
cat -n src/main/runtime/runtime-terminal-waiter-registry.ts
printf '%s\n' '--- bind incarnation handle ---'
cat -n src/main/runtime/orca-runtime-bind-pty-incarnation-handle.ts
printf '%s\n' '--- register pty ---'
cat -n src/main/runtime/orca-runtime-register-pty.ts
printf '%s\n' '--- invalidate handles ---'
cat -n src/main/runtime/orca-runtime-invalidate-all-handles-for-pty.ts
printf '%s\n' '--- handle/pty maps and binding callers ---'
rg -n -C 12 'bindPtyIncarnationHandle|issuePtyHandle|handleByPtyId|handleByPtyIncarnation|invalidateAllHandlesForPty|rejectWaitersForHandle|registerPty\(' src/main/runtime/orca-runtime*.ts src/main/runtime/runtime-terminal*.ts -g '*.ts' -g '!*.test.ts' | head -n 1800Repository: stablyai/orca
Length of output: 42774
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- invalidate all handles ---'
cat -n src/main/runtime/orca-runtime-invalidate-all-handles-for-pty.ts
printf '%s\n' '--- bind/reconcile callers ---'
rg -n -C 18 'bindPtyIncarnationHandle\(|invalidatePtyIncarnationHandle\(|invalidateLeafHandle\(|adoptFirstPtyForLeafHandle\(|reconcilePtyIncarnationHandles\(' src/main/runtime/orca-runtime*.ts -g '*.ts' -g '!*.test.ts'
printf '%s\n' '--- graph sync relevant section ---'
rg -n -C 20 'reconcilePtyIncarnationHandles|invalidateLeafHandle|adoptFirstPtyForLeafHandle|handleByLeafKey|ptyId.*changed|previous.*pty' src/main/runtime/orca-runtime-sync-window-graph.ts src/main/runtime/orca-runtime*.ts -g '*.ts' -g '!*.test.ts' | head -n 1200Repository: stablyai/orca
Length of output: 42165
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- lifecycle generation definitions and writes ---'
rg -n -C 12 'ptyLifecycleGenerationById|getPtyLifecycleGeneration|increment.*Lifecycle|lifecycleGeneration' src/main/runtime -g '*.ts' -g '!*.test.ts' | head -n 1600
printf '%s\n' '--- provider read entry and serialization ---'
rg -n -C 18 'readTerminal\(|readProviderTerminalTailLines|serializeProviderTerminalBuffer|parseVisibleSnapshot|visibleScreenOnly' src/main/runtime/orca-runtime*.ts src/main/runtime/runtime*.ts -g '*.ts' -g '!*.test.ts' | head -n 1800Repository: stablyai/orca
Length of output: 42688
🏁 Script executed:
set -euo pipefail
rg -n -C 20 'advancePtyLifecycleGeneration\(|ptyLifecycleGenerationById\.set|nextPtyLifecycleGeneration|incarnationChanged|rememberPtyHandleReplacementFence|invalidateAllHandlesForPty\(ptyId\)' src/main/runtime -g '*.ts' -g '!*.test.ts' | head -n 1800Repository: stablyai/orca
Length of output: 43039
Fence the visible projection to the PTY incarnation used by the read.
readTerminal checks only the ptyId after the screen read. A replacement can preserve the same direct handle and ptyId while changing the PTY incarnation. The pending waiter then remains registered, and the callback can classify the predecessor screen with the replacement agent and status.
Capture the PTY ID and incarnation before readTerminal, then reject the projection when either value changes.
🐛 Suggested fix
+ const readPty = this.getLivePtyForHandle(waiter.handle)
+ const readPtyId =
+ readPty?.pty.ptyId ?? this.getLiveLeafForHandle(waiter.handle).leaf.ptyId
+ const readIncarnationId = readPty?.pty.incarnationId ?? null
void withTimeout(
...
- const ptyId =
- this.getLivePtyForHandle(waiter.handle)?.pty.ptyId ??
+ const livePty = this.getLivePtyForHandle(waiter.handle)
+ const ptyId =
+ livePty?.pty.ptyId ??
this.getLiveLeafForHandle(waiter.handle).leaf.ptyId
+ if (
+ ptyId !== readPtyId ||
+ (livePty?.pty.incarnationId ?? null) !== readIncarnationId
+ ) {
+ return
+ }
const liveAgent = this.getPaneAgentForTuiIdle(ptyId) ?? agentMerge upstream main c220d92, retain its removal of the obsolete structured-session adapter, and require resolved Kimi identity for sessionless readiness.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run covers the delta since the prior pullfrog review (1f32bb0): commit 911b77e fences the visible-screen probe to the live PTY incarnation and requires resolved Kimi identity for the sessionless matcher, on top of merging upstream main (c220d92c).
- Incarnation fence in the visible-screen probe — captures the PTY id and incarnation before the read and discards the snapshot if either changed by the time it returns, so a replacement that reuses both the handle and PTY id cannot settle on its predecessor's screen.
- Resolved Kimi identity required —
findKnownReadyPromptIndexruns the Kimi sessionless finder only when the pane agent is exactlykimi, dropping the previousagent == nullescape; an unidentified pane can no longer settle from the captured Kimi screen, while a foreground-confirmed Kimi without launch metadata still does. - Probe classification uses the live agent only — the
?? agentfallback is removed, so a pane that loses identity mid-read fails closed. - Merge of upstream
main—c220d92cfolded in; the obsolete structured-session adapter it removed stays removed, so that file drops out of the PR's changed set. - Regression coverage — predecessor-screen and unidentified-pane cases added to
kimi-visible-probe-status.test.ts; the transcript suite now asserts the unknown pane times out and the foreground-Kimi path settles.
I confirmed both new probe tests are load-bearing: disabling the incarnation fence makes the predecessor-screen case resolve satisfied: true where a timeout is required. The focused suites pass (88 tests across kimi-visible-probe-status, kimi-readiness-transcripts, terminal-wait-detection, tui-idle-evidence).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Thanks for this. Kimi worker-start readiness on Windows and macOS works on current main without this change (see the #25253 retest), so closing as superseded. |

ELI5
Kimi Code 2.0.2 can be ready for its first message while Orca still waits for it to become ready. Recognize its captured empty startup input when Orca has independently identified Kimi, so a sessionless startup can finish its readiness wait.
What Changed
Adds two sanitized raw PTY captures and 30 Kimi runtime cases. Merged upstream main
c220d92c, retaining its removal of the obsolete structured-session adapter.Why
Before Kimi's first message there is no session hook to rely on. This uses the existing terminal readiness, process identity and first-party status paths without sending a probe prompt, adding a timeout heuristic, or changing model settings. Readiness does not itself authenticate a dispatch destination. The new Kimi rule requires independent identity rather than promoting an unknown pane based on its output.
The matcher deliberately remains narrow: unrecognized sizes or future startup layouts time out rather than use a looser banner-and-silence fallback. Scope is initial sessionless readiness, not general post-turn idle detection or end-to-end prompt delivery.
Linked Issue
Related to #10336 and #10369. Those track early prompt injection in older Kimi versions; this addresses the distinct ready-but-unrecognized sessionless startup in Kimi Code 2.0.2. It does not claim to close the original injection issue.
Visual Proof
N/A — no rendered UI changes. Before this change, the captured sessionless empty composer times out; after it, an identified Kimi pane satisfies the readiness wait. Transcript replay also checks these boundaries:
Raw captures include metadata and same-width username redaction. CR/ANSI bytes and padding are intentionally preserved; they are test fixtures required by the terminal-screen contributor guidance, not screenshot attachments.
Testing
Captured Kimi Code 2.0.2 on macOS at 120x40 with the repository recorder, without submitting a model prompt. Validated the patched runtime through transcript replay; no patched Electron app, live SSH, Linux or Windows validation is claimed.
Passed on upstream main
c220d92cplus this patch:Changed-file oxlint and commit-hook checks also pass. Full lint/typecheck/test/build remain for CI; only node typecheck and the listed focused suites were run locally.
AI Disclosure
OpenAI Codex assisted with implementation, real terminal capture, regression tests, and this PR description.
Review
Cross-agent readiness, mid-read status changes, mid-read identity changes, and aged non-done status were reproduced by failing tests before their fixes. The final follow-up also reproduced acceptance of a predecessor screen after a same-handle PTY replacement and acceptance of an unidentified pane in both readiness paths. Those cases now fail closed, while confirmed foreground Kimi without launch metadata remains supported.
Please review the incarnation fence, the independently resolved identity requirement, and the Kimi-specific precedence of unfinished status. Method documentation explains the distinction between presence and readiness.
Agent skill upstream boundary
Notes
If Kimi's completion signal is lost, its non-done veto can now yield a timeout rather than false readiness. The shared freshness policy for other agents is unchanged. Sessionless is distinct from identity-unknown: startup works with launch or confirmed foreground identity, but an unidentified pane may time out until identified.
No new dependencies, wire formats, model settings or platform-specific execution are introduced by this patch. The simulated SSH case exercises the common runtime path, not a live remote deployment.
Checklist