track runtime content hash for kernel venv staleness - #291
Conversation
ENG-4371 Kernel venv keeps stale prime-agent-runtime; needs generic runtime version check
SummaryThe IPython kernel venv ( This is not an auth problem: the failure happens at the skill's very first import line ( Root causeIn
Observed in the wild: a kernel venv whose Impact
Proposed fixMake venv staleness detection track the runtime version generically, instead of relying on a static string + manual schema bumps:
This way the venv refreshes for users automatically on any runtime change, without per-feature readiness assertions or remembering to bump the schema. (Adding a specific WorkaroundDelete and rebuild the venv: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f2c6b78. Configure here.
2ff13c3 to
c2ab34e
Compare
There was a problem hiding this comment.
🟡 Medium
resolveRuntimeSourceDir() returns the first candidate directory containing a pyproject.toml, and runtimeCandidateDirs() lists dist/prime-agent-runtime ahead of the live source checkout. After packages/coding-agent is built once, the dist/prime-agent-runtime snapshot becomes stale relative to the real source tree, but resolveRuntimeIdentity() and bootstrapVenv() still hash and install from that stale copy. The kernel venv then uses outdated runtime code and never rebuilds when the actual local runtime source changes, defeating the staleness tracking this PR adds. Consider preferring the live source checkout when it exists, or documenting why the built copy should take precedence.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @packages/coding-agent/src/core/kernel/bootstrap.ts around line 530:
`resolveRuntimeSourceDir()` returns the first candidate directory containing a `pyproject.toml`, and `runtimeCandidateDirs()` lists `dist/prime-agent-runtime` ahead of the live source checkout. After `packages/coding-agent` is built once, the `dist/prime-agent-runtime` snapshot becomes stale relative to the real source tree, but `resolveRuntimeIdentity()` and `bootstrapVenv()` still hash and install from that stale copy. The kernel venv then uses outdated runtime code and never rebuilds when the actual local runtime source changes, defeating the staleness tracking this PR adds. Consider preferring the live source checkout when it exists, or documenting why the built copy should take precedence.
…ai#291) * track runtime content hash for kernel venv staleness * include runtime pyproject.toml in venv staleness hash * fail loudly when local runtime source is unreadable * document why dist runtime snapshot takes resolution precedence
…ctions Codex found four P2s on the correction PR. All verified, all valid. 1. The input of record still told the operator `execution.mode: off` unquoted -- the exact form this PR establishes the loader refuses. An implementing agent following it would reproduce the refusal. Now quoted, with the reason. 2. I over-corrected. Having found that a leftover allow_cboe_vix3m_fallback does NOT block startup, I demoted deleting it to "housekeeping". Wrong in the other direction: it still leaves `startup: GONE data (paper_data_composition_refused)` with entries IMPOSSIBLE, so a healthy /readiness is unreachable while it is present. Only the REASON was wrong; the step is still required. 3. The operator steps implied that starting the Gateway yields healthy session domains. It does not. Observable (c) failed artifact_missing on BOTH domains, and those artifacts come from the Hermes publisher, not from Gateway uptime. The steps now name three preconditions, not one. 4. Bare `PR PrimeIntellect-ai#291` in prime-agent markdown autolinks to prime-agent's own PrimeIntellect-ai#291, which exists and is unrelated -- pointing readers away from the evidence the claims rest on. Now explicit cross-repository links. Findings 2 and 3 are the useful ones: a correction that swings past the truth is still wrong, and a checklist that names one precondition out of three promises an outcome it cannot deliver. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5B7QM1QLQuWSBMCxiCzS6

Note
Medium Risk
Changes Python kernel bootstrap and can force full venv rebuilds on upgrade or after local runtime edits; incorrect hashing could cause unnecessary rebuilds or miss staleness.
Overview
Fixes kernel venvs keeping an outdated prime-agent-runtime because staleness only compared the fixed package name
"prime-agent-runtime"to itself, so local runtime changes never triggered a refresh (breaking MCP-related capabilities)..bootstrap-version(schema 8) now stores a runtime identity: asha256:hash over localpyproject.tomland allsrc/rlm/**/*.pywhen a checkout is found viaresolveRuntimeIdentity/hashRuntimeSource; registry-only installs still use the package name. Readiness checks compare that identity on eachensureKernelPythonrun and rebuild the venv when it diverges, without relying on manual schema bumps for every runtime edit.The runtime readiness probe also requires
rlm.McpIntegrationto import. Tests expect the new schema, dynamic runtime identity, and a rebuild when the recorded hash is stale.Reviewed by Cursor Bugbot for commit db85a7a. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Track runtime content hash to detect kernel venv staleness
resolveRuntimeIdentityin bootstrap.ts to compute a sha256 hash overrlm/*.pyfiles andpyproject.tomlwhen a local runtime source dir is present, falling back to'prime-agent-runtime'for registry installs.runtimeIdentitythroughkernelReady,kernelBaseReady,writeBootstrapVersion, andsyncPythonSkillsso the.bootstrap-versionfile records the content hash rather than a fixed package name.BOOTSTRAP_SCHEMAfrom 7 to 8 and addsfrom rlm import McpIntegrationto the runtime readiness check.Macroscope summarized db85a7a.