Skip to content

fix(bin): improve Kimi spawn readiness diagnostics and Python selection - #51

Merged
Pibomeister merged 4 commits into
mainfrom
fm/fm-kimi-spawn-readiness-fix
Nov 1, 2026
Merged

Pibomeister merged 4 commits into
mainfrom
fm/fm-kimi-spawn-readiness-fix

Conversation

@Pibomeister

@Pibomeister Pibomeister commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Intent

Address the failures faced overnight launching Kimi workers: a Kimi spawn on the tmux backend into a real project worktree refused with "trust dialog text stayed on screen without the complete dialog" even though the final pane shows the complete Kimi 2.4.0 trust dialog, and a Herdr attempt refused earlier because the Kimi turn-end hook installer needs Python tomllib, which the default python3 on this Mac (3.9.6) does not have. Kimi seating must work again end to end, or refuse before launch with a precise, actionable reason.

What Changed

  • Select a Python interpreter with tomllib from PATH, Homebrew, or uv for Kimi hook installation and removal; report searched candidates and installation guidance when none qualifies.
  • Report missing trust-dialog elements and save Kimi readiness refusal details, poll counts, version, and the last visible capture before cleanup.
  • Add regression coverage for interpreter selection, refusal evidence, and the Kimi 2.4.0 dialog below a shell preamble; document tmux spawn verification.

Risk Assessment

✅ Low: The changes are bounded to interpreter discovery and readiness diagnostics, preserve existing consent checks, and introduce no substantiated material defects.

Testing

The targeted harness suite and five live checks passed, including a reproduced Python regression and real terminal refusal evidence. Full completion remains untested under credential and Herdr isolation limits. Terminal captures document these CLI changes; no GUI layout changed. Disposable labs were removed.

  • Live validation: ⚠️ inconclusive - 5 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Install the hook with system Python 3.9 first; discover real uv Python and preserve config through repeated installation and removal ✅ pass live python-live.log; e416-python-regression.log
Install without a compatible Python; refuse before config writes and list searched interpreters and remedies ✅ pass live python-live.log
Spawn into a fresh tmux worktree at 80×24; accept the complete Kimi 2.4.0 dialog below the wrapped shell preamble ✅ pass live normal-trust.txt; normal-viewport-transcript.json; live-tui-results.json
Launch in an 80×7 pane; leave the collapsed trust dialog unanswered and retain exact missing elements and the last viewport ✅ pass live short-grid.txt; short-readiness-refusal.txt; live-tui-results-short.json
Spawn a project declaring an MCP server; refuse trust without starting the server and save diagnostic evidence ✅ pass live mcp-readiness-refusal.txt; mcp-viewport-transcript.json; live-tui-results.json
Run a tmux Kimi worker that reads its brief and reports completion ⏸️ untested no Real spawns passed trust handling but Kimi reported “LLM not set” in the disposable home. Operator credentials were not accessed or changed. Supply an authenticated disposable Kimi home inside the wor…
Run a Herdr Kimi worker that reads its brief and reports completion ⏸️ untested no Tried the supported lab helper with an isolated HOME, local HERDR_CONFIG_PATH, and local lab state. Prepare refused because the required running-default-session tripwire was absent. Normal-HOME prepar…
Evidence: Validation details and limitations

Source: Validation details and limitations

# Kimi launch validation at e41600049d22a4b4be7399d8643877d349eb5ba1

The targeted harness suite passed. Five live checks passed: real Python fallback, no-compatible-Python refusal, complete 80x24 trust handling, incomplete 80x7 trust refusal, and project MCP refusal. Full worker completion remains unverified. No source or test files changed.

## Live product evidence

