mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 10:44:52 +01:00
fix: ground dependency guidance in current readiness
Restore assigned-worker revision and latest-child review instructions. Return dependency readiness with conditional guidance, preserving the original receipt on idempotent replay. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
d8bf5ae217
commit
245e8568d9
10 files changed
+103
-11
No files matched your search
@@ -17,6 +17,24 @@ The [sanitized comparison receipt](2026-10-05-native-procedure-comparison.json)
|
||||
contains original grades, exact sources, campaign links, measurement receipts
|
||||
and retained evidence hashes. It excludes raw sessions and instance identifiers.
|
||||
|
||||
## Readiness repair in progress
|
||||
|
||||
The next candidate restores explicit assigned-teammate revision and latest-child
|
||||
review instructions in the standing prompt. Its `set_dependencies` receipt now
|
||||
reports readiness at the time of the update, including unfinished dependencies
|
||||
and completed children whose workspaces still need finalization. If everything
|
||||
is already ready, the receipt directs the parent to review and continue instead
|
||||
of blocking for an event that already happened. Additional teammate work needs
|
||||
an assigned revision task; a comment on a completed task does not substitute for
|
||||
that assignment. Idempotent replay preserves the original readiness snapshot.
|
||||
|
||||
This is a new combined instruction and receipt correction, not a regrade of the
|
||||
failed experiment. The original results above remain unchanged. A new matched
|
||||
comparison must use the integrated master context and the same task requests,
|
||||
graders, profiles, deadlines and budgets. The restored discovery and review
|
||||
instructions take priority over maximizing byte reduction. Keep the PR draft
|
||||
until the repaired source has passed behavioral comparison and current CI/review.
|
||||
|
||||
## Scope
|
||||
|
||||
The paid comparison uses master `a386a599983519eb1d399f8b770bfccdb2a74762` as
|
||||
|
||||
@@ -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
|
||||
@@ -1819,6 +1819,29 @@
|
||||
"minLength": 1,
|
||||
"type": "string"
|
||||
},
|
||||
"dependencyReadiness": {
|
||||
"additionalProperties": false,
|
||||
"description": "Readiness when this update was applied. A replay retains that snapshot; task state can change afterward.",
|
||||
"properties": {
|
||||
"isReady": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"unresolvedTaskIds": {
|
||||
"items": {
|
||||
"minLength": 1,
|
||||
"type": "string"
|
||||
},
|
||||
"maxItems": 200,
|
||||
"type": "array",
|
||||
"uniqueItems": true
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"isReady",
|
||||
"unresolvedTaskIds"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"disposition": {
|
||||
"enum": [
|
||||
"applied",
|
||||
@@ -1836,7 +1859,7 @@
|
||||
"uniqueItems": true
|
||||
},
|
||||
"guidance": {
|
||||
"description": "Conditional next steps after recording dependencies.",
|
||||
"description": "Next steps for the recorded readiness snapshot.",
|
||||
"type": "string"
|
||||
},
|
||||
"scheduledWakeIds": {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"prpVersion": 1,
|
||||
"nativeExecutionVersion": 1,
|
||||
"catalogVersion": 1,
|
||||
"catalogSha256": "sha256:4a98f05fc33a6b407ca7b4ae668f799a7b7ac55e4f293fc84888b22fe371c244",
|
||||
"catalogSha256": "sha256:4511b5443cd8679235adace402e8bb926d2967de00a71d324b97deb1900e39ff",
|
||||
"driverContractVersion": 1,
|
||||
"driverKind": "paperclip-deterministic",
|
||||
"driverVersion": "1.0.0"
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
},
|
||||
{
|
||||
"path": "fixtures/evals/native-execution-seeded.json",
|
||||
"sha256": "1ef1b62506d7c044d68dd9ed8033bd7901f8dba47aea70188c85878d448f6a0a",
|
||||
"sha256": "031074d68aa769ce5fba01281a087b6b12a4863f428b41dfee9de5b5822e0a63",
|
||||
"expectation": "accept",
|
||||
"compatibilityCase": "canonical"
|
||||
},
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { createHash } from "node:crypto";
|
||||
|
||||
export const NATIVE_RUNTIME_ASSET_SCHEMA = "paperclip.runtime-asset.v1" as const;
|
||||
export const PAPERCLIP_EXECUTION_PROMPT_REVISION = "paperclip-execution.v7" as const;
|
||||
export const PAPERCLIP_EXECUTION_PROMPT = "You are running as a Paperclip agent. Complete the assigned task in the provided execution environment. Follow the attached agent instructions and use assigned skills and tools when relevant. Use Paperclip company tools for coordination, persistent teammates and assigned work. Before waiting for a child task, call set_dependencies with the existing and new blocker IDs; follow its returned guidance and end this turn with paperclip_block. When the user asks to connect a service, call connections_search before any service tool, even when that tool is already installed. Follow the returned instruction and wait for any required user choice before executing. For other tasks needing a service, use installed tools if available; otherwise use connections_search and follow its instruction. The request appears as a card in the task. Finish independent work before yielding for access; do not poll or request the same connection repeatedly. Paperclip will continue automatically with updated tools after resolution. After a decline, pursue alternatives unless the user explicitly asks to retry. Finish exactly once with `paperclip_finish` or `paperclip_block`." as const;
|
||||
export const PAPERCLIP_EXECUTION_PROMPT_REVISION = "paperclip-execution.v8" as const;
|
||||
export const PAPERCLIP_EXECUTION_PROMPT = "You are running as a Paperclip agent. Complete the assigned task in the provided execution environment. Follow the attached agent instructions and use assigned skills and tools when relevant. Use Paperclip company tools for coordination and persistent teammates. When the user assigns work or a revision to a teammate, use create_task with that agent's ID and keep implementation with them. Before finishing delegated work, review the latest child result and task state, including any pending feedback. When remaining work depends on an unfinished child, use set_dependencies with its ID and existing blocker IDs. Follow the returned readiness and guidance; block only for unfinished work. Finish independent work and release the workspace with paperclip_block while waiting. When the user asks to connect a service, call connections_search before any service tool, even when that tool is already installed. Follow the returned instruction and wait for any required user choice before executing. For other tasks needing a service, use installed tools if available; otherwise use connections_search and follow its instruction. The request appears as a card in the task. Finish independent work before yielding for access; do not poll or request the same connection repeatedly. Paperclip will continue automatically with updated tools after resolution. After a decline, pursue alternatives unless the user explicitly asks to retry. Finish exactly once with `paperclip_finish` or `paperclip_block`." as const;
|
||||
|
||||
export interface NativeRuntimeAssetReference {
|
||||
schema: typeof NATIVE_RUNTIME_ASSET_SCHEMA;
|
||||
|
||||
@@ -136,9 +136,24 @@ export const setDependenciesAction = {
|
||||
"maxItems": 200,
|
||||
"uniqueItems": true
|
||||
},
|
||||
"dependencyReadiness": {
|
||||
"type": "object",
|
||||
"description": "Readiness when this update was applied. A replay retains that snapshot; task state can change afterward.",
|
||||
"properties": {
|
||||
"isReady": { "type": "boolean" },
|
||||
"unresolvedTaskIds": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "minLength": 1 },
|
||||
"maxItems": 200,
|
||||
"uniqueItems": true
|
||||
}
|
||||
},
|
||||
"required": ["isReady", "unresolvedTaskIds"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"guidance": {
|
||||
"type": "string",
|
||||
"description": "Conditional next steps after recording dependencies."
|
||||
"description": "Next steps for the recorded readiness snapshot."
|
||||
},
|
||||
"scheduledWakeIds": {
|
||||
"type": "array",
|
||||
|
||||
@@ -23,7 +23,7 @@ export function nativeToolContractFingerprintForTarget(
|
||||
return `sha256:${createHash("sha256")
|
||||
.update(
|
||||
JSON.stringify({
|
||||
schema: "paperclip.native-tool-contract.v15",
|
||||
schema: "paperclip.native-tool-contract.v16",
|
||||
executionTargetKind,
|
||||
advertisementPolicy: {
|
||||
// Direct provider threads retain declarations from thread/start.
|
||||
@@ -37,7 +37,7 @@ export function nativeToolContractFingerprintForTarget(
|
||||
structuredHumanInput:
|
||||
"always_advertised_run_issue_agent_binding_gated_current_task_description.v2",
|
||||
semanticCompletion: "finish_accessible_deliverable_evidence.v4",
|
||||
nativeProcedures: "hiring_delegation_and_dependency_result_guidance.v1",
|
||||
nativeProcedures: "hiring_delegation_and_dependency_readiness_guidance.v2",
|
||||
connectorTools: "assigned_resources_and_pinned_skill_bundle.v1",
|
||||
...(executionTargetKind === "remote"
|
||||
? { assignedMcpTools: "codex_server_gateway_prp_relay.v1" }
|
||||
|
||||
@@ -1043,7 +1043,10 @@ describe("PaperclipRunnerToolAuthority", () => {
|
||||
blockedByTaskIds: [prerequisiteId],
|
||||
},
|
||||
});
|
||||
expect(dependencyReceipt).toMatchObject({ guidance: expect.stringContaining("If remaining work depends on an unfinished child") });
|
||||
expect(dependencyReceipt).toMatchObject({
|
||||
dependencyReadiness: { isReady: false, unresolvedTaskIds: [prerequisiteId] },
|
||||
guidance: expect.stringContaining("Recorded dependencies are unfinished"),
|
||||
});
|
||||
expect(dependencyReceipt).toMatchObject({ guidance: expect.stringContaining("do not sleep or poll") });
|
||||
await expect(authority.execute({
|
||||
tool: "set_dependencies", callId: "wait-for-prerequisite-replay",
|
||||
@@ -1059,6 +1062,31 @@ describe("PaperclipRunnerToolAuthority", () => {
|
||||
status: "done",
|
||||
actorAgentId: agentId,
|
||||
});
|
||||
// A child can finish before the parent records its dependency. The tool
|
||||
// must expose that fact instead of telling the parent to wait for a wake
|
||||
// that the completed child will never produce.
|
||||
const readyReceipt = await authority.execute({
|
||||
tool: "set_dependencies", callId: "observe-finished-prerequisite",
|
||||
arguments: { idempotencyKey: "observe-finished-prerequisite", blockedByTaskIds: [prerequisiteId] },
|
||||
});
|
||||
expect(readyReceipt).toMatchObject({
|
||||
dependencyReadiness: { isReady: true, unresolvedTaskIds: [] },
|
||||
scheduledWakeIds: [],
|
||||
guidance: expect.stringContaining("do not block waiting for these completed tasks"),
|
||||
});
|
||||
await expect(authority.execute({
|
||||
tool: "set_dependencies", callId: "old-wait-replay-after-completion",
|
||||
arguments: { idempotencyKey: "source-waits-for-prerequisite", blockedByTaskIds: [prerequisiteId] },
|
||||
})).resolves.toEqual(dependencyReceipt);
|
||||
const dependentId = (dependent as { task: { id: string } }).task.id;
|
||||
await issueService(db).update(dependentId, { status: "cancelled", actorAgentId: agentId });
|
||||
await expect(authority.execute({
|
||||
tool: "set_dependencies", callId: "mixed-complete-and-cancelled",
|
||||
arguments: { idempotencyKey: "mixed-complete-and-cancelled", blockedByTaskIds: [prerequisiteId, dependentId] },
|
||||
})).resolves.toMatchObject({
|
||||
dependencyReadiness: { isReady: false, unresolvedTaskIds: [dependentId] },
|
||||
guidance: expect.stringContaining("Recorded dependencies are unfinished"),
|
||||
});
|
||||
await expect(
|
||||
authority.execute({
|
||||
tool: "create_task",
|
||||
@@ -1081,6 +1109,7 @@ describe("PaperclipRunnerToolAuthority", () => {
|
||||
arguments: { idempotencyKey: "clear-finished-prerequisite", blockedByTaskIds: [] },
|
||||
});
|
||||
expect(cleared).not.toHaveProperty("guidance");
|
||||
expect(cleared).toMatchObject({ dependencyReadiness: { isReady: true, unresolvedTaskIds: [] } });
|
||||
await expect(issueService(db).getRelationSummaries(issueId)).resolves.toMatchObject({ blockedBy: [] });
|
||||
|
||||
const nextRunId = "00000000-0000-4000-8000-000000000106";
|
||||
|
||||
@@ -1333,14 +1333,21 @@ export class PaperclipRunnerToolAuthority {
|
||||
actorAgentId: this.binding.agentId,
|
||||
}, tx);
|
||||
if (!updated) throw new Error("paperclip_runner_task_not_found");
|
||||
const readiness = await issueService(tx).getDependencyReadiness(updated.id, tx);
|
||||
return {
|
||||
commandId: `set-dependencies:${updated.id}:${updated.statusVersion}`,
|
||||
disposition: "applied",
|
||||
stateRevision: updated.statusVersion,
|
||||
entityRefs: [updated.id, ...blockedByIssueIds],
|
||||
scheduledWakeIds: [],
|
||||
dependencyReadiness: {
|
||||
isReady: readiness.isDependencyReady,
|
||||
unresolvedTaskIds: readiness.unresolvedBlockerIssueIds,
|
||||
},
|
||||
...(blockedByIssueIds.length > 0 ? {
|
||||
guidance: "If remaining work depends on an unfinished child, complete independent work, then call paperclip_block with the child agent as owner and child completion as the unblock action. End the turn to release the workspace; do not sleep or poll for the child. Paperclip resumes the parent when the dependency completes. If no work remains blocked, continue normally.",
|
||||
guidance: readiness.isDependencyReady
|
||||
? "All recorded dependencies are complete and their workspaces are finalized at this update. Review the latest results and continue; do not block waiting for these completed tasks. If more teammate work is required, create a revision task with create_task and record its dependency. A comment on a completed task is not a replacement for assigning new work."
|
||||
: "Recorded dependencies are unfinished at this update. Complete independent work, then call paperclip_block with the child agent as owner and child completion as the unblock action. End the turn to release the workspace; do not sleep or poll. Check current task state before blocking if a result has arrived. Paperclip resumes the parent when dependencies complete; review the latest results and pending feedback before finishing.",
|
||||
} : {}),
|
||||
};
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user