[Core] Add Factory Pause Checkpoints - #2537
Conversation
This comment has been minimized.
This comment has been minimized.
2dc7880 to
71666ea
Compare
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
71666ea to
295bd38
Compare
Cross-SDK Consistency Review — PR #2537Scope of changes: This PR touches only
Findings:
Conclusion: No inline comments needed — this PR maintains consistency with the current (Node-only) state of the experimental Agent Factories feature. No action required for other SDKs at this time.
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Public factory documentation remains inconsistent with resumable paused runs, and one new error message is malformed.
Get a fresh assessment by requesting another Copilot review.
Review tier: Balanced
Findings: 2
Open findings (2)
What changed in this PR
Adds Node.js factory pause checkpoints, resumable pause semantics, token-scoped cancellation, and nullable invocation-limit overrides.
Changes:
- Adds public and contextual pause APIs.
- Scopes aborts to execution tokens.
- Adds pause, resume-limit, and cancellation tests.
| File | Description |
|---|---|
nodejs/src/session.ts |
Implements pause checkpoints and token-scoped aborts. |
nodejs/src/factory.ts |
Defines pause and limit-override APIs. |
nodejs/src/index.ts |
Exports the limit-override type. |
nodejs/test/factory.test.ts |
Tests pause, resume, and abort behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| /** Pause a running factory and return its settled envelope. */ | ||
| pause(runId: string): Promise<FactoryRunResult>; |
| if (factoryExecutionStore.getStore()?.active) { | ||
| throw new Error( | ||
| "factory.run and factory.resume are not allowed while a factory body is running on this call path." | ||
| "factory.run and factory.resume, and factory.pause are not allowed while a factory body is running on this call path." |

What
Adds token-scoped factory pause and durable checkpoint APIs to the Node.js SDK after the runtime contract lands. A paused attempt settles its waiter while resume preserves invocation limit overrides and execution identity.
Why
Factory authors need a safe checkpoint that stops spend without losing completed work. Token-scoped aborts stop an old attempt from cancelling a resumed attempt with the same run ID.