- `python-live.log`: `/usr/bin/python3` reports 3.9.6. The real installer found an installed uv CPython, installed twice, and removed the hook while restoring original config bytes. With an absent uv root it refused without a config write and listed searched interpreters and remedies. No interpreter was installed for this run.
- `e416-python-regression.log`: the base installer exited 1 in the same real Python environment; the target installer and removal exited 0.
- `normal-trust.txt`, `normal-viewport-transcript.json`: real Kimi 2.4.0 trust dialog under the real wrapped shell preamble. The real tmux spawn answered it; Kimi persisted the worktree trust record and reached its composer. `normal-model-unavailable.txt` then shows `LLM not set`. Spawn returned 1 for unconfirmed delivery, not for trust recognition.
- `short-grid.txt`, `short-readiness-refusal.txt`: the owned worker pane was resized to 80x7 before Kimi launch. It displayed `Enlarge terminal to review sources`. Spawn refused with zero trust submissions, no trust record, exact missing dialog elements, version, poll count, and the last viewport saved before cleanup. Initial resize attempts left new worker windows at 80x24; those were setup attempts, corrected by resizing the exact owned worker pane. Only the final 80x7 result supports this scenario.
- `mcp-readiness-refusal.txt`, `mcp-viewport-transcript.json`: the real dialog disclosed a project MCP server. Spawn refused with zero trust submissions; the marker command never ran and the MCP worktree was never trusted.

## Checks run

- `PATH="~/.local/share/uv/python/cpython-3.12.12-macos-aarch64-none/bin:$PATH" TMPDIR="$PWD/.test-kimi-lab" bash tests/fm-kimi-harness.test.sh` exited 0. This is one targeted adapter suite, not the full repository suite. Its backend and interpreter simulations are supporting behavioral tests, not live evidence.
- `bash live-kimi.sh`: real installer roundtrip and tmux scout spawn from marked disposable home and fresh Git project.
- `python3 live-tui.py`: captured real tmux worker viewports for complete trust, short-pane setup attempts, and project MCP refusal.
- `LIVE_KIMI_ONLY=short LIVE_KIMI_RUN=short-v3 python3 live-tui.py`: final real 80x7 short-pane check, with an empty trust registry.
- Ran the base and target public installer scripts against the same isolated config and actual Python interpreters.
- Asserted the generated trust registry results, MCP non-execution, recorded grid, refusal records, and missing-model output.

## Untested scope

A tmux worker could not complete its brief because its disposable Kimi home has no model/login. No operator Kimi configuration or credentials were read, copied, or changed. This is the credential limitation already accepted in the prior test round. Supply an authenticated disposable Kimi home inside the worktree to prove model-backed completion.

For Herdr, `HERDR_CONFIG_PATH` and the lab-helper state directory were placed inside the worktree. With an isolated HOME, `fm-herdr-lab.sh prepare fm-lab-kimi-private-01` refused because its required running-default-session tripwire was absent (`herdr-isolated-prepare.log`). With the normal HOME, prepare can read the existing default tripwire, but provisioning would write named-session user data outside the allowed worktree. The advertised config override does not move the HOME-based session namespace. No Herdr server or session was created. To drive it here, provide authority for the helper's disposable named-session files in the normal Herdr namespace, or a supported isolated namespace that retains the required read-only default tripwire. An authenticated disposable Kimi home is also required for brief completion. No previous-round Herdr artifact is claimed as live evidence for this run.

## Evidence and cleanup

The code changes CLI readiness and refusal diagnostics; terminal viewport captures and refusal records show the actual user surface. No GUI or visual layout was changed, so no GUI screenshot was produced. Private tmux servers were stopped and their lab socket directories retired by the repository helper. Disposable workspace data was removed after evidence collection. Existing evidence from earlier rounds was not used as current live proof.
Evidence: Real Python fallback and actionable refusal

Source: Real Python fallback and actionable refusal

