Commit Graph

257 Commits

Author SHA1 Message Date
Peter Steinberger 7c0a691955 fix(ai): preserve local-model tool calls in standalone streams (#129664) 2026-08-25 17:39:47 -07:00
Peter Steinberger d4687dd5bd refactor(ai): share positive integer parsing (#129512)
Amp-Thread-ID: https://ampcode.com/threads/T-01a037b7-4d1e-766c-9a95-f448870473ca

Co-authored-by: Amp <amp@ampcode.com>
2026-08-25 14:21:32 -07:00
Peter Steinberger 18684f5cd1 fix(ai): recover input-only provider context overflows (#129536)
* fix(ai): recover input-only provider context overflows

Preserve the existing strict input-length classifier while recognizing documented OpenAI-compatible model context errors.

Co-authored-by: KhanCold <KhanCold@users.noreply.github.com>

* test(ai): keep overflow regression at classifier owner

Preserve failover coverage without expanding frozen shared retry-corpus inventories.

---------

Co-authored-by: KhanCold <KhanCold@users.noreply.github.com>
2026-08-25 14:12:26 -07:00
Alix-007 4da57168d3 fix(ai): keep SSE cancellation from blocking outcomes (#128488) 2026-08-25 12:01:24 -07:00
Peter Steinberger 9b6c2fb2c9 fix(ai): enforce Anthropic stream completion by provider ownership (#129291) 2026-08-25 05:27:57 -07:00
Peter Steinberger 4dc7bb7411 chore(deps): refresh dependencies after seven-day cooldown (#129187)
* chore(deps): refresh dependencies after cooldown

* fix(gateway): emit append-only Responses content events

* chore(deps): retain unverified Sherpa runtime
2026-08-25 05:00:46 -07:00
Peter Steinberger ebfd80ff91 fix(mistral): report provider terminal failures instead of silent success (#129256) 2026-08-25 04:56:32 -07:00
ANIRUDDHA ADAK 75d80fc5da fix(mistral): retain provider-returned streaming model as responseModel (#128066)
Co-authored-by: Aniruddha Adak <aniruddhaadak80@users.noreply.github.com>
2026-08-25 02:38:34 -07:00
Peter Steinberger 1d10b275db test(plugins): deduplicate provider fixtures (#129072)
* test(plugins): deduplicate provider fixtures

* test(memory-lancedb): bind fixture configuration helpers
2026-08-25 01:39:08 -07:00
Peter Steinberger 234df15a6d chore: refresh dependencies after seven-day cooldown (#128414)
* build(deps): refresh dependencies after cooldown

Apply dependency, toolchain, action, image, and exact tool updates released by the inclusive 2026-08-16 seven-day cutoff. Adapt owner boundaries for the resulting CUA, logging, Teams, Markdown, native, and test-harness contract changes while retaining versions blocked by upstream compatibility constraints.

* fix(ui): align markdown renderer env typing

* fix(deps): align postcss and mistral peer contracts

* fix(deps): repair refreshed dependency contracts

* fix(deps): retain tslog startup budget

* fix(ci): verify Android tools with SHA-256

* fix(ci): fence Android SDK cache version
2026-08-24 03:01:54 -07:00
Heming Zeng 7916caab26 fix(agents): retry incomplete terminal streams (#127338) 2026-08-24 00:47:11 -07:00
Parker Fawcett 6a65e79529 fix(ai): preserve tool-result boundary whitespace for Mistral and Ollama (#128266)
The shared formatToolResultText helper emitted its trim() result instead
of using it as an emptiness predicate only, so native Mistral and Ollama
requests silently stripped leading indentation and trailing
whitespace from durable tool output (#127587). Chat Completions already
emits the original sanitized text and uses trim solely to detect blank
content; align the shared formatter with that contract. Blank output
keeps the placeholder fallback, error prefix, and omitted-media suffix.

Closes #127587

AI-assisted (Claude); shared + Mistral + Ollama boundary regression
tests fail pre-fix and pass post-fix.

Co-authored-by: Parker Fawcett <Parkerscottfawcett@gmail.com>
2026-08-23 23:15:55 -07:00
Peter Steinberger 42d87c6731 test(providers): deduplicate failover and streaming fixtures (#128338) 2026-08-23 12:19:05 -07:00
Vyctor H. Brzezowski ddd12ca27b perf(ai): keep streaming responsive while large tool call arguments assemble (#128166)
* perf(ai): refresh streamed tool-call argument previews on a length schedule

Every input_json_delta re-parsed the entire accumulated argument buffer
(quote scan, strict parse attempt, repair scan, partial parse), making
assembly quadratic in argument size. A 128KB tool call spent ~1.2s of CPU
on re-parsing alone while blocking token delivery; previews are
preview-only by contract since the terminal parse re-reads the full
buffer authoritatively at content_block_stop.

Refresh previews on a geometric length checkpoint instead: bounded
staleness, linear total work. Applied across every accumulating
packages/ai transport/provider surface sharing the invariant.

(hook bypassed per run-node-tool.sh contract: no local node_modules in
this worktree and pnpm install is out of scope; oxfmt --check green on
all staged files via sibling checkout binary.)

* perf(agents): throttle proxied tool argument previews

* fix(agents): preserve terminal-only proxy tool calls
2026-08-23 12:37:21 -03:00
Josh Lehman 0ab6578478 fix: preserve source code in tool results (#127697)
Preserve opaque source strings across tool-result replay while retaining masking for direct .env reads, registered or recognizable secrets, structured sensitive fields, and payment data.
2026-08-22 13:30:45 +05:30
Onur Solmaz 1319e1e606 fix(providers): report request acceptance consistently (#126028)
* fix(providers): restore provider acceptance lifecycle

* fix(providers): cancel streams on acceptance failure

* test(amazon-bedrock): split stream lifecycle coverage

* refactor(providers): keep acceptance lifecycle private

* refactor(providers): make acceptance observation synchronous

* refactor(providers): narrow private observer safely

* fix(google): keep response hook within retry deadline

* test(ui): tolerate subpixel spacing variance

* test(ui): wait for durable draft before reload
2026-08-21 19:32:07 +03:00
Dallin Romney 566b0e53d5 fix(ai): retain compaction-only replay checkpoints (#127106)
* test(gateway): publish runtime in agent E2Es

* test(gateway): leave replay fix to owner PR

* fix(ai): retain compaction-only replay checkpoints

* fix(ai): preserve empty compaction replay checkpoints
2026-08-21 09:10:10 -07:00
Peter Steinberger 0135046830 refactor(llama-cpp): use one provider for managed and existing servers (#126434)
* refactor(llama-cpp): unify server ownership modes

* test(llama-cpp): preserve shared discovery limits

* fix(plugin-sdk): retain provider auth removal export
2026-08-19 13:57:33 -07:00
Peter Steinberger 8a9e21d3bc fix(providers): prevent malformed streamed tool calls (#126391)
Co-authored-by: 曾令彪 0668001395 <zeng.lingbiao@xydigit.com>
2026-08-19 11:30:09 -07:00
Onur Solmaz c2de3206d4 feat(llama-cpp): support external llama-server
* feat(llama-cpp): add external server provider

* feat(llama-cpp): document external server setup

* refactor(llama-cpp): harden external provider boundaries

* fix(llama-cpp): support external structured output

* fix(llama-cpp): isolate replacement endpoint credentials

* test(llama-cpp): register external live shard

* fix(llama-cpp): preserve explicit endpoint authorization

* fix(llama-cpp): clear disabled inline credentials

* fix(llama-cpp): preserve external local service configs

* test(llama-cpp): cover retained external configs

* test(llama-cpp): cover authorization precedence
2026-08-19 17:32:00 +03:00
Peter Steinberger 9814b14c90 test: trim residual exact-subset assertions (#126293) 2026-08-19 03:41:20 -07:00
Vincent Koc 7dca970ff3 test(zai): enable GLM 5.3 reasoning in live probe (#126202)
* test(zai): enable GLM 5.3 reasoning in live probe

Punchcard-Session: frost-orchard-lantern-ze

* test(ai): cover Z.AI simple reasoning payload

Punchcard-Session: frost-orchard-lantern-ze
2026-08-19 14:50:29 +08:00
Peter Steinberger 66cacbae5d test: remove strict-subset assertions (#126142) 2026-08-18 20:15:50 -07:00
Peter Steinberger 0eac4f7a3c test(ai): route parity fixtures to owner (#126131) 2026-08-18 19:33:48 -07:00
Onur Solmaz 5cabd2b72e Revert "fix(providers): report request acceptance consistently (#125807)" (#126021)
This reverts commit f5e9622fc9.
2026-08-19 00:16:09 +03:00
Onur Solmaz f5e9622fc9 fix(providers): report request acceptance consistently (#125807)
* fix(providers): report request acceptance consistently

* fix(providers): retain response hook compatibility

* fix(providers): keep legacy response hook path

* fix(providers): distinguish rejected response attempts

* fix(providers): keep acceptance evidence truthful

* fix(google): preserve provider acceptance errors

* test(google): satisfy acceptance callback lint

* fix(google): exclude acceptance hooks from retry deadline

* fix(openai): report Codex websocket acceptance

* fix(openai): commit websocket state before acceptance hook

* fix(google): abort pending acceptance callbacks

* fix(providers): abort pending acceptance callbacks

* fix(mistral): report observed HTTP response

* fix(mistral): report rejected HTTP responses

* fix(providers): derive acceptance from HTTP status

* fix(providers): preserve acceptance lifecycle cleanup

* fix(anthropic): report observed HTTP response

* fix(anthropic): report rejected HTTP responses

* fix(plugin-sdk): expose provider lifecycle

* fix(providers): stop after lifecycle abort

* fix(mistral): cancel unread acceptance failures
2026-08-18 23:50:57 +03:00
Peter Steinberger 66dae86d86 refactor(agents): prepare provider route facts at model-route build (#125799)
* refactor(agents): prepare provider route facts at model-route build

* test(agents): isolate prepared route generation assertion

* test(fal): update provider HTTP mock shape
2026-08-18 07:55:13 -07:00
Peter Steinberger d32c09f843 fix(ai): accept retained messages from Responses compact (#124974)
* fix(ai): accept retained output from Responses compact

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b7c-b9f0-73d5-8fb7-e619e8e458e1

* fix(ai): replay retained compact messages

* fix(ai): scope retained compaction to OpenAI

* refactor(ai): reuse response endpoint contract

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-08-17 18:05:52 -07:00
Peter Steinberger 5028ce87b0 fix(code-mode): show the final tool surface in debug logs (#124934)
* fix(code-mode): isolate and harden diagnostics

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b7c-b9f0-73d5-8fb7-e619e8e458e1

* fix(code-mode): share payload diagnostics across wrappers

Amp-Thread-ID: https://ampcode.com/threads/T-01a00b7c-b9f0-73d5-8fb7-e619e8e458e1

* fix(code-mode): preserve transport debug behavior

* refactor(code-mode): simplify tool observer carrier

* refactor(code-mode): keep spread-safe observer metadata

* test(qa-lab): allow elapsed cron wait budget

* docs(code-mode): preserve transport debug contract

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-08-17 17:32:14 -07:00
wanyongstar 438c55cc4f fix(ai): skip malformed thinking signatures during replay (#123228)
Responses replay parsed persisted thinking signatures without validating their JSON shape, so corrupt or unrelated values could prevent every later turn in a session.

Parse signatures in the shared replay owner and accept only reasoning records. Cover malformed syntax, null, arrays, and wrong item types through both provider- and transport-style converters.
2026-08-17 16:19:47 -07:00
Ayaan Zaidi 863f19b722 fix(ai): derive Responses compact threshold from active context budget (#125342)
The default OpenAI Responses compact_threshold was 70% of contextWindow alone; for gpt-5.6-sol (1.05M window, 272k active budget) that resolved to 735,000, above the ~252k prompt budget the runtime admits, so provider compaction never fired before local overflow handling. Threshold now uses 0.7 x min(contextTokens, contextWindow) (190,400 for Sol) on both the payload-policy and host-preflight paths; explicit responsesCompactThreshold still wins.
2026-08-17 22:09:50 +05:30
Ayaan Zaidi 78b8f8cf66 fix(ai): preserve final phase across resumed reasoning (#125149)
Classify text interrupted by resumed reasoning at the OpenAI-completions producer boundary, so channels deliver only the confirmed final answer.

Defer phase-ambiguous replies until terminal classification while preserving live partial delivery for ordinary completions.

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-08-17 14:47:58 +05:30
Peter Steinberger cfce94be52 refactor(types): discriminated unions for internal contracts — wave 2 (#124959) 2026-08-16 19:21:32 -07:00
Peter Steinberger 568b920b21 feat(lint): enforce import ordering and deduplication (#124730)
* refactor(imports): dedupe and hoist imports

* feat(lint): enforce import/no-duplicates and import/first
2026-08-16 11:44:52 -07:00
Peter Steinberger 715c379fd9 refactor(config): consolidate context budget to one per-model knob (#124665)
* refactor(config): consolidate context budget settings

* test(config): type legacy context fixtures

* test(config): align context budget fixtures

* fix(status): honor runtime context discovery

* docs(config): clarify context budget fallbacks

* fix(ci): resolve context budget lint failures

* test(ci): align context budget shard fixtures

* fix(models): preserve catalog context metadata

* fix(config): surface context migration diagnostics

* test(plugin-sdk): keep live catalog coverage focused
2026-08-16 10:05:01 -07:00
Peter Steinberger 99bda3d8cd refactor: make transport stream writer types honest (#124587)
* refactor(ai): give transport streams an honest writer type

* test(ai): use canonical transport stream fixtures

* fix(ai): preserve partial-less stream deltas
2026-08-16 07:03:36 -07:00
Peter Steinberger 9a555b6a9d fix(ai): preserve WebSocket response failure semantics (#124591) 2026-08-16 06:32:05 -07:00
Peter Steinberger 1384e277af refactor(types): enforce chained-assertion guard in AI and UI (#124361)
* refactor(types): drain chained-assertion ledger — ai and ui

* refactor(ui): extract chat state contract

* fix(ai): preserve strict Claude request cleanup

* test(ui): synchronize terminal timeout clock

* fix(ui): validate observer digest before run mutation
2026-08-15 22:25:42 -07:00
Peter Steinberger e9d70a1169 perf(test): run hidden reasoning watchdog cases concurrently (#124330) 2026-08-15 18:29:02 -07:00
Peter Steinberger f4a047b87c test: trim residual subset assertions (#124203) 2026-08-15 09:11:36 -07:00
Peter Steinberger aad64693ba test: remove redundant subset assertions (#124198) 2026-08-15 08:57:45 -07:00
Peter Steinberger aaa509b26e refactor(types): remove chained type assertions in core and ui (#124073)
* refactor(types): remove chained assertions in core and ui

* fix(types): preserve legacy cron migration identity

* fix(types): preserve settings patch key types
2026-08-15 01:32:04 -07:00
Peter Steinberger bf70d5ddb6 refactor(ai): remove Responses replay test seams (#123825) 2026-08-14 14:05:36 -07:00
Peter Steinberger 17eb646bb3 refactor(ai): consolidate Responses replay paths (#123762)
* refactor(ai): consolidate Responses replay ownership

* refactor(codex): consolidate completion plumbing

* refactor(agents): centralize replay pairing repair

* refactor: preserve replay static contracts
2026-08-14 11:20:57 -07:00
Peter Steinberger c3887db7c1 feat: compact xAI sessions server-side (AI-assisted) (#123622)
* feat: add xAI Responses compact endpoint

* docs: explain xAI server-side compaction

* refactor: persist server compaction via session manager

* refactor: simplify server compaction results

* fix: preserve server compaction result kind

* test: satisfy server compaction CI contracts

* fix(xai): prepare server compaction requests

* refactor(ai): extract prepared compaction request

* fix(xai): preserve compaction fallback semantics

* test(xai): use the stream function type owner

* fix(xai): enable compact endpoint for provider alias
2026-08-14 07:02:47 -07:00
Peter Steinberger c6fc12dc67 fix: keep compacted sessions usable after transcript rewrites (#123485)
* fix: keep compaction checkpoints aligned through rewrites

* fix: persist rejected compaction invalidation

* chore: drop release-only changelog edit

* fix: align compaction replay with repository guards

* fix: invalidate checkpoints after OpenAI ID rewrites
2026-08-14 03:22:50 -07:00
Peter Steinberger d4b1e9644e fix(ai): stabilize prompt caching across discovery order (#123543) 2026-08-14 01:59:10 -07:00
Peter Steinberger 25d4807b38 feat(anthropic): opt-in server-side compaction (compact-2026-01-12) (#123402)
* feat(anthropic): add server-side compaction replay

* docs(anthropic): document server compaction

* test(anthropic): harden compaction live probe

Fix the live fixture baseUrl (the SDK appends /v1 itself), fail fast on
errored turns instead of silently looping, assert request-side injection
before capture, and log per-turn stream outcomes for live debugging.

* test(anthropic): keep live settings type module-local

* refactor(agents): split transcript replay sanitizers

* test(anthropic): move compaction live probe into plugin tree

* refactor(anthropic): consolidate compaction replay duplication

* test(anthropic): align compaction threshold host coverage

* test(anthropic): fabricate checkpoints via capture tracker

Keeps captureAnthropicCompaction module-local; knip flags exports whose
only consumers are tests.
2026-08-13 21:28:19 -07:00
Peter Steinberger 575467aa58 fix(openai): unify server-side compaction gates and harden compaction recovery (#123397)
* fix(openai): unify server compaction policy

* fix(openai): preserve managed responses aliases

* fix(compaction): harden bounded recovery

* refactor(compaction): simplify orphan output classifier

* fix(compaction): unanchor overflow classifiers and route image constant through runtime facade

* test(openai): use provider input config in compaction parity

* test(openai): model default compaction route accurately

* fix(openai): isolate responses payload policy imports

* fix(ai): remove unused responses api re-export

* fix(plugins): resolve responses policy source alias
2026-08-13 20:45:07 -07:00
Peter Steinberger ac2f8a8dce fix(ai): provider terminal errors show as generic unknown error and trigger pointless failover (#123151)
* fix(ai): preserve provider terminal error message in stream transports

The managed OpenAI Responses transport (and the mistral/google-shared
providers) threw a literal "An unknown error occurred" on terminal
error stop reasons, discarding the provider's terminal fact (for example
"Provider incomplete_reason: content_filter"). The catch-side
projectProviderError() then overwrote output.errorMessage with the
generic string, so users saw an unknown error and failover classified
the deterministic failure as a transient timeout, rotating models and
re-sending the same filtered prompt.

Align all three sites with the canonical siblings
(openai-responses-shared.ts, transport-stream-shared.ts) by preserving
output.errorMessage when present.

* test(ai): await the transport stream factory before result()

* fix(ai): narrow the repair to the managed OpenAI transport

ClawSweeper correctly noted the mistral and google-shared edits were
no-ops: streamMistral never assigns output.errorMessage and the Google
path throws its own constructed terminal error before this fallback.
Revert both to keep the PR scoped to the proven managed-transport
repair.
2026-08-13 19:29:50 -07:00