Repository navigation
Apply a changed skill catalog to running Codex sessions instead of replacing the runtime - #8093
Merged
ymichael merged 1 commit intoNov 24, 2026
Conversation
ymichael
force-pushed
the
bb/6301-changing-a-plugin-s-skills-replaces-every-i-thr_6ptp6zsyi8
branch
from
November 24, 2026 22:26
968633f to
9715a71
Compare
…placing the runtime A skill catalog change made the host daemon shut down an environment's whole runtime at the next turn whenever bb tracked no work there. That killed every Codex app-server in the environment and the background terminals its agent had started, which bb does not track. The runtime now offers the new skill roots to its running bridges first. A bridge whose handshake declares skills.reconfigure applies a repeated skills/configure to its open sessions; the runtime then re-keys that bridge process to the new catalog. When every running bridge applies it, the daemon keeps the runtime and swaps the entry's catalog in place. Bridges that cannot reconfigure keep the previous behavior. The Codex bridge already forwarded a repeated skills/configure to every open app-server, so it now declares the capability. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/6301-changing-a-plugin-s-skills-replaces-every-i-thr_6ptp6zsyi8
branch
from
November 24, 2026 22:36
9715a71 to
c76cd1c
Compare
ymichael
deleted the
bb/6301-changing-a-plugin-s-skills-replaces-every-i-thr_6ptp6zsyi8
branch
November 24, 2026 23:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
When the injected skill catalog changed (a plugin that contributes skills was installed, updated or edited),
RuntimeManager.ensureCompatibleEntryin the host daemon compared the environment'sskillCatalogHashat the next command and, if bb tracked no work in that environment (no live turn, open background task, terminal or in-flight command), calledreplaceEntryForSkillCatalog, which shut down the environment's whole runtime. For Codex that stops every bridge and app-server in the environment, and with them the background terminals the agent started (#6301). bb does not track those terminals as work, so a thread sitting between turns with a running command was always replaced. The replacement wasn't needed for Codex: its bridge already forwards a repeatedskills/configureto every open app-server (skills/extraRoots/set). But the runtime only ever sentskills/configureonce per bridge process, and process keys include the catalog hash, so the daemon had no way to apply a change in place.What changed
skills.reconfigure(packages/provider-bridge-protocol/src/handshake.ts). It declares that a repeatedskills/configureapplies the new roots to open sessions from their next turn. It is optional so that existing third-party bridges that typeInitializeResultwithskills: { configure: true }still compile. Absent means "applies only to sessions started later".AgentRuntime.reconfigureSkillRoots({ skillRoots }). It sendsskills/configureto every running bridge that declaredreconfigure(newskills/reconfigureadapter command, gated on the handshake). It then re-keys those processes and their threads' runtime configs to the new catalog key, so new sessions reuse the same bridge, and updates the runtime's default roots. It returnsappliedToEveryProvider. The process-key derivation moved toproviderProcessKeyinbridge-launch-process-key.tsso the process manager can compute the new key.ensureCompatibleEntrycallsreconfigureSkillRootsfirst when the catalog differs. When every running bridge applied it, the entry keeps its runtime and swapsskillCatalogHash/skillRootsin place. It retains the previous catalog's staged directory (a turn in flight may still read it) and prunes older ones. Otherwise the previous behavior is unchanged: replace when idle, keep the old catalog when busy.skills: { configure: true, reconfigure: true }. Claude Code, Pi and ACP bridges apply roots only at session construction, so they don't declare it and keep the old behavior.docs/provider-bridge-protocol.md(Injected skills) and the handshake block indocs/provider-plugin-api.md.HOST_DAEMON_PROTOCOL_VERSIONbump.This follows option 1 of the issue (apply new skill roots to the running app-server). It does not use
thread/backgroundTerminals/list, so nothing here depends on Codex ≥ 0.140;skills/extraRoots/setis already sent at app-server startup for every supported Codex version.Other configuration-driven restarts with the same flaw (not changed here)
These still restart sessions while ignoring untracked running work, mainly Codex background terminals and in-flight plugin tool calls, which
entryHasActiveRuntimeWorkdoesn't count:RuntimeManager.replaceBaseShellEnv→evictIdleRuntimeEntries, and theshellEnvGenerationbranch ofensureCompatibleEntry, shut down whole runtimes that have no tracked work.AgentRuntime.reapIdleProviderSessions(driven fromapps/host-daemon/src/app.ts) stops an idle Codex session. It checks only bb-tracked background tasks.plugins/provider-codex/src/bridge/bridge.ts, turn preparation): construction-signature changes ("Execution settings changed"),CODEX_HOMEchanges, removed writable folders (fork), andrebuildBeforeNextTurnReasonafter auth/rate-limit errors. Each replaces the thread's app-server.A class-wide fix needs bridges to report running work, for example the Codex bridge answering from
thread/backgroundTerminals/liston Codex ≥ 0.140 and reporting "unknown" (treated as busy) on older versions. These paths would then wait for that work to finish.How you verified
Live repro with real Codex (codex-cli 0.171.0,
gpt-6.2-astra) on apnpm start:worktreedev instance, using a skill-only path plugin:sleep 6302as a Codex background terminal (pid 35192, child of app-server 33007). I ranbb plugin installon the skill plugin, then sent the next turn. The app-server was replaced (new pid 48109) and the sleep was gone. Agent: "No.psshowed nosleep 6302process. I have theqa-alphaskill…"sleep 7303ran under app-server 80754. I added aqa-betaskill to the plugin and ranbb plugin reload; the catalog changed from6fd272e7…todbbd3907…. On the next turn the app-server was still 80754, the sleep was still pid 88226, and the agent read…/global-skills/dbbd3907…/skills/qa-beta/SKILL.mddirectly (the path came from Codex's skill catalog). Agent: "psconfirmed thatsleep 7303is still running with PID88226. Theqa-betaskill is available, and its codeword is HERON." I repeated the run on the final commit withsleep 7304and a newqa-gammaskill: same app-server, the sleep survived, the skill was visible, and the staged catalogs were pruned to the previous and current ones.Tests:
apps/host-daemon/src/runtime-manager.test.ts: new test that a changed catalog on an idle runtime whose providers apply it live keeps the same entry and runtime (no shutdown), swaps the catalog, and prunes older staged catalogs. It fails without theapplySkillCatalogInPlacecall (checked by removing it). The existing replacement/retention tests cover the fallback (fakes reportappliedToEveryProvider: false).packages/agent-runtime/src/runtime.skill-roots-capability.test.ts: against the scripted echo bridge (newreconfiguresSkillsoption), a bridge that declaresreconfigurereceives the secondskills/configure, and a new session reuses the same bridge process. A bridge that doesn't declare it gets no second request, reportsappliedToEveryProvider: false, and its session keeps working.plugins/provider-codex/src/bridge/bridge.skills.test.ts: the Codex bridge advertisesreconfigureand forwards a repeatedskills/configureto the open session's app-server asskills/extraRoots/set, without relaunching it.pnpm exec turbo run test typecheck lint --filter=@bb/agent-runtime --filter=@bb/host-daemon --filter=@bb/provider-bridge-protocol --filter=bb-plugin-provider-codex --filter=@get-bb/plugin-sdk: 21/21 tasks passed.Fixes #6301
🤖 Generated with Claude Code