Python 3.9.6
Real Python fallback: install, repeat install, remove; original config bytes restored.
fm-kimi-turnend-hook: refused: no Python 3.11 or newer with tomllib was found to validate config.toml; searched interpreters:
  /usr/bin/python3 (python3 on PATH): Python 3.9.6, no tomllib
  not on PATH: python3.14 python3.13 python3.12 python3.11
  not in /opt/homebrew/bin: python3 python3.14 python3.13 python3.12 python3.11
  not in /usr/local/bin: python3 python3.14 python3.13 python3.12 python3.11
  ~/.no-mistakes/worktrees/075d7f40c28a/01M649GT90YA0AQX8YHNA4K4BZ/.test-kimi-lab/live/absent-uv/cpython-3.*/bin/python3 (uv-managed): none installed
fm-kimi-turnend-hook: install Python 3.11 or newer (for example "uv python install 3.12" or "brew install python"), then retry.
No compatible interpreter: refused without changing config.
Evidence: Base fails; target succeeds

Source: Base fails; target succeeds

fm-kimi-turnend-hook: refused: python3 with tomllib is required to validate config.toml.
base_install_exit=1
target_install_exit=0
target_remove_exit=0; original config bytes restored
Evidence: Real Kimi trust dialog below shell preamble

Source: Real Kimi trust dialog below shell preamble

takes/worktrees/075d7f40c28a/01M649GT90YA0AQX8YHNA4K4BZ/.test-kimi-lab/tui/pool/
.treehouse/normal-185965/1/normal'
Eduardos-MacBook-Pro-2:normal eduardopicazo$ export GOTMPDIR=/tmp/fm-kimi-tui-no
rmal/gotmp
Eduardos-MacBook-Pro-2:normal eduardopicazo$ export COMPACT_ADVISER_DISABLE=1
Eduardos-MacBook-Pro-2:normal eduardopicazo$ export FM_TASK_ID=kimi-tui-normal
Eduardos-MacBook-Pro-2:normal eduardopicazo$ . '/tmp/fm-kimi-tui-normal+dcfac5f7
abb34f9b708852e459f5530cf67dfe52d51a69bb43b78158cd9de06b/launch.s1793522192.3916
8.6551.sh'
 ──────────────────────────────────────────────────────────────────────────────
  Trust this folder?
  ↑↓ navigate · Enter select · Esc exit

  ~/.no-mistakes/worktrees/075d7f40c28a/01M649GT90YA0AQX8YHN
  A4K4BZ/.test-kimi-lab/tui/pool/.treehouse/normal-185965/1/normal

  No project integrations or instructions to activate.

  Trust is remembered for this folder, including future project config changes.
  Tool approvals follow your permission settings.

   ❯ Trust and continue
     Exit
 ──────────────────────────────────────────────────────────────────────────────
Evidence: Collapsed-dialog refusal with saved viewport

Source: Collapsed-dialog refusal with saved viewport

kimi readiness refusal at=1793522324
kimi=~/.kimi-code/bin/kimi version=2.4.0
backend=tmux target=firstmate:fm-kimi-tui-short
polls=16 of 16, trust_enters=0
detail=kimi did not show a verified ready signal before brief delivery; trust dialog text stayed on screen without the complete dialog (missing: navigation hint '↑↓ navigate'; navigation hint 'Enter select'; selected affirmative option ('❯ Trust and continue' or '❯ Trust this folder')), so the pane was never safe to answer or to treat as ready
missing:
- navigation hint '↑↓ navigate'
- navigation hint 'Enter select'
- selected affirmative option ('❯ Trust and continue' or '❯ Trust this folder')
last visible capture (poll 16):
Eduardos-MacBook-Pro-2:short eduardopicazo$ export COMPACT_ADVISER_DISABLE=1
Eduardos-MacBook-Pro-2:short eduardopicazo$ export FM_TASK_ID=kimi-tui-short
Eduardos-MacBook-Pro-2:short eduardopicazo$ . '/tmp/fm-kimi-tui-short+ca0f0e9be1
06701daa113175edd474da1addf6a38e9fca91bb3b716af84ee9a6/launch.s1793522310.32964.
27747.sh'
  Trust this folder?
  Enlarge terminal to review sources. Esc exit.
