Repository navigation
[pull] main from can1357:main - #82
Merged
Merged
Conversation
`anthropic/claude-fable-5-1` reported cache reads at $1.00/MTok. Anthropic prices them at $0.25/MTok, 0.025x its $10 input, a 75% cut from Fable 5: https://www.anthropic.com/claude/fable https://www.anthropic.com/claude-fable-and-mythos-5-1 `classes/anthropic.kdl` pins Fable pricing for the whole family because Anthropic's `/v1/models` omits pricing and limits for that generation. The patch predates Fable 5.1, so the 5.1 revision inherited Fable 5's pre-cut cache-read rate, and being a compat patch it overrode the correct value the upstream catalog already served. Narrow it with a revision-scoped patch, following the existing `family "opus" { revision "=4.5" }` precedent in the same block. `cost-patch` is an object axis, so the winning rule supplies the whole payload rather than merging over the family patch; input, output, and cache-write are restated so a discovery-sourced 5.1 row still gets them. An exact revision match avoids asserting a rate for unreleased Fable revisions, and `limits-patch` is a separate axis that still inherits. `getProviderModels` consumes `models.json` verbatim and never reruns `buildModel`, so the rule change alone would not reach an offline or static startup. Correct the bundled row too. A full `gen:models` run reproduces the same value but rewrites ~24k unrelated lines of upstream drift, so the row is corrected in place, as in cb5db8d. Regression coverage is split to match: synthetic-spec assertions cover the rule independently of the generated JSON, per AGENTS.md, and a separate case pins what the bundled row actually ships. Each half fails on its own if the other is reverted.
A malformed advisor entry must not disable the valid advisors in the same WATCHDOG.yml file or make the configuration editor appear empty. Validate each entry independently and report the skipped entry by name or position. Unparseable YAML and non-mapping documents still produce file-level warnings. Use the same validation for discovery and editing. Retain startup warnings until the interactive UI is ready, and show the active file's warnings inside the editor, including after project/user scope changes. Saving writes only valid entries and clears the resolved load warnings.
…read opens Coordinator discards stream sessions whose finalized arguments no longer match the streamed plan (new matchesFinalArgs predicate, implemented by the eval shadow cell), instead of retaining them by ID and releasing stale deferred work. Speculative reads open the authorized resolved target again but render the requested lexical path (threaded renderAbsolutePath), so committed output matches an ordinary read while a swapped symlink can no longer redirect the open. Host authorization additionally declines video targets, whose frame pipeline has no lexical render path.
… reads The JS projector now requires the runtime's bridge-dispatcher identity flag before admitting tool.read, and refuses template/plus projections that may coerce arrays or opaque values unless Array.prototype.join and Object.prototype.toString both report intact. The runtime captures the installed dispatcher and the pristine toString, reports both in the snapshot identity flags (covered by the snapshot digest), and the snapshot shape test pins the extended key set.
Wnmitch/spec followup nits
`createMCPToolName` joins the sanitized server and tool with a SINGLE underscore (`mcp__<server>_<tool>`), but the harness identifies itself to the model as Claude Code, whose convention is `mcp__<server>__<tool>`. A primed model therefore emits the doubled separator, often keeping the raw unsanitized server spelling too — `mcp__seedpatch-client__bank` for a server named `seedpatch-client`. Strict exact-match dispatch answered every one of those with `Tool ... not found` for a tool the session really does expose. Both lookup paths now retry once under a canonical key derived by re-running the minting sanitizer over the emitted name. The sanitizer is idempotent and registry keys are already in its output form, so a registered name still matches directly, two distinct keys can never collapse together, and dispatch stays exact-match instead of guessing a neighbour. Separately, `Tool <name> not found` now also names mounted `xd://` devices. A device is routable through `resolveFallbackTool` yet appears in no advertised name, so a mis-transcribed device call was the one miss with nothing to suggest even though the capability was live. Hosts pass the candidates via the new `suggestFallbackToolNames` option, read only after a call has missed; the suggestion stays advisory, never a dispatch target. Refs #11516, #10109
Review follow-ups on the Claude Code separator recovery. `canonicalizeMCPToolName` only re-ran the sanitizer, which loses two things `createMCPToolName` does. It dropped redundant-server-prefix stripping, so server `puppeteer` + tool `puppeteer_screenshot` (registered `mcp__puppeteer_screenshot`) normalized to the nonexistent `mcp__puppeteer_puppeteer_screenshot`; and it dropped `capMCPToolNameLength`, so any name over 64 chars could never match its hashed key. Replaced with `canonicalMCPToolNameCandidates`, which splits at the first `__` — a sanitized server segment never contains one, so that is exactly where the Claude Code spelling put the boundary — and re-mints through the whole of `createMCPToolName`, keeping the sanitize-only form as a second candidate for single-separator spellings. Both halves must survive sanitization first, otherwise the placeholder fallbacks would mint a key nobody registered (`mcp____` previously yielded `mcp__tool`). The device fallback also only accepted mounted names. With `tools.xdev` off, or for an explicitly requested MCP tool, the tool stays top-level and never enters `mountedNames`, so the misspelled call missed the advertised set and then missed the fallback too — the doubled separator stayed unrecoverable in the default configuration. `resolveFallbackXdevTool` now gates candidates on `resolveXdevTool` (mounted OR active). This cannot reach a tool the model was never offered: only `mcp__`-prefixed names produce candidates, so first-party names have no path through it, pinned by a test asserting active `edit`/`read` stay refused. `resolveMountedXdevTool` goes back to presentation-only and `resolveMountedXdevExecutable` is replaced by `resolveFallbackXdevExecutable`, with its one caller migrated. Changelog entries trimmed to one user-facing line per AGENTS.md, and the coding-agent entry gains the missing #11516 link.
…ndidates Second review round. The device fallback was the only place a Claude Code MCP spelling was recovered, and it bailed before reaching that logic when `toolSession.xdev` was absent. `createTools` allocates that state only when `tools.xdev` is on AND the session is unrestricted, so with the setting off an advertised MCP tool still dead-ended — the very configuration the last round claimed to fix. `resolveDeviceTool` now falls through to matching canonical candidates against `agent.state.tools`: the set actually advertised to this caller, already execution-wrapped by `#applyActiveToolsByName`, so a deselected, `defaultInactive` or hidden tool stays unreachable and no ACP permission wrapper is bypassed. The auto-learn capture agent advertises only `learn`/`manage_skill`, so it gains no MCP surface, and only `mcp__` names yield candidates so no first-party tool is reachable this way. The single-separator candidate also skipped `capMCPToolNameLength`. With no `__` boundary there is nothing to re-mint, but the registered key was still length-capped, so an overlong spelling such as `mcp__seedpatch-client_<long-tool>` could never match its hashed form. That candidate is now capped directly. The previous round's test fabricated an `XdevState`, which is exactly why it missed the gap above. Added a test that drives a real `createAgentSession` with `tools.xdev` disabled, refreshes an advertised MCP tool, and asserts a `mcp__seedpatch-client__bank` call executes. Verified it fails with only `sdk.ts` reverted.
… export Third review round, both P2. The candidate split assumed the first `__` after the prefix separates server from tool. That holds for a *sanitized* server segment, which can never contain `__`, but the model routinely emits the RAW server name, which can: server `foo__bar` with tool `foo_bar_baz` registers as `mcp__foo_bar_baz` after redundant-prefix stripping, while `mcp__foo__bar__foo_bar_baz` split at the first boundary only produced `mcp__foo_bar_foo_bar_baz`. Every `__` is now tried as the boundary, earliest first since a server name without one is overwhelmingly the common case. Each candidate remains an exact registry lookup, so extra boundaries can only turn a miss into a hit on a genuinely registered key. `resolveMountedXdevExecutable` is restored. `./tools/*` is a published subpath export, so removing it breaks external consumers importing `@oh-my-pi/pi-coding-agent/tools/xdev`. It is not kept as a compatibility alias: it retains its original mounted-only semantics as the decorated sibling of `resolveMountedXdevTool`, which is a coherent pair distinct from the wider fallback pair used by dispatch. Aliasing it to the new resolver would have been worse than deleting it, silently widening what existing callers resolve. The ACP permission test goes back to it, since that test is specifically about mounted tools.
The alias branch read `agent.state.tools` — the PRIMARY agent's set — from a closure that `sdk.ts` also hands to the isolated auto-learn capture agent. That capture agent advertises only `learn`/`manage_skill`, so a capture response emitting the predictable doubled MCP spelling could resolve and execute a main-session MCP tool it was never offered, side effects included. The code comment claimed this was impossible because of the capture agent's narrow tool set; the comment reasoned about the right set while the code read the wrong one. Two changes: `resolveMCPToolAlias(name, advertised)` replaces the inline loop and takes the advertised set as a required argument instead of reading ambient state. The set a call must resolve against is the one offered to the agent that emitted it, so naming it at every call site makes the mix-up unrepresentable rather than merely documented. The capture agent now gets no fallback resolver at all. Both of its tools stay top-level and never mount as devices, so it has nothing legitimate to recover; this also closes the pre-existing path by which it could reach a mounted device. `suggestFallbackToolNames` goes with it — suggesting session devices to an agent that cannot call them only misleads it. A hallucinated call from the capture agent now correctly stays `not found`. The primary resolver keeps its behaviour and carries an explicit warning that it is bound to the primary agent and must not be shared.
Fifth review round, both P2, both cases of resolving against a set wider than what the model was actually offered. `resolveFallbackXdevTool` gated alias candidates on `resolveXdevTool`, which accepts mounted OR active names. Under Code Mode `#applyActiveToolsByName` clears the mounted set (session-tools.ts:914) but sets the active predicate to the whole enabled slate (:999), while only the direct partition is advertised (:954) — so the alias branch could dispatch an MCP tool deliberately demoted behind the eval bridge and bust that presentation boundary. The device fallback is now mounted-only; advertised top-level tools are recovered by `sdk.ts` against its own agent's set, which already covers the `tools.xdev`-off and explicitly-requested cases. `resolveMCPToolAlias` returned the first matching candidate. Two boundaries can both name a registered tool — server `foo` + tool `bar__foo_bar_baz` mints `mcp__foo_bar_foo_bar_baz` and server `foo__bar` + tool `foo_bar_baz` mints `mcp__foo_bar_baz`, and both answer the spelling `mcp__foo__bar__foo_bar_baz`. Nothing in the emitted name says which was meant, and MCP tools have side effects, so a unique match is now required and an ambiguous alias stays a recoverable `not found`. Both resolution sites share that rule, since the device path now routes through the same helper. The test pinning active-tool recovery through the device fallback is replaced rather than re-pinned: that path was removed on purpose, and the new case asserts the Code Mode boundary it was masking.
Sixth review round. Uniqueness was enforced per-set instead of once over everything a caller can reach, so set order could still decide a genuinely ambiguous call. `resolveMCPToolAlias` now takes a lookup callback rather than an array, and `sdk.ts` passes ONE lookup spanning both presentation sets it can reach — mounted `xd://` devices and the primary agent's advertised tools. Previously the mounted set was consulted first and returned early, so an alias answered by a mounted device AND by a different advertised tool executed the mounted one instead of being refused. The exact-mounted branch stays ahead of the alias pass, since an exact name is the name itself and not a guess. `SessionTools.getToolByName` had its own first-match candidate loop, which bypassed the same rule. It is public and also selects transcript renderers, so it could return or render the wrong tool for the exact ambiguous spelling the new tests cover; it now routes through the shared matcher. With the union resolved by the caller that knows both sets, `resolveFallbackXdevTool`/`resolveFallbackXdevExecutable` — added earlier in this PR — are redundant and removed. `xdev.ts`'s exported resolver surface is now byte-identical to main's, and the new logic lives in `tool-bridge.ts` as two additive exports. Not changed: the repeated finding about `resolveMountedXdevExecutable` being removed. It was restored in a1c791ca0d with its original mounted-only semantics, is present, and matches main.
…apshot Seventh review round. `resolveFallbackTool` received only a name, so `sdk.ts` recovered a Claude Code-spelled MCP alias against `agent.state.tools` — live, mutable state. `Agent` builds each request's context with `tools: this.#state.tools` (agent.ts:1347), capturing the array by reference, while `setTools` reassigns the field. An MCP `tools/list_changed` mid-stream therefore leaves exact-name dispatch answering from the request's snapshot while alias recovery read a roster the model never saw, able to reach a newly added tool or one that had taken over the same canonical name. The callback now takes the advertised snapshot as a second argument and `resolveToolForCall` passes the very array it just searched, so the two dispatch paths cannot diverge by construction. Widening the signature is backwards compatible: an existing one-parameter implementation stays assignable, as the untouched `routes unadvertised tool calls` test shows. `sdk.ts` resolves from that snapshot instead of `agent.state`, still unioned with mounted devices in a single lookup so the uniqueness rule spans both presentation sets. The Cursor exec bridge has no request snapshot and passes none, which leaves it with device resolution only — exactly its behaviour before this PR.
Eighth review round. The split guard required both halves to survive sanitization, on the stated grounds that a placeholder-substituted part "would mint a key nobody registered". That reasoning was wrong: `createMCPToolName` is the same function registration uses, so re-minting reproduces whatever registration produced. `validateServerName` accepts `^[a-zA-Z0-9_.:-]+$`, so `123` is a configurable server name, it sanitizes away, and it genuinely registers as `mcp__server_bank` — the guard dropped exactly the names that needed recovering, leaving `mcp__123__bank` unresolvable. A split now needs both halves nonempty rather than sanitization-surviving, which also drops a redundant re-implementation of the sanitizer's emptiness rule. A genuinely absent half still yields no split, because that describes no split to reproduce. The whole-suffix candidate keeps the emptiness check: with no boundary there is no minted fallback shape to reproduce. The test asserting candidates never contain the placeholder shapes encoded the wrong invariant and is replaced rather than re-pinned: one case asserts fallback-only server names recover, another that absent halves still yield nothing.
AGENTS.md requires external contributions to carry contributor credit (`Attribution`, lines 335-338); both entries carried only issue links. The same omission was flagged on #11518 and never applied here. Follows the form already merged for the sibling change in agent 18.1.17 — issue link plus `by [@oldschoola]` — rather than swapping in the PR link, so the reference to #11516 survives. No entry in either changelog carries both an issue and a pull link.
fix(advisor): preserve healthy WATCHDOG entries and surface warnings
…or-lookup fix(mcp): resolve the Claude Code tool-name spelling to its registered tool
…assification Reconcile now requires the exact source the stream finalize verified, not just a matching prefix, so appended bindings discard the session. String() and .join() transform inputs refuse when their coercion intrinsics report replaced. Speculative reads classify format and rendering by the requested path while opening the resolved target, and authorization declines video extensions on either side of a symlink.
Separator-agnostic path goldens, script-file python prelude, USERPROFILE probe isolation, POSIX-signal skip, EINVAL-safe fixtures, detached dead-root probe.
Restore OMP_PROFILE/PI_PROFILE/XDG_* clears in logger probe env (hermeticity); use Bun.write in prelude helper per repo convention.
trySummarize takes an optional language path used only for parser-language inference; speculative reads pass the requested lexical path while continuing to read the resolved target's bytes. A cross-language symlink (api.ts -> api.py) previously summarized as the target language while an ordinary read of the requested path could not parse it.
test(utils,coding-agent): fix Windows-only suite failures
The structural summary cache keyed on resolved path, content, and fold settings, so one file read through different lexical extensions in a session reused the first language's summary. Include the language path in the key.
fix(spec): exact-code reconcile, transform coercion gates, lexical cl…
fix(ai): anchor proxy tunnel socket in a typed const
docs(changelog): add 11892 links to follow-up entries, drop agent duplicate
…ustness fix(coding-agent): version-robust fetch/socket/console typings
Windows PowerShell 5.1 does not reliably resolve [System.Runtime.InteropServices.RuntimeInformation] (assembly drift vs PowerShell 7), so read the OS architecture from PROCESSOR_ARCHITEW6432/PROCESSOR_ARCHITECTURE instead. Also fail fast below PS 5.1 with a clear upgrade message.
fix(install): pwsh version check for pwsh installer
…pt-results fix(tui): preserve live tool results and retire closed reasoning
Windows transaction paths descend from `fs::canonicalize`, which returns verbatim `\\?\` paths. `ShellExecuteEx` -- the API browsers use to hand a custom scheme to its registered handler -- refuses those, so the registered `zcode://` command installed a handler that resolved but never started: `AssocQueryStringW` matched, activation reported success, and the browser logged the redirect while the relay never ran and sign-in waited out its deadline on a callback that could not arrive. Convert the helper and callback paths to their shell-launchable form when composing the registry command, mapping verbatim disk and UNC prefixes back to `C:\...` and `\\server\share\...`, and refusing volume/device paths the shell can never launch so the flow falls back to manual paste instead of registering a dead handler.
…batim-path fix(auth): register zcode:// handler with a shell-launchable path
fix(catalog): scope the Fable cache-read patch to the 5.1 revision
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )