feat(examples): add the worktree-proximity composition reference (#104) - #256
Conversation
Use generated request state and notice handles so cross-render coordination is durable, testable, and honest when capabilities are unavailable.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70eee08a7c
ℹ️ 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".
| recipient: { | ||
| actor: { id: conflict.actorId }, | ||
| }, |
There was a problem hiding this comment.
Avoid actor recipients until event requests mount an actor
In generated artifacts, startEventRuntime in packages/agent-bundle/src/mcp-server-runtime.ts mounts host, session, and workspace but no actor, while notice admission requires the request principal's actor ID to match this recipient. Consequently these notices remain pending indefinitely in the documented real host flow; the route-unit test masks this by manually supplying context.actor. Resolve the actor before notice admission or use a recipient identity that the generated event request actually mounts.
AGENTS.md reference: AGENTS.md:L10-L13
Useful? React with 👍 / 👎.
| status: 'success', | ||
| version: 1, | ||
| }, | ||
| dedupeKey: `proximity:${resolution.actor.id}:${conflict.actorId}:${conflict.summary}`, |
There was a problem hiding this comment.
Scope notice deduplication to a single conflict occurrence
When the same actor pair encounters the same path or dependency again, this stable key matches the first ledger entry even after that notice is attempted; the notice ledger deduplicates against entries in every state, so no new pending notice is created for the later conflict. Since the publish idempotency key already handles replay of one event, include the conflict occurrence in the dedupe key or omit it so recurring conflicts continue notifying the other actor.
AGENTS.md reference: AGENTS.md:L10-L13
Useful? React with 👍 / 👎.
Summary
Adds
examples/worktree-proximity(#104): an advanced, intentionally demanding composition reference where one root task and two child agents in linked git worktrees coordinate current-intent proximity — path and dependency overlap — purely through public framework primitives, with no daemon and no collision logic in framework core.Composition proven
src/providers/git-worktree.tsderives repo/branch/commit/common-dir/linked-worktree identity per request through the conventional provider contract (feat(routes): execute conventional context providers in generated request scopes (#95 remainder) #255), preferring native eventcwdand degrading honestly.src/providers/agent-topology.tsreports honest unavailability: providers execute before the request scope mounts, so topology snapshots come from the mounted state handle in routes (documented divergence from the issue sketch, which predates feat(runtime): mount state kernel and notice ledger into generated request scopes (#233) #251/Track remaining #98 state-kernel scope: warm-runtime process state, generated-runtime state mounting, budgets, lifetime visibility #233).src/state.tsdefault-exports a closed, workspace-durableworktree-proximity/topologydefinition (actors, activities, refusals — every field provenance-trackednativevsderived); generated request scopes mount it per feat(runtime): mount state kernel and notice ledger into generated request scopes (#233) #251.session/start,agent/start,tool/before,tool/after,stop, allruntime: 'shared') observe/bind actors, record and clear intent, detect proximity via the puresrc/domain/proximity.ts, warn withAgent.Context+outcome: continue(never deny), and publish recipient-scoped notices; the ledger attempts delivery on the recipient's next admitted event via(await agent()).notices.tool:coordinator/statusrenders durable topology, active intents, and refusals from the mounted handles.agent/startwithout nativeagent_idrecords anedgeRefusedand never fabricates an edge (journey 8).Journey proof (route-unit level, real durable sqlite shared across renders via public
@agent-bundle/runtime/mount)journeys 3 (non-overlap silence), 4+5 (warning + pending directed notice), 6 (attempted delivery on the recipient's next event, evidence-backed
attemptedstate), 7 (idempotent replayed envelope), 8 (missing-identity refusal), plus status-tool rendering and unmounted-handle honesty. The multi-process packed journey suite lands as the next slice.Gates (local)
pnpm --filter @agent-bundle-example/worktree-proximity check— validate, build, typecheck, 4/4 domain tests, 8/8 route-unit tests, all green on top of feat(routes): execute conventional context providers in generated request scopes (#95 remainder) #255pnpm exec rslint examples/worktree-proximity— cleanprivatePackages.version: false)Refs #104, #251, #255.