Evidence: Project MCP refusal with zero trust submissions

Source: Project MCP refusal with zero trust submissions

kimi readiness refusal at=1793522235
kimi=~/.kimi-code/bin/kimi version=2.4.0
backend=tmux target=firstmate:fm-kimi-tui-mcp
polls=2 of 16, trust_enters=0
detail=kimi's folder prompt announces project MCP servers, so Firstmate did not answer it and did not send the brief; answering would start those servers without a consent decision that covers them. Remove the project MCP servers this directory declares (the prompt's Config line names the file), or wait for a later consent design.
missing:
- folder prompt without project MCP servers
last visible capture (poll 2):
eehouse/mcp-69711e/1/mcp'
Eduardos-MacBook-Pro-2:mcp eduardopicazo$ export GOTMPDIR=/tmp/fm-kimi-tui-mcp/g
otmp
Eduardos-MacBook-Pro-2:mcp eduardopicazo$ export COMPACT_ADVISER_DISABLE=1
Eduardos-MacBook-Pro-2:mcp eduardopicazo$ export FM_TASK_ID=kimi-tui-mcp
Eduardos-MacBook-Pro-2:mcp eduardopicazo$ . '/tmp/fm-kimi-tui-mcp+dcfac5f7abb34f
9b708852e459f5530cf67dfe52d51a69bb43b78158cd9de06b/launch.s1793522231.57443.1529
0.sh'
 ──────────────────────────────────────────────────────────────────────────────
  Trust this folder?
  ↑↓ navigate · Enter select · Esc exit

  ~/.no-mistakes/worktrees/075d7f40c28a/01M649GT90YA0AQX8YHN
  A4K4BZ/.test-kimi-lab/tui/pool/.treehouse/mcp-69711e/1/mcp

  Start 1 MCP server automatically
    Config: .mcp.json

  Trust is remembered for this folder, including future project config changes.
  Tool approvals follow your permission settings.

   ❯ Trust and continue
     Exit
 ──────────────────────────────────────────────────────────────────────────────
Evidence: Disposable Kimi home reports missing model

Source: Disposable Kimi home reports missing model

 │  Directory: ~/.no-mistakes/worktrees/075d7f40c28a/01M64…│
 │  Session:                                                                  │
 │  Model:     not set, run /login or /provider                               │
 │  Version:   2.4.0                                                          │
 │                                                                            │
 ╰────────────────────────────────────────────────────────────────────────────╯

 ✦ Kimi K3.1 Pro is ready - use the model in a fresh session for the best
                          results
   Standard: Plus/Moderato and above; Highspeed: Pro/Allegretto and above

   No session yet — one will be created on your first message.
   tmux extended-keys is off. Modified Enter keys may not work. Add `set -g
 extended-keys on` to ~/.tmux.conf and restart tmux.
   Error: LLM not set, send "/login" to login

 ╭────────────────────────────────────────────────────────────────────────────╮
 │ >                                                                          │
 ╰────────────────────────────────────────────────────────────────────────────╯
 Never Ask  …/normal-185965/1/normal                  /init: generate AGENTS.md
                                                                    context: 0%
