forked from farhoodlabs/paperclip
test: cover agentId threading on plugin lease RPCs and call sites
Adds focused tests for every code path the agentId addition touches:
- environment-runtime.test.ts (4 new tests):
- plugin-driver acquireLease forwards agentId in RPC payload when present
- plugin-driver acquireLease omits agentId from RPC payload when null
- sandbox-provider acquireLease forwards agentId when present
- sandbox-provider resumeLease forwards agentId when reuseLease=true matches
- seedEnvironment helper now exposes the seeded agentId
- environment-run-orchestrator.test.ts (2 new tests):
- acquireForRun threads agentId through to runtime.acquireRunLease
- logActivity records the same agentId on environment.lease_acquired
- new vi.hoisted mocks for environmentService.getById + ensureLocalEnvironment
- agent-test-environment-routes.test.ts (1 new assertion):
- ad-hoc operator test-environment probe calls acquireRunLease with
agentId: null and heartbeatRunId: null (no agent context)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -196,6 +196,15 @@ describe("agent test-environment route", () => {
|
||||
}),
|
||||
status: "failed",
|
||||
});
|
||||
// Ad-hoc operator probes have no agent context — the route must pass
|
||||
// agentId: null so plugin-backed providers don't accidentally scope the
|
||||
// probe lease against some leftover agentId from the heartbeat path.
|
||||
expect(mockEnvironmentRuntime.acquireRunLease).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
agentId: null,
|
||||
heartbeatRunId: null,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("returns a diagnostic result instead of probing the host when the requested environment is missing", async () => {
|
||||
|
||||
Reference in New Issue
Block a user