Skip to content

Commit 343aadd

Browse files
Describe ctx.session by how it behaves, not by what it lacks
The context session is a full CopilotSession, so factory.run and factory.resume are present and callable. Saying the APIs are absent contradicted the exported type. The guide and the published comment now say the session refuses those calls. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5ece6b29-8b10-47aa-ab17-b64c47f5fdcd
1 parent dde6cf6 commit 343aadd

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

nodejs/docs/factories.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The `run()` context provides:
6161
- `ctx.step(key, producer, options?)`: Journals the producer's JSON result under a stable key so a resume replays it without re-running the producer. A journaled (default) producer must return a JSON-serializable value; `undefined` or a non-JSON value is rejected. Pass `{ volatile: true }` to bypass the journal and run the producer every time.
6262

6363
The key is the *sole* identity: neither the producer body nor its inputs contribute to it. A resume replays the cached value for a matching key even if the producer has since changed, so version the key (`"scan-v2"`) whenever its inputs or meaning change. Journaled producers are best-effort at-least-once and may run again across crashes or concurrent same-key callers, so keep side effects idempotent.
64-
- `ctx.session`: The session returned by `joinSession`, without the APIs that start and resume factory runs. Call `extensions_manage` with `operation: "guide"` to read more about the session APIs.
64+
- `ctx.session`: The session returned by `joinSession`. It refuses calls that start or resume a factory run. Call `extensions_manage` with `operation: "guide"` to read more about the session APIs.
6565
- `ctx.signal`: Cooperative cancellation signal for extension work and subprocesses.
6666
- `ctx.factory(...)`: Always rejects because nested factories are not supported.
6767

nodejs/src/factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ export interface FactoryContext<TArgs extends JsonValue = JsonValue> {
175175
/** Caller-supplied input, forwarded verbatim. */
176176
args: TArgs;
177177
/**
178-
* The session instance returned by `joinSession`, without the APIs that
179-
* start and resume factory runs.
178+
* The session instance returned by `joinSession`. It refuses calls that
179+
* start or resume a factory run.
180180
*/
181181
session: CopilotSession;
182182
/** Cooperative cancellation signal for the current factory run. */

nodejs/test/factory.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ describe("factories", () => {
446446
"Options are exactly `label`, `schema`, `model`, `agent`, `reasoningEffort`, and `contextTier`"
447447
);
448448
expect(normalizedGuide).toContain(
449-
"session returned by `joinSession`, without the APIs that start and resume factory runs"
449+
"session returned by `joinSession`. It refuses calls that start or resume a factory run"
450450
);
451451

452452
expect(normalizedPublicApi).toContain("SDK-initiated runs do not request permission");
@@ -457,7 +457,7 @@ describe("factories", () => {
457457
expect(normalizedPublicApi).toContain("SDK-initiated resumes do not request permission");
458458
expect(normalizedPublicApi).toContain("with a documented resume code rejects with");
459459
expect(normalizedPublicApi).toContain(
460-
"session instance returned by `joinSession`, without the APIs that start and resume factory runs"
460+
"session instance returned by `joinSession`. It refuses calls that start or resume a factory run"
461461
);
462462
});
463463

0 commit comments

Comments
 (0)