Skip to content

test(examples): prove worktree-proximity journeys across real processes and worktrees (#104) - #260

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
wave6/104-journeys
Sep 2, 2026
Merged

ScriptedAlchemy merged 1 commit into
mainfrom
wave6/104-journeys

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

Completes #104's evidence boundary: one serialized integration suite (packages/agent-bundle/tests/worktree-proximity-journeys.test.ts, root integration pool) that builds the examples/worktree-proximity artifact once, creates a REAL git repository with two linked worktrees, spawns the generated MCP server over stdio, and drives every journey through real generated hook thin-client child processes over the artifact IPC endpoint — artifact/contract evidence, explicitly not commercial-host dispatch proof.

Journeys 1–9, cross-process

  • 1–2: root + two child actors observed with native parent provenance, each bound to a distinct real worktree.
  • 3: non-overlapping intent → no warning.
  • 4–5: overlapping path intent from worktree B → exact proximity warning in the hook's additional context; a durable directed notice published for the other worktree.
  • 6: worktree A's next event renders the attempted notice.
  • 7: replaying the identical native envelope leaves activities and the state revision unchanged.
  • 8, two honesty layers: the generated wrapper fail-closes a SubagentStart missing agent_id (nonzero exit, native agent_id must be a nonempty string, durable state untouched) because the pinned hosts' contracts always carry identity; the route-level refusal for hosts that genuinely omit identity stays proven at route-unit level.
  • 9: SIGKILL the server, respawn on the same artifact — identical revision, actors, activities, refusals from durable sqlite.

Example adjustment (workspace recipient axis)
Generated event request scopes mount host/session/workspace principals (workspace = native cwd) and no actor principal, so actor-directed notices are un-attemptable in generated runtimes v1. Directed notices now target the recipient worktree via the supported AgentRecipient.workspace axis; the target actor stays named in content and dedupe keys, and the README documents the boundary (actor-principal mounting remains #99/#233 lineage follow-up). tool:coordinator/status gains an honest revision field for exact-revision assertions.

Gates (local)

  • journey suite via root integration pool — 1/1 (all nine journeys inside)
  • pnpm --filter @agent-bundle-example/worktree-proximity check — validate/build/typecheck, 4/4 domain, 8/8 route-unit
  • rslint on touched files — clean

Refs #104, #99, #233.

…es and worktrees (#104)

Target directed notices through the generated event scope's supported workspace principal, and cover Journey 8 at both the fail-closed native wrapper and route-refusal layers.
@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a582b0f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ScriptedAlchemy
ScriptedAlchemy merged commit eb79df6 into main Sep 2, 2026
4 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-02T02:52:29.317451Z a582b0f PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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: a582b0f3ea

ℹ️ 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".

priority: 'high',
recipient: {
actor: { id: conflict.actorId },
workspace: { root: conflict.worktreeRoot },

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 Normalize recipient roots before matching notices

When the host is started from a subdirectory of a linked worktree, gitWorktreeProvider stores the Git top-level as conflict.worktreeRoot, but the generated event runtime mounts the raw native cwd as the workspace principal (packages/agent-bundle/src/mcp-server-runtime.ts:442-454), and notice matching requires exact string equality (packages/rsc-runtime/src/notices/state.ts:120-121). Publishing this canonical root therefore leaves the notice pending forever instead of surfacing it on the target worktree's next event; normalize both identities to the same worktree root before publishing or matching.

AGENTS.md reference: AGENTS.md:L12-L12

Useful? React with 👍 / 👎.

Comment on lines +407 to +408
const firstPid = liveSession.pid;
await liveSession.stop();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Kill the server before asserting crash recovery

Journey 9 is documented as SIGKILL/restart durability, but this line invokes stop(), whose implementation calls client.close() and performs an orderly transport shutdown. A clean close may flush SQLite state and clean up the IPC endpoint, so the equality after restart cannot catch recovery failures caused by abrupt process death; send SIGKILL to firstPid and wait for its exit before starting the replacement server.

Useful? React with 👍 / 👎.

@ScriptedAlchemy
ScriptedAlchemy deleted the wave6/104-journeys branch September 3, 2026 05:30
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