Skip to content

sync: upstream v0.83.0 - #550

Open
code-yeongyu wants to merge 95 commits into
mainfrom
automation/upstream-v0.83.0-30571177813
Open

sync: upstream v0.83.0#550
code-yeongyu wants to merge 95 commits into
mainfrom
automation/upstream-v0.83.0-30571177813

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Automated upstream sync for v0.83.0.

  • Upstream SHA: b889a0ce3dc08e20078b822c5380f71c4fdec6cf
  • Evidence artifact: upstream-agent-qa-v0.83.0
  • Release is evaluated only after this PR is merged with a merge commit.

QA completed before PR creation:

  • npm run build
  • npm run check
  • npm test
  • senpi-qa common, mock-loop, CLI smoke, and tmux TUI smoke when available

Summary by cubic

Sync to upstream v0.83.0. Adds AgentHarness shutdown, per-request fetch injection and pending stop reasons in streams, OpenRouter OAuth manual fallback, an alternate-screen TUI, and multiple provider/model fixes and docs.

  • New Features

    • agent: AgentHarness shutdown lifecycle to abort active work and drain queues.
    • ai: Per-request fetch for supported providers (text and images); Google adapters reject non-global fetch.
    • ai: Streaming now starts with stopReason: "pending" and adapters error if no terminal stop reason is seen.
    • ai: Preserves raw provider stop reasons across Anthropic, OpenAI, Google, Mistral, Bedrock.
    • ai: GitHub Copilot claude-opus-5 via Anthropic with minimal→low thinking, 1M context; Qwen token plan thinking controls; Z.AI sends max_tokens; pricing updates; OpenCode Go name fix; Bedrock prefers configured profile over ambient AWS keys.
    • coding-agent: Alternate-screen TUI (--alt) with scrolling and keybindings; /list-tips and risk warnings; proactive compaction; credential printing (pi auth print-api-key / print-bearer-token); exposes ctx.scopedModels to extensions; more robust session switching and bash cancellation.
    • Docs: New durable harness design (harness.md, harness-v2.md).
  • Migration

    • ai: TypeBox upgraded to 1.3.7; removed deprecated APIs (Type.Base, Type.Awaited, Type.Promise, Type.AsyncIterator, Type.Iterator, Type.Options, Value.Mutate). Update extensions using these.
    • ai: StreamOptions/ImagesOptions include optional fetch; Google adapters will throw if a custom fetch is provided.
    • ai and custom providers: Initialize partial messages with stopReason: "pending" and set a terminal reason before emitting done; error if a stream ends without one (docs updated).
    • coding-agent: Use --alt to opt into the alternate-screen TUI; inline image behavior varies by terminal (see docs).

Written for commit 302df8f. Summary will update on new commits.

Review in cubic

christianklotz and others added 30 commits July 25, 2026 23:09
Route claude-opus-5 through the Anthropic Messages API with adaptive
thinking, the Copilot minimal thinking-level override, and pin the
extended 1M context window alongside the other Copilot Opus models.
* feat(ai): expose pending streaming stop reason

Closes #7142

* manual tidy up of human facing copy
…(#7114)

The OpenRouter PKCE flow only completed through the loopback callback
server, so remote/headless sessions (e.g. pi over SSH) could never
finish login: the browser runs on another machine and cannot reach
127.0.0.1 on the host running pi.

Race the callback server against a manual_code prompt, matching the
existing Anthropic and OpenAI Codex flows. Users can paste the final
redirect URL (or the bare authorization code) and the flow exchanges
it with the same PKCE verifier. A claimed callback keeps priority so
a pasted code cannot interrupt an in-flight exchange.

The callback server object follows the OAuthServerInfo shape from the
OpenAI Codex flow: waitForCredential() resolves null when cancelWait()
hands the login over to manual entry, and close() is pure cleanup that
never settles the wait.

Refs #7078
feat(coding-agent): add extension creation eval
Full design for the durable, resumable harness: session log with harness
entries, SessionTree query contract, public API with result unions, watch()
snapshots, events/hooks catalogs, recovery procedures as code, forks,
storage backends, and telemetry integration.
Extensions have no way to read the session's scoped model set (the models
resolved from --models / enabledModels against the available catalogue --
the same list /scoped-models shows). The only model surfaces on
ExtensionContext are ctx.model (active) and ctx.modelRegistry.getAvailable()
(the whole catalogue, unfiltered), so an extension that wants a scoped
model picker must either enumerate everything or re-implement pi's scope
resolution (minimatch on provider/modelId / bare modelId + enabledModels +
--models) from disk -- duplicating core logic.

Add ctx.scopedModels: readonly ScopedModel[] to ExtensionContext, mirroring
how ctx.model is exposed (field -> bindCore -> lazy getter in createContext()).
Empty when no scoping is configured (all available models usable). Each entry
is { model, thinkingLevel? }.

- types.ts: ExtensionContext.scopedModels + ExtensionContextActions.getScopedModels
- runner.ts: field, bindCore wiring, lazy scopedModels getter
- agent-session.ts: provide getScopedModels: () => this._scopedModels
- test: assert ctx.scopedModels reflects the action (default [] + live ref)
- docs/extensions.md: document the new field

