Repository navigation
chore: re-pin agent-bundle preview cd0b4a62c — MCP server stands by instead of exiting on a socket collision - #85
Merged
Conversation
… by instead of exiting on a socket collision The pkg.pr.new preview of agent-bundle main cd0b4a62cd92b3fbced6742b3cead32d9639c3e4 (#561, closes agent-bundle #559): a generated MCP server that finds the pack's event-runtime Unix socket owned by another process from the same install no longer exits before answering `initialize`; it starts in the standby role, serves its own MCP session, probes the socket ~1 s (jittered), and takes it over when the owner exits. Both transitions and any takeover failure other than "still owned" go to stderr only. This is why the `hauler_*` tools were missing from a second concurrent Claude Code / Codex / Cursor session on 0.4.8. Development only: the `@agent-bundle/runtime` preview now depends on the same-commit preview tarball of `rsc-markdown-stream` (not on npm), which pnpm 11's default `blockExoticSubdeps` rejects as a URL-resolved transitive dependency, so pnpm-workspace.yaml sets `blockExoticSubdeps: false`. The published package still declares no runtime dependencies. Verified: `pnpm check` (validate, build, typecheck, diagnostics, 811 + 45 tests) and `agent-bundle prepack` pass; two servers started from one built pack — the second answers `initialize`, logs "is owned by another process; standing by", and after the first is killed logs "was released by its owner; took it over" and keeps answering `tools/list` and `hauler_status`.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🦋 Changeset detectedLatest commit: 2de28b7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merged
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.
Why
Every host session launches its own
haulerMCP server from the same installed pack, and only one of them can own the pack's event-runtime Unix socket. On 0.4.8 the second server exited before answeringinitialize(EventRuntimeTransportError: Event runtime endpoint already has a live server.), which is why thehauler_*tools were invisible in a second concurrent Claude Code / Codex / Cursor session.agent-bundle fixed this in #561 (closes #559), squash
cd0b4a62c: the generated server starts in the standby role when the socket is owned, serves its own MCP session, probes ~1 s (jittered), and takes the socket over when the owner exits. Both transitions, and any takeover failure other than "still owned", go to stderr only.What changed
package.json:agent-bundleand@agent-bundle/runtimere-pinned from thec2ffe5ec5pkg.pr.new preview tocd0b4a62cd92b3fbced6742b3cead32d9639c3e4(the way this repo already consumes the framework — pkg.pr.new tarballs pinned by full SHA indevDependencies);pnpm-lock.yamlregenerated.pnpm-workspace.yaml:blockExoticSubdeps: false, with a comment. The only change the new framework needed: thecd0b4a62c@agent-bundle/runtimepreview depends on the same-commit preview tarball ofrsc-markdown-stream(behindMarkdownContent; not on npm), and pnpm 11 rejects URL-resolved transitive dependencies by default (ERR_PNPM_EXOTIC_SUBDEP). Neither a direct devDependency on the same URL nor anoverridesentry satisfies the check (both probed), so the setting is the fix the diagnostic names. Development-only: the published package still declares nodependencies.README.md: the pinned-commit note..changeset/repin-cd0b4a62c-standby.md(patch).No source, generated-file, or diagnostic changes were needed:
agent-bundle validate/buildpass clean on the new framework (no AB7014/AB7015), Claude host validation passes (Claude Code 2.1.260).Verification
pnpm check: validate, build, typecheck, Effect diagnostics (0 errors, 0 warnings),rstest811/811, route-unit 45/45.pnpm prepack:Prepack validated 77 file(s) for cargo-hauler;npm pack→ 77 files,dependenciesabsent.Standby proof in the built artifact — two
node artifact/claude/mcp/mcp-hauler-2b8242f9.mjsprocesses from the same install root, same env and cwd, each fed a JSON-RPCinitializeon stdin (harness and full transcripts under/tmp/hauler-standby/).Before, 0.4.8 as installed from npm (
before-0.4.8/transcript.log):After, this branch's build (
after-cd0b4a62c/transcript.log):The second server answers
initialize,tools/list, and a realhauler_statuscall while standing by, takes the socket over ~0.9 s after the owner exits, and keeps answering afterwards. The socket file is removed on exit; no stray processes.CLI smoke from the build:
node dist/bin/hauler.js status --json→ daemon running, state dir/fast/cache/cargo-hauler.Self-review
Reviewed the diff against
origin/masterby hand (no second-model reviewer was run for this dependency re-pin):cd0b4a62cpreviews (rsc-markdown-streampreview,npm-package-arg,hosted-git-info,lru-cache,proc-log,validate-npm-package-name); nothing else changes.blockExoticSubdeps: falsewidens what transitive dependencies may come from URLs. Accepted: the repo already trusts the same pkg.pr.new namespace for its direct pins, the setting is dev-only, and the comment ties it to the preview pin so it goes when agent-bundle is on npm.0.4.8because the version bump lands through the Version Packages PR (Version Packages #84), as for every release here.