pi-mono/packages/coding-agent/test/suite/regressions
robopipi[bot] 6fed3cfb99
fix(coding-agent): let the SDK stream resolve auth for summaries (#11556)
In sessions created by `createAgentSession`, compaction, branch
summaries and bug-report summaries resolved the stored OAuth credential
in `AgentSession._getSummarizationRequestAuth`, then passed the access
token on as `options.apiKey`. The SDK's stream function calls
`modelRuntime.streamSimple`, which resolves auth again. Because it was
given an explicit `apiKey`, `resolveProviderAuth` took the API-key
override branch instead of using stored OAuth. Built-in providers accept
the token either way. A provider whose API-key path differs from its
OAuth path, such as one that refuses explicit keys, failed every summary
while normal prompts worked.

`createAgentSession` now marks its stream function with
`markRuntimeStreamFunction`. This records it in a module-level `WeakMap`
keyed by the function, mapped to its `ModelRuntime`.
`_getSummarizationRequestAuth` skips pre-resolution when the agent's
stream function is marked for the session's own runtime, so that runtime
resolves auth once, as it does for normal prompts. The check runs after
virtual-model routing. Bare `streamSimple` and custom `streamFn`s still
receive resolved credentials, so the fixes for #6324 and #7579 are
unchanged. If a caller replaces `agent.streamFunction`, the old behavior
applies.

**Testing**
- Added `test/suite/regressions/11520-sdk-summary-oauth-auth.test.ts`.
It builds an SDK session on a provider that has stored OAuth and also an
API-key method, runs a branch summary, and asserts two things: no
`getAuth` call carries an `apiKey` override, and the provider receives
the OAuth access token. It fails without the change and passes with it.
- `npm run check` passes and `./test.sh` passes. I also ran the related
tests: 6324 branch-summary auth, compaction model overrides,
auto-compaction cancellation, SDK stream options, virtual models, and
the compaction and branch-summary tests.
- Manual reproduction: an SDK script with an `openai` OAuth credential
that logs `ModelRuntime.getAuth` during `navigateTree(..., { summarize:
true })`. Before the change there were two calls, the second with
`apiKey = <oauth token>`. After the change there is one call, with no
override.

Fixes #11520

Requested by @badlogic

Co-authored-by: triagent <triagent@localhost>
2026-10-29 09:24:53 +01:00
..
1717-2113-agent-session-event-settlement.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
2023-queued-slash-command-followup.test.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
2753-reload-stale-resource-settings.test.ts feat(coding-agent): replace model registry with model runtime 2026-07-14 17:48:45 +02:00
2781-skill-collision-precedence.test.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
2791-fswatch-error-crash.test.ts fix(coding-agent): update repository links to "earendil-works/pi" (#9278) 2026-09-07 14:09:39 +02:00
2835-tools-allowlist-filters-extension-tools.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
2860-replaced-session-context.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
3217-scoped-model-order.test.ts feat(coding-agent): show model names in model selectors when they add information 2026-10-23 21:19:51 +02:00
3302-find-path-glob.test.ts fix(coding-agent): update repository links to "earendil-works/pi" (#9278) 2026-09-07 14:09:39 +02:00
3303-find-nested-gitignore.test.ts fix(coding-agent): update repository links to "earendil-works/pi" (#9278) 2026-09-07 14:09:39 +02:00
3317-network-connection-lost-retry.test.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
3592-no-builtin-tools-keeps-extension-tools.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
3616-settings-inmemory-reload.test.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
3686-session-name-event.test.ts fix(coding-agent): emit session name changes to extensions 2026-06-30 00:40:15 -05:00
3688-tree-cancel-compacting.test.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
3982-message-end-cost-override.test.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
4167-thinking-toggle-pending-tool-render.test.ts feat(tui,coding-agent): report program status via OSC 7501 2026-10-07 19:05:41 +00:00
5080-signal-shutdown-extension-cleanup.test.ts fix(coding-agent): do not report dead terminal stdin errors as crashes 2026-10-05 00:41:56 +02:00
5109-exclude-tools.test.ts fix(coding-agent): keep MCP tools with --tools, add tool patterns and --no-mcp 2026-10-05 17:21:55 +02:00
5208-late-bash-output.test.ts fix: drain stdout before resolving when a child holds the pipe past exit (#5753) 2026-06-15 09:55:45 +02:00
5217-compaction-reason.test.ts feat(coding-agent): add compaction reason and willRetry to extension compact events (#5962) 2026-06-22 10:36:16 +02:00
5303-bash-output-truncation.test.ts fix(coding-agent): make child output test deterministic 2026-08-01 21:26:55 +03:00
5433-extension-oauth-prompt-input.test.ts fix(coding-agent): strip fake cursor markers in OAuth prompt regression test 2026-10-08 09:54:07 +02:00
5596-missing-theme-export.test.ts fix(agent): restore streamFn extension compatibility 2026-07-21 18:37:07 +02:00
5661-uppercase-header-values.test.ts feat(coding-agent): replace model registry with model runtime 2026-07-14 17:48:45 +02:00
5724-sigterm-signal-exit.test.ts feat(coding-agent): add automatic theme mode (#5874) 2026-06-18 17:13:47 +02:00
5868-rpc-unknown-command-id.test.ts fix(coding-agent): include RPC request id on unknown commands 2026-06-18 10:44:59 +02:00
5943-session-start-notify.test.ts feat(tui,coding-agent): report program status via OSC 7501 2026-10-07 19:05:41 +00:00
5996-session-name-newlines.test.ts fix(coding-agent): normalize session names 2026-06-23 19:14:02 +08:00
5998-blocked-tool-terminate.test.ts feat(agent): allow blocked tool calls to terminate (#7715) 2026-08-06 17:14:48 +02:00
6019-explicit-provider-retry-message.test.ts fix(coding-agent): retry explicit provider retry errors 2026-06-24 18:14:06 +02:00
6104-find-root-relativization.test.ts fix(coding-agent): normalize find root results (#7569) 2026-08-04 00:05:48 +02:00
6162-extension-active-tools-next-turn.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
6260-inline-extension-naming.test.ts feat(coding-agent): add llama.cpp router integration 2026-07-17 16:25:00 +02:00
6324-branch-summary-ambient-auth.test.ts fix(agent): decouple agent streams from compat 2026-07-20 17:54:36 +02:00
6363-agent-settled-event.test.ts feat(tui,coding-agent): report program status via OSC 7501 2026-10-07 19:05:41 +00:00
6596-taskkill-enoent.test.ts fix(coding-agent): resolve Windows shells from installation directories 2026-10-19 21:55:12 +02:00
6647-compaction-retries-transient-stream-drop.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
6768-copilot-compaction-base-url.test.ts fix(coding-agent): preserve Copilot summary endpoint 2026-08-04 11:00:30 +02:00
6904-dns-transport-retry.test.ts fix(ai): retry DNS transport failures (#6946) 2026-07-22 11:26:19 +02:00
6949-unavailable-scoped-model.test.ts feat(coding-agent): adjust TUI selections in thinking-mode, models and scoped models (#8900) 2026-09-01 11:02:53 +02:00
6999-models-json-hot-reload.test.ts fix(coding-agent): keep model and thinking level changes session scoped (#8356) 2026-08-19 16:48:29 +02:00
7027-credential-refresh-hang.test.ts feat(coding-agent): remove daxnuts easter egg 2026-10-02 09:50:04 +02:00
7048-compaction-truncated-summary.test.ts fix(coding-agent): reject truncated compaction summaries closes #7048 2026-08-24 13:08:30 +02:00
7150-rpc-prompt-during-compaction.test.ts feat(coding-agent): report prompt disposition in RPC responses 2026-09-25 14:53:11 +02:00
7153-scoped-models-refresh.test.ts fix(coding-agent): share concurrent model catalog refreshes 2026-08-13 09:43:36 +02:00
7187-malformed-package-manifest.test.ts fix(coding-agent): validate package manifests 2026-07-30 22:43:22 +02:00
7193-event-bus-lifecycle.test.ts event bus leak fix (#7656) 2026-08-05 22:23:44 +02:00
7209-model-selector-filter-resets-selection.test.ts feat(coding-agent): show model names in model selectors when they add information 2026-10-23 21:19:51 +02:00
7253-manual-compact-during-response.test.ts fix(coding-agent): compact before post-tool model requests (#8782) 2026-08-28 13:40:59 +02:00
7269-cli-end-of-options.test.ts fix(coding-agent): support -- end-of-options, closes #7269 2026-08-22 23:16:40 +02:00
7290-json-stream-linear.test.ts fix(coding-agent): make JSON streaming output linear (#7394) 2026-08-03 18:33:22 +02:00
7301-stalled-availability-refresh.test.ts fix(coding-agent): make model refresh cancellation caller-owned 2026-08-04 00:03:52 +02:00
7443-model-command-cached-match.test.ts fix(coding-agent): make model refresh cancellation caller-owned 2026-08-04 00:03:52 +02:00
7497-session-discovery-symlink.test.ts fix(coding-agent): discover sessions through symlinked directories (#7552) 2026-08-03 18:34:12 +02:00
7572-provider-retry-settings-merge.test.ts fix(coding-agent): recursively merge nested settings, closes #7572 2026-08-04 13:04:02 +02:00
7731-tui-method-wrapping.test.ts fix(coding-agent): preserve TUI wrapper routing (closes #7731) 2026-08-07 00:40:44 +02:00
7829-invalid-settings-warning.test.ts fix(coding-agent): show startup diagnostics in TUI 2026-08-19 13:07:57 +02:00
7911-json-stream-usage.test.ts fix(coding-agent): preserve usage in streaming events (#7982) 2026-08-13 00:32:26 +03:00
7925-toolcall-start-metadata.test.ts fix(coding-agent): expose tool metadata at stream start (#7953) 2026-08-19 12:24:30 +02:00
8237-node-sea-extension-loading.test.ts feat(coding-agent): defer extension loader dependencies 2026-09-19 23:25:47 +02:00
8261-subagent-project-trust.test.ts fix(coding-agent): skip trusted subagent prompts 2026-08-18 09:26:07 +02:00
8328-zero-usage-auto-compaction.test.ts fix(coding-agent): compact without provider usage 2026-08-19 13:44:22 +02:00
8337-utf8-bom-parsing.test.ts fix(coding-agent): normalize UTF-8 BOMs in text inputs 2026-08-19 14:11:02 +02:00
8423-extension-factory-failure.test.ts fix(coding-agent): discard failed extension factory state (#8424) 2026-08-23 12:39:42 +02:00
8537-custom-message-tool-result-ordering.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
8611-thinking-toggle-pending-bash-output.test.ts fix(coding-agent): preserve partial Bash output when toggling thinking 2026-08-26 14:27:21 +02:00
8724-in-memory-fork-active-tool.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
8935-parallel-preflight-abort.test.ts fix(agent): stop prepared tools after preflight abort (#8936) 2026-09-01 11:00:51 +02:00
8964-extension-provider-streaming.test.ts fix(coding-agent): allow extensions to stream from custom providers (#9272) 2026-09-07 12:16:12 +02:00
8989-fork-compaction-label-boundary.test.ts fix(coding-agent): preserve compaction boundary when forking (#8990) 2026-09-03 10:47:40 +02:00
9068-user-bash-fail-closed.test.ts fix(coding-agent): fail closed on user bash hook errors (#9662) 2026-09-16 17:21:17 +01:00
9178-tree-during-compaction.test.ts fix(coding-agent): reject tree navigation during compaction (#9179) 2026-09-07 10:32:10 +02:00
9340-9777-auto-compaction-cancellation.test.ts fix(coding-agent): close compaction cancellation races 2026-09-19 19:18:18 +02:00
9540-extension-loader-lazy.test.ts feat(coding-agent): defer extension loader dependencies 2026-09-19 23:25:47 +02:00
9789-context-handler-system-messages.test.ts fix(coding-agent): keep prompt and tool state across context handlers (#9846) 2026-09-21 17:14:22 +02:00
10285-mcp-tool-renderers.test.ts fix(coding-agent): render MCP tool calls before their server connects 2026-10-03 13:54:18 +02:00
11156-pi-ai-models-virtual-module.test.ts fix(coding-agent): expose @earendil-works/pi-ai/models in the extension loader 2026-10-20 21:47:52 +02:00
11227-recovery-omits-tool-results.test.ts fix(coding-agent): recovery omits tool results with the truncated tool call 2026-10-21 22:44:44 +02:00
11520-sdk-summary-oauth-auth.test.ts fix(coding-agent): let the SDK stream resolve auth for summaries (#11556) 2026-10-29 09:24:53 +01:00
copilot-request-size-overflow.test.ts fix(ai): recover from Copilot request-size overflow 2026-10-19 22:46:26 +02:00
extension-factory-cache.test.ts fix(coding-agent): cache extension imports for session switches 2026-06-20 21:07:45 +02:00
pre-prompt-compaction-no-continue.test.ts fix(coding-agent): avoid pre-prompt compaction continue 2026-06-25 21:43:03 +08:00
startup-session-rebind-duplicate-subscription.test.ts feat(tui,coding-agent): report program status via OSC 7501 2026-10-07 19:05:41 +00:00
tree-during-streaming.test.ts ***WIP it's a PoC *** fix(coding-agent): guard tree navigation during responses (#7022) 2026-07-28 14:46:30 +02:00