Co-authored-by: ngSoftware <alessandro@pungitore.ch>
Bedrock profile configured via pi's auth flow was ignored when ambient
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY were set, because pi forced
config.credentials from those keys and the SDK treats explicit
credentials as overriding config.profile.

Fixes #6957
…ome directory (#7167)

* fix(coding-agent): isolate autoload-disabled package test from real home directory

The test asserted result.skills is exactly empty, but resolve() also
scans ~/.agents/skills via getHomeDir(). On machines where that
directory is populated the test failed; CI runners have no
~/.agents/skills, so it always passed there. Stub HOME to the temp
dir with the same save/restore pattern used by neighbouring tests.

* fix(coding-agent): use vi.stubEnv for home directory isolation

Replaces the manual try/finally save/restore with vi.stubEnv plus
vi.unstubAllEnvs in afterEach, shrinking the fix to two added lines.

* fix(coding-agent): plant decoy user skill so the empty-skills assertion cannot pass vacuously

With an empty sandbox, result.skills equal to [] could not distinguish
the package skill being correctly excluded from skill resolution being
broken entirely. A decoy skill in the stubbed HOME's .agents/skills
proves scanning still works while the package skill stays excluded.

* fix(coding-agent): simplify home isolation test
* fix: rpc bash no longer bypass user_bash

* fix: rpc bash no longer bypass user_bash
christianklotz and others added 29 commits July 30, 2026 01:47
feat(coding-agent): add comparative Pi eval harness
New section 14: streamAssistant and the three-phase tool execution
blocks (prepare/execute/finalize) with durability callbacks, batch rules
(parallel vs sequential, length truncation, terminate), and the
unbreakable agent-loop.ts compatibility requirement with acceptance
criterion. Harness internals rewritten on top of the blocks: runToolBatch
with provisioned-id callbacks, reconciliation via phases 2+3, hook-to-
block wiring table. Auth surface removed from the stream block: Models
resolves auth per request; before_payload/after_response mount on
onPayload/onResponse. Sections 16-22 renumbered.
…-v0.83.0-30571177813

# Conflicts:
#	.pi/extensions/prompt-url-widget.ts
#	package-lock.json
#	packages/agent/CHANGELOG.md
#	packages/agent/package.json
#	packages/ai/CHANGELOG.md
#	packages/ai/package.json
#	packages/ai/src/api/anthropic-messages.ts
#	packages/ai/src/api/openai-completions.ts
#	packages/ai/src/api/openai-responses.ts
#	packages/ai/src/types.ts
#	packages/coding-agent/CHANGELOG.md
#	packages/coding-agent/README.md
#	packages/coding-agent/docs/session-format.md
#	packages/coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json
#	packages/coding-agent/examples/extensions/custom-provider-anthropic/package.json
#	packages/coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json
#	packages/coding-agent/examples/extensions/gondolin/package-lock.json
#	packages/coding-agent/examples/extensions/gondolin/package.json
#	packages/coding-agent/examples/extensions/sandbox/package-lock.json
#	packages/coding-agent/examples/extensions/sandbox/package.json
#	packages/coding-agent/examples/extensions/with-deps/package-lock.json
#	packages/coding-agent/examples/extensions/with-deps/package.json
#	packages/coding-agent/install-lock/package-lock.json
#	packages/coding-agent/install-lock/package.json
#	packages/coding-agent/npm-shrinkwrap.json
#	packages/coding-agent/package.json
#	packages/coding-agent/src/cli/args.ts
#	packages/coding-agent/src/cli/config-selector.ts
#	packages/coding-agent/src/cli/startup-ui.ts
#	packages/coding-agent/src/core/agent-session-runtime.ts
#	packages/coding-agent/src/core/agent-session.ts
#	packages/coding-agent/src/core/extensions/runner.ts
#	packages/coding-agent/src/core/extensions/types.ts
#	packages/coding-agent/src/core/resource-loader.ts
#	packages/coding-agent/src/main.ts
#	packages/coding-agent/src/modes/interactive/interactive-mode.ts
#	packages/coding-agent/src/modes/rpc/rpc-mode.ts
#	packages/coding-agent/test/extensions-runner.test.ts
#	packages/coding-agent/test/trigger-compact-extension.test.ts
#	packages/coding-agent/vitest.config.ts
#	packages/evals/package.json
#	packages/evals/src/pi-harness.ts
#	packages/server/CHANGELOG.md
#	packages/server/package.json
#	packages/storage/sqlite-node/CHANGELOG.md
#	packages/storage/sqlite-node/package.json
#	packages/tui/CHANGELOG.md
#	packages/tui/package.json
#	packages/tui/src/index.ts
#	packages/tui/src/terminal-image.ts
#	packages/tui/src/tui.ts
#	packages/tui/test/key-tester.ts
#	packages/tui/test/markdown.test.ts
#	packages/tui/test/terminal-image.test.ts
#	packages/tui/test/tui-render.test.ts
@code-yeongyu

Copy link
Copy Markdown
Owner Author

QA evidence

Evidence files captured before this PR was opened:

  • git-status-after-check.txt
  • git-status-before-qa.txt
  • last-merge-report.md
  • npm-build.txt
  • npm-check.txt
  • npm-test.txt
  • secret-files.txt
  • senpi-qa-cli-smoke.txt
  • senpi-qa-common.txt
  • senpi-qa-mock-loop.txt
  • senpi-qa-tui.txt
  • tool-versions.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.