Running from a linked worktree nested under its main repo loaded the
project's AGENTS.md/CLAUDE.md twice. The ancestor walk climbs from cwd to
the filesystem root, so it picked up the worktree's copy and then the main
repo's copy above it, even though both are the same tracked file.
The walk now drops that one duplicate: the main repo root's copy is skipped
when the worktree root has a context file of the same name. Nothing else
changes. The worktree still inherits the main repo's copy when it has none,
directories above the main repo keep loading, and ordinary repos, sibling
worktrees, submodules and bare layouts are untouched.
Bump TypeBox to 1.3.7 so compiled validators guard array-specific keywords when null is accepted, and cover tool-argument validation with a regression test.
Breaking for extensions: TypeBox 1.3 removes deprecated APIs including Type.Base, Type.Awaited, Type.Promise, Type.AsyncIterator, Type.Iterator, Type.Options, and Value.Mutate. Extensions using these through Pi's bundled TypeBox aliases must migrate to supported TypeBox APIs.
Fixes#7003
llama-server supports OpenAI-spec stream_options.include_usage since
b2b6b55a59 (Sep 2025); any server new enough for router mode sends the
final usage chunk when requested. With the flag hardcoded to false the
provider never requests it, so streamed responses record zero tokens
and session/context accounting stays empty.
Verified against llama-server b10094: with include_usage sent, the
final chunk carries usage (incl. prompt_tokens_details.cached_tokens);
without it, nothing.
* fix(coding-agent): guard tree navigation during responses
* fix(coding-agent): simplify tree navigation regression
* fix(coding-agent): abort active run on session replacement and tree navigation
Session replacement (resume, new, fork, import) now settles the active
response in teardownCurrent before disposing the outgoing session, so the
aborted turn and its tool results persist instead of leaving a dangling
tool call. Tree navigation aborts the active response directly once the
user commits, without a confirmation gate.
Typing a model name in the /model selector only clamped selectedIndex to
the filtered list length, leaving the highlight wherever it happened to
be instead of moving to the best match. Reset selectedIndex to 0 when a
non-empty query is present so the top row is highlighted in both the All
and Scoped tabs. Keep the clamp behavior when the query is cleared.
fixes#7209
* 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
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>
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
Add missing entries for the llama.cpp catalog cache and resource loader
directory fix, duplicate ai-side changes into coding-agent, add missing
external PR attributions, restore the 0.82.0 section that was modified
after release, and add the New Features section.