Skip to content

Refactor runtime registry ownership#152

Merged
roackb2 merged 1 commit into
mainfrom
codex/global-runtime-registry
Jun 2, 2026
Merged

Refactor runtime registry ownership#152
roackb2 merged 1 commit into
mainfrom
codex/global-runtime-registry

Conversation

@roackb2
Copy link
Copy Markdown
Owner

@roackb2 roackb2 commented Jun 2, 2026

Summary

  • Move the daemon registry from workspace-owner records to a top-level live control-plane server plus known workspace records
  • Change runtime host discovery to resolve the live local server directly, independent of workspace ownership
  • Make workspace catalog ids globally unique: new default workspaces use a stable state-root-derived workspace-* id, and legacy default catalog ids are migrated on read
  • Teach request-scoped workspace resolution to find registered workspaces by workspaceId, so one live server can handle clients from different workspaces
  • Keep v1 heddle ask changes minimal: daemon-backed ask now sends the cwd-derived workspace id explicitly, with inline comments marking the v1-only compatibility path
  • Fix packaged CLI linking by marking the built bin entrypoint executable during yarn build

How to test

  • Run focused registry, workspace, and ask coverage:
    ./node_modules/.bin/vitest run src/__tests__/integration/control-plane/workspace-catalog.test.ts src/__tests__/integration/control-plane/session-lifecycle.test.ts src/__tests__/integration/server/daemon-registry.test.ts src/__tests__/integration/server/runtime-hosts.test.ts src/__tests__/integration/tui/ask-cli.test.ts
  • Run build/typecheck:
    yarn build
  • Run web-v2 browser integration in an environment that can launch Chromium:
    yarn test:browser-integration:v2
  • Verify local link packaging after build:
    npm link, then run the linked bin or /Users/roackb2/.asdf/installs/nodejs/22.21.1/bin/heddle --version

Manual verification focus

  • Start daemon and inspect ~/.heddle/daemon-registry.json: it should contain a top-level server; the current Heddle workspace should be registered with a generated workspace-* id rather than default
  • Confirm old registry records can still be read, but new/current workspace records do not rely on the local default id
  • Confirm daemon-backed heddle ask sends the cwd-derived workspace id with session list/create/prompt calls
  • Confirm chat-v2 still passes its active workspace id separately from the resolved live server endpoint
  • Confirm bare heddle still starts the current default chat path until the final cli-v2 default switch PR

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 158a14f83f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli/main.ts
workspaceRoot,
stateRoot,
}),
runtimeHost: RuntimeHostResolver.resolveLiveServer(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep daemon-backed routing scoped to this workspace

When a daemon is running for workspace A, resolving the CLI host with resolveLiveServer() now returns that server for workspace B as well, because it no longer checks the current workspaceRoot/stateRoot. Commands like heddle ask then send requests without a workspaceId, and chat-v2 passes the local id (often just default), while the server context in src/server/routes/trpc/trpc.ts only resolves against the daemon's own workspace catalog; the result is that running these commands from workspace B can read/write sessions and tasks in workspace A instead of B. Please either keep the daemon-backed path workspace-scoped or teach the server request path to resolve registered workspaces by state root before attaching.

Useful? React with 👍 / 👎.

@roackb2 roackb2 force-pushed the codex/global-runtime-registry branch 2 times, most recently from 60c5d59 to d3020f5 Compare June 2, 2026 05:59
@roackb2 roackb2 force-pushed the codex/global-runtime-registry branch from d3020f5 to 931dfdd Compare June 2, 2026 06:34
@roackb2 roackb2 merged commit aa110fa into main Jun 2, 2026
5 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