- Outcome: ⚠️ 1 warning across 2 runs (33m18s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 0 issues

✅ No issues found.

  • ⚠️ bin/fm-kimi-turnend-hook.sh:83 - Simplification: the uncertified previous-run code adds a newest-version policy for uv Python, including version parsing, ranking arrays, and selection sorting. The intent requires an interpreter with tomllib; it does not require the newest interpreter. Remove this ranking and try compatible candidates in deterministic discovery order. Related sites: bin/fm-kimi-turnend-hook.sh:22 documents the policy; tests/fm-kimi-harness.test.sh:716–720 locks it into assertions.
  • ⚠️ bin/fm-kimi-turnend-hook.sh:134 - Simplification: FM_KIMI_PYTHON_PREFIXES adds an operator-facing configuration option beyond the requested launch repair. Its only repository caller is the test helper. Remove the production override; retain a test-only seam if needed to isolate Homebrew discovery. Related sites: bin/fm-kimi-turnend-hook.sh:20 documents the option; tests/fm-kimi-harness.test.sh:700 supplies it.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Test** - 1 warning
  • ⚠️ Full Kimi seating remains unproven. Real tmux and Herdr launches reached Kimi, but both isolated homes reported “LLM not set.” The gate forbids accessing operator configuration or changing credentials. Supply an authenticated disposable Kimi home inside the worktree to complete model-backed validation.
  • ⚠️ live validation verdict: inconclusive (4 of 6 scenarios were driven live against the product); untested: Run a tmux Kimi worker that reads its brief and reports completion, Run a Herdr Kimi worker that reads its brief and reports completion
  • Live validation: ⚠️ inconclusive - 4 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Install the hook with default Python 3.9 and a real uv Python fallback; reinstall preserves settings and removal restores original bytes ✅ pass live Python regression before and after; kimi-real-python-installer.txt
Spawn without a qualifying Python; receive searched paths and installation advice before configuration, pane, or task-record changes ✅ pass live Prelaunch Python refusal
Launch Kimi 2.4.0 in fresh tmux and Herdr project worktrees; the complete trust dialog clears and the composer appears ✅ pass live Actual Kimi terminal captures; kimi-live-tmux-trust.json; kimi-live-herdr-trust.json
Launch with an 80×10 viewport; an incomplete trust dialog receives no Enter, preserves diagnostics, and cleans up its pane and provisional record ✅ pass live Clipped-dialog refusal record; kimi-clipped-windows-after.txt
Run a tmux Kimi worker that reads its brief and reports completion ⏸️ untested no Attempted a real spawn using an isolated home, real Git project, Treehouse worktree, private tmux server, and real Kimi CLI. Kimi reported no configured model/login and delivery stayed unconfirmed. Ac…
Run a Herdr Kimi worker that reads its brief and reports completion ⏸️ untested no Attempted a real spawn through the guarded named Herdr lab with an isolated home and real Kimi CLI. Python fallback and trust handling progressed, but Kimi reported no configured model/login. The gate…
  • bash tests/fm-kimi-harness.test.sh: baseline stopped at the system Python 3.9 tomllib prerequisite.

  • Prepared workspace-local Python 3.12.12; reran the scoped suite, then stopped it to run only change-specific selectors.

  • Ran five existing selectors for interpreter selection/refusal, Kimi 2.4.0 trust, unknown-option diagnostics, and viewport-read failure; all exited successfully.

  • bash .kimi-validation/python-regression.sh: base installer failed and target installer succeeded in the same environment.

  • bash .kimi-validation/check-installer.sh: real fallback installation, idempotency, removal, and malformed-config preservation.

  • bash .kimi-validation/live-tmux.sh, live-clipped.sh, and live-herdr.sh: isolated real-product launch and refusal checks.

  • Captured terminal viewports and rendered an HTML evidence viewer; Chrome screenshot attempt failed with BRIDGE_NOT_READY after 30 seconds.

  • Tore down both Herdr labs, the private tmux server, browser session, and workspace fixtures; confirmed unchanged target revision and clean worktree.

  • ⚠️ live validation verdict: inconclusive (5 of 7 scenarios were driven live against the product); untested: Run a tmux Kimi worker that reads its brief and reports completion, Run a Herdr Kimi worker that reads its brief and reports completion

  • Live validation: ⚠️ inconclusive - 5 of 7 scenarios driven live against the product

Scenario Result Live Evidence
Install the hook with system Python 3.9 first; discover real uv Python and preserve config through repeated installation and removal ✅ pass live python-live.log; e416-python-regression.log
Install without a compatible Python; refuse before config writes and list searched interpreters and remedies ✅ pass live python-live.log
Spawn into a fresh tmux worktree at 80×24; accept the complete Kimi 2.4.0 dialog below the wrapped shell preamble ✅ pass live normal-trust.txt; normal-viewport-transcript.json; live-tui-results.json
Launch in an 80×7 pane; leave the collapsed trust dialog unanswered and retain exact missing elements and the last viewport ✅ pass live short-grid.txt; short-readiness-refusal.txt; live-tui-results-short.json
Spawn a project declaring an MCP server; refuse trust without starting the server and save diagnostic evidence ✅ pass live mcp-readiness-refusal.txt; mcp-viewport-transcript.json; live-tui-results.json
Run a tmux Kimi worker that reads its brief and reports completion ⏸️ untested no Real spawns passed trust handling but Kimi reported “LLM not set” in the disposable home. Operator credentials were not accessed or changed. Supply an authenticated disposable Kimi home inside the wor…
Run a Herdr Kimi worker that reads its brief and reports completion ⏸️ untested no Tried the supported lab helper with an isolated HOME, local HERDR_CONFIG_PATH, and local lab state. Prepare refused because the required running-default-session tripwire was absent. Normal-HOME prepar…
  • PATH="~/.local/share/uv/python/cpython-3.12.12-macos-aarch64-none/bin:$PATH" TMPDIR="$PWD/.test-kimi-lab" bash tests/fm-kimi-harness.test.sh — exited 0.
  • /bin/bash ~/.no-mistakes/evidence/01M649GT90YA0AQX8YHNA4K4BZ/live-kimi.sh — real installer roundtrip, missing-interpreter refusal, and isolated tmux spawn.
  • /usr/bin/python3 ~/.no-mistakes/evidence/01M649GT90YA0AQX8YHNA4K4BZ/live-tui.py — captured real trust and MCP viewport transitions.
  • LIVE_KIMI_ONLY=short LIVE_KIMI_RUN=short-v3 /usr/bin/python3 ~/.no-mistakes/evidence/01M649GT90YA0AQX8YHNA4K4BZ/live-tui.py — verified the actual 80×7 pane and saved refusal.
  • Executed base and target hook installers against the same isolated config with actual Python interpreters; base refused, target installed and removed successfully.
  • bin/fm-herdr-lab.sh prepare fm-lab-kimi-private-01 with isolated HOME and local configuration — refused at the required default-session tripwire.
  • Asserted generated trust records, MCP non-execution, pane dimensions, saved refusals, and missing-model output; stopped private tmux servers, removed disposable labs, and confirmed a clean worktree.
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

Kimi 2.4.0 renders the same trust dialog the 2.3.1 recognition already
accepts, including below a wrapped treehouse shell preamble, so a current
code root seats it on tmux end to end. A readiness refusal now writes
data/<id>/kimi-readiness-refusal.txt with the Kimi version, poll counts,
each missing dialog element, and the last visible capture, because the
failed spawn closes its pane, and the incomplete-dialog detail names the
missing elements.

The turn-end hook installer no longer assumes python3 has tomllib. It
searches PATH, Homebrew prefixes, and uv-managed CPython in a fixed order,
runs on the first interpreter that imports tomllib, and otherwise refuses
before any config write, naming every searched interpreter.

Tests pin the 2.4.0 capture below its preamble, the refusal record, and
the interpreter search order and refusal. Dated live evidence of a real
Kimi 2.4.0 spawn through tmux is in docs/verification/runtime-backends.md.
@Pibomeister
Pibomeister force-pushed the fm/fm-kimi-spawn-readiness-fix branch from 70cacbe to 5b9ff70 Compare November 1, 2026 13:28
@Pibomeister Pibomeister changed the title fix(bin): restore Kimi hook setup and clarify readiness failures fix(bin): improve Kimi spawn readiness diagnostics and Python selection Nov 1, 2026
@Pibomeister
Pibomeister merged commit a74e470 into main Nov 1, 2026
28 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.

1 participant