mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 23:56:43 +01:00
fix(runner): settle accepted results after shutdown failures (#15217)
## Thinking Path > - Paperclip manages AI agents and the tasks they perform. > - The native runner saves tool results and completion reports before it releases a session. > - Large project discovery responses can exceed the durable command limit. > - A shutdown failure can leave a saved answer waiting for workspace repair. > - Recovery reused the old assessment for a different status decision, which violated a database constraint. > - This pull request bounds discovery responses and lets recovery commit the saved result after workspace repair. > - The benefit is a task that reaches its correct final status without another provider turn. ## Linked Issues or Issue Description **What happened?** A native run can save its final answer, fail during shutdown, and leave the task In Progress after workspace repair succeeds. Reconciliation tries to reuse the failed-workspace assessment for a new decision. The one-decision-per-assessment constraint rejects the write. Replaying the old decision can also retain a fresh coordinator lease. Separately, retained session cleanup only recognizes the old `adapter_failed` label. The project-list tool returns full project records, including large descriptions and workspace configuration. A large response exceeds the runner's durable command limit. The settlement diagnostic previously recorded only a failure flag. **Expected behavior** Project discovery stays within the command limit. Recovery finishes the saved result after workspace repair, releases its lease, and preserves the original error for inspection. It does not repeat provider work or relax session ownership checks. **Steps to reproduce** 1. Return large project records from `list_projects` and observe an oversized semantic result. 2. Persist an accepted native completion result, then record a shutdown failure. 3. Finalize with a failed workspace, repeat that attempt, then record successful workspace repair. 4. Reconcile the run. Before this fix, the issue stays In Progress. **Paperclip version or commit** Reproduced on `a386a599983519eb1d399f8b770bfccdb2a74762`. **Deployment mode** Self-hosted server with Paperclip Runner. Related transport work: #12208 drains queued events; #12241 resumes interrupted semantic calls. This change addresses bounded project discovery and accepted-result finalization. ## What Changed - Read bounded project summary projections from the database and return at most 50 authorized summaries with a continuation cursor and explicit description truncation. Agent and run trust boundaries narrow the database candidates; project-specific policies still receive full authorization. Only visible projects determine continuations. The default project-list API remains unchanged. - Record bounded, content-free settlement failure causes for command limits, storage errors, and rejected dispatch. - Include workspace state in assessment identity. Preserve the initial assessment for interrupted finalization, and commit replacement assessment and decision references together. - Release the coordinator lease when an existing decision is replayed, without repeating its effects. - Clear stale errors when recovery succeeds and retain them in `recoveredExecutionFailure`. - Accept both current and legacy close-failure labels in the existing exact-state cleanup path. - Add regression tests and update the tool contracts and recovery documentation. ## Verification - Red: the new project paging, settlement diagnostic, current cleanup label, and repaired-workspace regressions failed on the original implementation. - Green: protocol/catalog/tool checks (117 tests), the full project-tool and finalizer suites (47 tests), cleanup ownership cases (70 tests), and cleanup sweep cases (4 tests) pass. Database-backed pagination covers large descriptions/configuration, complete enumeration, uppercase cursors, agent/run restrictions, project-policy scope contributions, and identical results/cursors when hidden projects are added. - The initial CI failures in interrupted Board waits, contended endpoint proof, and semantic schema validation were reproduced and fixed; all affected cases pass locally. - `pnpm -r typecheck` — passed. - `pnpm build` — passed. - `pnpm test:run` — started before the review corrections; it spanned several source revisions and was stopped after reporting old-behavior and timing failures. It is not claimed green. Fresh project and recovery suites pass; the recovery suite also passes all 25 cases with the broad runner’s isolated home/config. The Slack timing case passed in isolation. Latest-head CI is the authoritative complete test matrix. - Existing authorization suite — 66 tests passed. - Latest-head CI on `8e5763d915aa6f375bdab6601996899ea01496fc` — 55 checks passed, 4 intentionally skipped, no pending or failing checks. - Greptile — 5/5, zero unresolved threads on the same commit. - `git diff --check` — passed. ## Risks - `list_projects` now returns summaries. Callers must follow `nextCursor` and use the authorized project API for full records. Candidate narrowing is only an optimization: project policy and responsible-user authorization remain authoritative. - Assessment identity changes for workspace finalization. Existing evidence remains intact; no migration is needed. - Cleanup still requires matching identities, settled tool evidence, and verified process ownership. Unknown tool outcomes remain blocked from session reuse. ## Model Used OpenAI Codex, based on GPT-6, with reasoning, code execution, and GitHub tools. The exact serving model ID and context window are not exposed in this session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
a386a59998
commit
a65ca09508
30 files changed
+434
-117
No files matched your search
@@ -1 +1 @@
|
||||
[{"annotations":{"exposure":"always","operationId":"get_task_context","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the active task and actor, including the exact approved Markdown revision when this issue has an accepted plan.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"get_task_context","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"get_task_history","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read bounded comments on the active task.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},"required":[],"type":"object"},"name":"get_task_history","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"list_documents","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List revisioned documents on the active task.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_documents","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"read_document","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the current revision of one active-task document.","inputSchema":{"additionalProperties":false,"properties":{"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"}},"required":["key"],"type":"object"},"name":"read_document","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"list_document_revisions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read bounded revision history for one active-task document.","inputSchema":{"additionalProperties":false,"properties":{"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"},"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},"required":["key"],"type":"object"},"name":"list_document_revisions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"report_progress","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append a durable progress comment to the active task.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Multiline progress update.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","body"],"type":"object"},"name":"report_progress","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"answer_status_question","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append the answer to a status-only wake without changing task disposition.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Concise status answer.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","body"],"type":"object"},"name":"answer_status_question","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"write_document","requiredClaimLine truncated
|
||||
[{"annotations":{"exposure":"always","operationId":"get_task_context","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the active task and actor, including the exact approved Markdown revision when this issue has an accepted plan.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"get_task_context","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"get_task_history","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read bounded comments on the active task.","inputSchema":{"additionalProperties":false,"properties":{"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},"required":[],"type":"object"},"name":"get_task_history","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"list_documents","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"List revisioned documents on the active task.","inputSchema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"},"name":"list_documents","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"read_document","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read the current revision of one active-task document.","inputSchema":{"additionalProperties":false,"properties":{"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"}},"required":["key"],"type":"object"},"name":"read_document","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"list_document_revisions","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Read bounded revision history for one active-task document.","inputSchema":{"additionalProperties":false,"properties":{"key":{"description":"Stable issue-document key.","maxLength":120,"minLength":1,"type":"string"},"limit":{"default":50,"maximum":200,"minimum":1,"type":"integer"}},"required":["key"],"type":"object"},"name":"list_document_revisions","outputSchema":{"additionalProperties":true,"type":"object"}},{"annotations":{"exposure":"always","operationId":"report_progress","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append a durable progress comment to the active task.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Multiline progress update.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","body"],"type":"object"},"name":"report_progress","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"answer_status_question","requiredClaims":[],"semanticContract":"paperclip.semantic-tool.v1","version":1},"description":"Append the answer to a status-only wake without changing task disposition.","inputSchema":{"additionalProperties":false,"properties":{"body":{"description":"Concise status answer.","maxLength":20000,"minLength":1,"type":"string"},"idempotencyKey":{"description":"Caller-stable retry key.","maxLength":240,"minLength":1,"type":"string"}},"required":["idempotencyKey","body"],"type":"object"},"name":"answer_status_question","outputSchema":{"additionalProperties":false,"properties":{"commandId":{"description":"Stable command identifier.","maxLength":200,"minLength":1,"type":"string"},"disposition":{"enum":["applied","duplicate"]},"entityRefs":{"description":"Entities affected by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"scheduledWakeIds":{"description":"Wake identifiers scheduled by the operation.","items":{"minLength":1,"type":"string"},"maxItems":200,"type":"array","uniqueItems":true},"stateRevision":{"minimum":0,"type":"integer"}},"required":["commandId","disposition","stateRevision","entityRefs","scheduledWakeIds"],"type":"object"}},{"annotations":{"exposure":"always","operationId":"write_document","requiredClaimLine truncated
|
||||
@@ -1874,11 +1874,23 @@
|
||||
"planning",
|
||||
"skill_test"
|
||||
],
|
||||
"description": "Inspect available company projects before selecting a project for new work.",
|
||||
"description": "List company project summaries (IDs, names, status, and up to 1,000 characters of description). Returns up to 50 projects and nextCursor; continue with cursor until it is null. Read a project's API resource for full details.",
|
||||
"effect": "read",
|
||||
"inputSchema": {
|
||||
"additionalProperties": false,
|
||||
"properties": {},
|
||||
"properties": {
|
||||
"cursor": {
|
||||
"description": "The nextCursor returned by the previous page.",
|
||||
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
|
||||
"type": "string"
|
||||
},
|
||||
"limit": {
|
||||
"description": "Page size (default 50).",
|
||||
"maximum": 50,
|
||||
"minimum": 1,
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"prpVersion": 1,
|
||||
"nativeExecutionVersion": 1,
|
||||
"catalogVersion": 1,
|
||||
"catalogSha256": "sha256:1dd4904ba9ae5c2b6bb0cbd4cfef65734d855bb5ed10ed05c70b603b8589bec3",
|
||||
"catalogSha256": "sha256:d1dbdada74def03f9f1af779b6328d83e44ac35e70e4693d17ff15a9eecfebc7",
|
||||
"driverContractVersion": 1,
|
||||
"driverKind": "paperclip-deterministic",
|
||||
"driverVersion": "1.0.0"
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
},
|
||||
{
|
||||
"path": "fixtures/evals/native-execution-seeded.json",
|
||||
"sha256": "b4e488f922dd328a3967b2560951c2377f4c1411fb2c4c9eef7a44195a8f7514",
|
||||
"sha256": "a53e3d8eae39899111ff1a0110135a9cfafdd12f7843cf6872a3de8fae915a76",
|
||||
"expectation": "accept",
|
||||
"compatibilityCase": "canonical"
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { listProjectsDescription, listProjectsInputSchema } from "../protocol-actions/list-projects.js";
|
||||
import { setTaskTitleAction } from "../protocol-actions/set-task-title.js";
|
||||
import { reassignTaskAction } from "../protocol-actions/reassign-task.js";
|
||||
import type {
|
||||
@@ -473,9 +474,9 @@ const descriptors: readonly PaperclipSemanticActionDescriptor[] = [
|
||||
operationId: "list_projects",
|
||||
title: "List projects",
|
||||
requiredClaims: ["discovery:projects:read"],
|
||||
description: "Inspect available company projects before selecting a project for new work.",
|
||||
description: listProjectsDescription,
|
||||
placement: "optional",
|
||||
inputSchema: object({}),
|
||||
inputSchema: listProjectsInputSchema,
|
||||
}),
|
||||
descriptor({
|
||||
operationId: "list_project_repositories",
|
||||
|
||||
@@ -2258,6 +2258,27 @@ describe.sequential("DurablePrpControlPlane", () => {
|
||||
} finally { await core.stop(); rmSync(root, { recursive: true, force: true }); }
|
||||
});
|
||||
|
||||
it("reports an oversized semantic result without exposing its content or redispatching", async () => {
|
||||
const root = mkdtempSync(resolve(tmpdir(), "paperclip-result-limit-"));
|
||||
const handler = vi.fn(async () => ({ result: { privateContent: "x".repeat(600_000) } }));
|
||||
const core = new DurablePrpControlPlane({ stateDirectory: root, identity,
|
||||
expectedRunnerVersion, expectedRunnerDigest, onSemanticToolInput: handler });
|
||||
try {
|
||||
await core.start();
|
||||
const client = (await authenticate(core, core.issueBootstrapTicket()))!;
|
||||
sendSecure(client, semanticInputEvent());
|
||||
await vi.waitFor(() => expect(core.semanticToolSettlementDiagnostics()).toMatchObject({
|
||||
persistenceFailed: true,
|
||||
failures: [{ callId: "call-1", operationId: "get_task_context", stage: "persist_result", code: "command_payload_too_large" }],
|
||||
}));
|
||||
expect(core.store.state.commands).toEqual([]);
|
||||
expect(core.semanticToolResultsSettled()).toBe(false);
|
||||
expect(JSON.stringify(core.semanticToolSettlementDiagnostics())).not.toContain("privateContent");
|
||||
expect(handler).toHaveBeenCalledOnce();
|
||||
client.socket.destroy();
|
||||
} finally { await core.stop(); rmSync(root, { recursive: true, force: true }); }
|
||||
});
|
||||
|
||||
it.each(["before_dispatch", "during_effect"] as const)("settles only proven pre-dispatch cancellation (%s)", async (stage) => {
|
||||
const root = mkdtempSync(resolve(tmpdir(), "paperclip-tool-dispatch-boundary-"));
|
||||
const handler = vi.fn(async () => {
|
||||
|
||||
@@ -55,6 +55,11 @@ const maxFrameBytes = 1024 * 1024;
|
||||
// Secure frames hex-encode ciphertext. Reserve envelope/tag space as well.
|
||||
const maxCommandBytes = Math.floor((maxFrameBytes - 4 * 1024) / 2);
|
||||
const maxCommands = 500;
|
||||
class CommandJournalLimitError extends Error {
|
||||
constructor(readonly code: "command_payload_too_large" | "command_journal_full") {
|
||||
super(`Durable PRP command journal bound exceeded: ${code}.`);
|
||||
}
|
||||
}
|
||||
// A provider can emit several 100-event runner batches before the transport's
|
||||
// polling turn regains the event loop. Match the transport's explicit deferred
|
||||
// event bound so a valid burst is not compacted before it can be observed.
|
||||
@@ -1476,6 +1481,12 @@ export class DurablePrpControlPlane {
|
||||
#connectionProcessing = new Map<AuthorityConnection, Promise<void>>();
|
||||
#pendingSemanticCalls = new Set<string>();
|
||||
#semanticResultPersistenceFailed = false;
|
||||
#semanticResultFailures: Array<{
|
||||
callId: string;
|
||||
operationId: string;
|
||||
stage: "persist_result" | "dispatch";
|
||||
code: string;
|
||||
}> = [];
|
||||
#port: number | null = null;
|
||||
#onSemanticToolInput?: DurablePrpControlPlaneOptions["onSemanticToolInput"];
|
||||
#onCommittedEvent?: DurablePrpControlPlaneOptions["onCommittedEvent"];
|
||||
@@ -1641,6 +1652,7 @@ export class DurablePrpControlPlane {
|
||||
);
|
||||
return {
|
||||
persistenceFailed: this.#semanticResultPersistenceFailed,
|
||||
failures: this.#semanticResultFailures,
|
||||
pending: pending.map((entry) => {
|
||||
const event = entry.envelope.payload as Record<string, unknown>;
|
||||
const payload = event.payload as Record<string, unknown>;
|
||||
@@ -1948,12 +1960,10 @@ export class DurablePrpControlPlane {
|
||||
status: "pending",
|
||||
result: null,
|
||||
};
|
||||
if (
|
||||
this.#store.state.commands.length >= maxCommands ||
|
||||
Buffer.byteLength(JSON.stringify(command)) > maxCommandBytes
|
||||
) {
|
||||
throw new Error("Durable PRP command journal bound exceeded.");
|
||||
}
|
||||
if (this.#store.state.commands.length >= maxCommands)
|
||||
throw new CommandJournalLimitError("command_journal_full");
|
||||
if (Buffer.byteLength(JSON.stringify(command)) > maxCommandBytes)
|
||||
throw new CommandJournalLimitError("command_payload_too_large");
|
||||
this.#store.state.commands.push(command);
|
||||
this.#store.save();
|
||||
if (deliverImmediately) {
|
||||
@@ -3262,6 +3272,18 @@ export class DurablePrpControlPlane {
|
||||
// evidence stays pending for authoritative reconciliation.
|
||||
if (existing === undefined && !alreadyQueued && !this.#pendingSemanticCalls.has(commandId)) {
|
||||
this.#pendingSemanticCalls.add(commandId);
|
||||
const recordFailure = (stage: "persist_result" | "dispatch", error: unknown) => {
|
||||
this.#semanticResultPersistenceFailed = true;
|
||||
// Keep diagnostics bounded and content-free. Exception messages can
|
||||
// contain tool bodies or credentials; retain only known error codes.
|
||||
const storageCode = error && typeof error === "object" && "code" in error ? error.code : null;
|
||||
const code = error instanceof CommandJournalLimitError ? error.code
|
||||
: typeof storageCode === "string" && ["ENOSPC", "EDQUOT", "EACCES", "EPERM", "EIO", "EROFS"].includes(storageCode)
|
||||
? storageCode : stage === "dispatch" ? "dispatcher_rejected" : "result_persistence_failed";
|
||||
this.#semanticResultFailures.push({ callId: call.callId, operationId: call.operationId, stage, code });
|
||||
this.#semanticResultFailures = this.#semanticResultFailures.slice(-20);
|
||||
this.disconnectActiveRunner();
|
||||
};
|
||||
const queueResult = (result: unknown, isError: boolean): void => {
|
||||
try {
|
||||
// Retain the full input once in its canonical event. Copying a
|
||||
@@ -3274,12 +3296,11 @@ export class DurablePrpControlPlane {
|
||||
commandId,
|
||||
true,
|
||||
);
|
||||
} catch {
|
||||
this.#semanticResultPersistenceFailed = true;
|
||||
} catch (error) {
|
||||
// A result that cannot fit the bounded durable journal cannot be
|
||||
// acknowledged as a usable tool response. Force a reconnect so
|
||||
// the caller can recover or terminate the run explicitly.
|
||||
this.disconnectActiveRunner();
|
||||
recordFailure("persist_result", error);
|
||||
}
|
||||
};
|
||||
void this.#onSemanticToolInput(call)
|
||||
@@ -3297,8 +3318,7 @@ export class DurablePrpControlPlane {
|
||||
}
|
||||
// A rejected dispatcher promise does not prove that its effect
|
||||
// rolled back. Do not fabricate a final failure or retry the write.
|
||||
this.#semanticResultPersistenceFailed = true;
|
||||
this.disconnectActiveRunner();
|
||||
recordFailure("dispatch", error);
|
||||
})
|
||||
.finally(() => this.#pendingSemanticCalls.delete(commandId));
|
||||
}
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
export const listProjectsInputSchema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
limit: { type: "integer", minimum: 1, maximum: 50, description: "Page size (default 50)." },
|
||||
cursor: { type: "string", pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", description: "The nextCursor returned by the previous page." },
|
||||
},
|
||||
required: [],
|
||||
additionalProperties: false,
|
||||
} as const;
|
||||
|
||||
export const listProjectsDescription = "List company project summaries (IDs, names, status, and up to 1,000 characters of description). Returns up to 50 projects and nextCursor; continue with cursor until it is null. Read a project's API resource for full details.";
|
||||
|
||||
/** Canonical project discovery definition. */
|
||||
export const listProjectsAction = {
|
||||
"id": "list_projects",
|
||||
@@ -29,7 +41,7 @@ export const listProjectsAction = {
|
||||
},
|
||||
"documentation": {
|
||||
"title": "List projects",
|
||||
"description": "Inspect available company projects before selecting a project for new work.",
|
||||
"description": listProjectsDescription,
|
||||
"note": null
|
||||
},
|
||||
"examples": {
|
||||
@@ -50,7 +62,7 @@ export const listProjectsAction = {
|
||||
"operationId": "list_projects",
|
||||
"version": 1,
|
||||
"title": "List projects",
|
||||
"description": "Inspect available company projects before selecting a project for new work.",
|
||||
"description": listProjectsDescription,
|
||||
"effect": "read",
|
||||
"requiredClaims": [
|
||||
"discovery:projects:read"
|
||||
@@ -61,12 +73,7 @@ export const listProjectsAction = {
|
||||
"planning",
|
||||
"skill_test"
|
||||
],
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": [],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"inputSchema": listProjectsInputSchema,
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
@@ -80,13 +87,8 @@ export const listProjectsAction = {
|
||||
"operationId": "list_projects",
|
||||
"version": 1,
|
||||
"title": "List Projects",
|
||||
"description": "List Projects through the Capability discovery capability set.",
|
||||
"inputSchema": {
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": [],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"description": listProjectsDescription,
|
||||
"inputSchema": listProjectsInputSchema,
|
||||
"outputSchema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -962,6 +962,8 @@ export type {
|
||||
SetupTokenTransportAdvisoryCode,
|
||||
AssetImage,
|
||||
Project,
|
||||
ProjectDiscoverySummary,
|
||||
ProjectDiscoveryPage,
|
||||
ProjectBudgetSummary,
|
||||
ProjectRepository,
|
||||
ProjectRepositoryOptions,
|
||||
@@ -1918,6 +1920,7 @@ export {
|
||||
type ResetAgentSession,
|
||||
type TestAdapterEnvironment,
|
||||
type UpdateAgentPermissions,
|
||||
projectDiscoverySchema,
|
||||
createProjectSchema,
|
||||
updateProjectSchema,
|
||||
createProjectWorkspaceSchema,
|
||||
|
||||
@@ -351,7 +351,7 @@ export type {
|
||||
DocumentTextRange,
|
||||
UpdateDocumentAnnotationThreadRequest,
|
||||
} from "./document-annotation.js";
|
||||
export type { Project, ProjectRepository, ProjectRepositoryOptions, ProjectBudgetSummary, ProjectCodebase, ProjectCodebaseOrigin, ProjectGoalRef, ProjectManagedByPlugin, ProjectWorkspace } from "./project.js";
|
||||
export type { Project, ProjectDiscoverySummary, ProjectDiscoveryPage, ProjectRepository, ProjectRepositoryOptions, ProjectBudgetSummary, ProjectCodebase, ProjectCodebaseOrigin, ProjectGoalRef, ProjectManagedByPlugin, ProjectWorkspace } from "./project.js";
|
||||
export type {
|
||||
CompanySearchCountType,
|
||||
CompanySearchExtractIssueResult,
|
||||
|
||||
@@ -75,6 +75,19 @@ export interface ProjectManagedByPlugin {
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export interface ProjectDiscoverySummary {
|
||||
id: string;
|
||||
name: string;
|
||||
status: string;
|
||||
description: string | null;
|
||||
descriptionTruncated: boolean;
|
||||
}
|
||||
|
||||
export interface ProjectDiscoveryPage {
|
||||
projects: ProjectDiscoverySummary[];
|
||||
nextCursor: string | null;
|
||||
}
|
||||
|
||||
export interface Project {
|
||||
id: string;
|
||||
companyId: string;
|
||||
|
||||
@@ -387,6 +387,7 @@ export {
|
||||
} from "./agent.js";
|
||||
|
||||
export {
|
||||
projectDiscoverySchema,
|
||||
createProjectSchema,
|
||||
updateProjectSchema,
|
||||
createProjectWorkspaceSchema,
|
||||
|
||||
@@ -4,6 +4,11 @@ import { envConfigSchema } from "./secret.js";
|
||||
import { trustAuthorizationPolicySchema } from "./trust-policy.js";
|
||||
import { objectWithoutDefaults } from "./partial.js";
|
||||
|
||||
export const projectDiscoverySchema = z.object({
|
||||
limit: z.number().int().min(1).max(50).default(50),
|
||||
cursor: z.string().uuid().transform(value => value.toLowerCase()).optional(),
|
||||
}).strict();
|
||||
|
||||
const executionWorkspaceStrategySchema = z
|
||||
.object({
|
||||
type: z.enum(["project_primary", "git_worktree", "adapter_managed", "cloud_sandbox"]).optional(),
|
||||
|
||||
Reference in new issue
Block a user