Uh oh!
There was an error while loading. Please reload this page.
fix(engine): isolate conflicting inventory members - #366
Conversation
Session-Id: 01a06151-60e7-77a2-830e-81263e3ce20b
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
3 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".agentworkforce/trajectories/completed/2026-09/traj_uaqpcy4qgnoa/trajectory.json">
<violation number="1" location=".agentworkforce/trajectories/completed/2026-09/traj_uaqpcy4qgnoa/trajectory.json:104">
P2: This completed trajectory cannot be audited because it records no commits or changed files and both trace refs point to an unavailable object. Record the actual product and evidence commit range, complete file list, and matching start/end refs before marking the trajectory completed.</violation>
</file>
<file name="packages/engine/src/engine/node.ts">
<violation number="1" location="packages/engine/src/engine/node.ts:1583">
P1: When a mixed inventory reports the wrong `agent_id` for an agent already active on this node, this set omits the rejected member's name and the missing-agent sweep takes the real agent offline, emitting `agent.exited`. Preserve reported names for the missing check while continuing to exclude rejected members from reconciliation and delivery readiness.</violation>
</file>
<file name="tests/relayflows/cases/0902-node-inventory-presence-isolation/run.mjs">
<violation number="1" location="tests/relayflows/cases/0902-node-inventory-presence-isolation/run.mjs:57">
P3: The setup that writes .relay-pr-proof/ and the conformance probe test into the target tree runs before the try, so the finally cleanup only runs when the vitest invocation fails. If copyFile or writeFile throws after a prior setup step created a file, the leftover probe.test.ts and .relay-pr-proof/ stay in the checkout. Move the mkdir/copyFile/writeFile inside the try so the finally always removes them.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| throw rejectedInventoryErrors[0]; | ||
| } | ||
| const names = new Set(acceptedInventoryAgents.map((agent) => agent.name)); |
There was a problem hiding this comment.
P1: When a mixed inventory reports the wrong agent_id for an agent already active on this node, this set omits the rejected member's name and the missing-agent sweep takes the real agent offline, emitting agent.exited. Preserve reported names for the missing check while continuing to exclude rejected members from reconciliation and delivery readiness.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/engine/src/engine/node.ts, line 1583:
<comment>When a mixed inventory reports the wrong `agent_id` for an agent already active on this node, this set omits the rejected member's name and the missing-agent sweep takes the real agent offline, emitting `agent.exited`. Preserve reported names for the missing check while continuing to exclude rejected members from reconciliation and delivery readiness.</comment>
<file context>
@@ -1540,19 +1542,49 @@ export async function reconcileInventory(
+ throw rejectedInventoryErrors[0];
+ }
+
+ const names = new Set(acceptedInventoryAgents.map((agent) => agent.name));
+ const liveInvocationIds = new Set(acceptedInventoryAgents.flatMap((agent) => (
+ agent.invocation_id ? [agent.invocation_id] : []
</file context>
| constnames=newSet(acceptedInventoryAgents.map((agent)=>agent.name)); | |
| constnames=newSet(inventoryAgents.map((agent)=>agent.name)); |
| "approach": "Standard approach", | ||
| "confidence": 0.94 | ||
| }, | ||
| "commits": [], |
There was a problem hiding this comment.
P2: This completed trajectory cannot be audited because it records no commits or changed files and both trace refs point to an unavailable object. Record the actual product and evidence commit range, complete file list, and matching start/end refs before marking the trajectory completed.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .agentworkforce/trajectories/completed/2026-09/traj_uaqpcy4qgnoa/trajectory.json, line 104:
<comment>This completed trajectory cannot be audited because it records no commits or changed files and both trace refs point to an unavailable object. Record the actual product and evidence commit range, complete file list, and matching start/end refs before marking the trajectory completed.</comment>
<file context>
@@ -0,0 +1,112 @@
+ "approach": "Standard approach",
+ "confidence": 0.94
+ },
+ "commits": [],
+ "filesChanged": [],
+ "projectId": "AgentWorkforce/relaycast",
</file context>
| await mkdir(proofDir, { recursive: true }); | ||
| await copyFile(path.join(caseDir, 'probe.test.ts'), probePath); | ||
| await writeFile( | ||
| configPath, | ||
| `import { defineConfig } from 'vitest/config';\n\nexport default defineConfig({ test: { environment: 'node', include: ['packages/engine/src/__tests__/conformance/.relayflow-node-inventory-presence.test.ts'] } });\n` | ||
| ); | ||
| try { |
There was a problem hiding this comment.
P3: The setup that writes .relay-pr-proof/ and the conformance probe test into the target tree runs before the try, so the finally cleanup only runs when the vitest invocation fails. If copyFile or writeFile throws after a prior setup step created a file, the leftover probe.test.ts and .relay-pr-proof/ stay in the checkout. Move the mkdir/copyFile/writeFile inside the try so the finally always removes them.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/relayflows/cases/0902-node-inventory-presence-isolation/run.mjs, line 57:
<comment>The setup that writes .relay-pr-proof/ and the conformance probe test into the target tree runs before the try, so the finally cleanup only runs when the vitest invocation fails. If copyFile or writeFile throws after a prior setup step created a file, the leftover probe.test.ts and .relay-pr-proof/ stay in the checkout. Move the mkdir/copyFile/writeFile inside the try so the finally always removes them.</comment>
<file context>
@@ -0,0 +1,90 @@
+ 'packages/engine/src/__tests__/conformance/.relayflow-node-inventory-presence.test.ts'
+);
+const configPath = path.join(proofDir, 'vitest.config.mts');
+await mkdir(proofDir, { recursive: true });
+await copyFile(path.join(caseDir, 'probe.test.ts'), probePath);
+await writeFile(
</file context>
| awaitmkdir(proofDir,{recursive: true}); | |
| awaitcopyFile(path.join(caseDir,'probe.test.ts'),probePath); | |
| awaitwriteFile( | |
| configPath, | |
| `import { defineConfig } from 'vitest/config';\n\nexport default defineConfig({ test: { environment: 'node', include: ['packages/engine/src/__tests__/conformance/.relayflow-node-inventory-presence.test.ts'] } });\n` | |
| ); | |
| try{ | |
| try{ | |
| awaitmkdir(proofDir,{recursive: true}); | |
| awaitcopyFile(path.join(caseDir,'probe.test.ts'),probePath); | |
| awaitwriteFile( | |
| configPath, | |
| `import { defineConfig } from 'vitest/config';\n\nexport default defineConfig({ test: { environment: 'node', include: ['packages/engine/src/__tests__/conformance/.relayflow-node-inventory-presence.test.ts'] } });\n` | |
| ); | |
| run(process.execPath,[vitestEntry,'run','--config',configPath,'--reporter=verbose'],targetDir); | |
| }finally{ |
Summary
Runtime proof
Base dd477eb: one conflicting chief entry rejects the complete cursor-aware inventory; two valid siblings read offline and each retains one pending delivery.
Head: the conflict is reported as one rejected member, both valid siblings read active, receive and acknowledge delivery, and have empty pending queues.
Validation
No deployment is included.