Commit Graph

234 Commits

Author SHA1 Message Date
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
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
Peter Steinberger a645d13d88 fix(ai): recover OpenAI WebSocket turns after compaction rejection (#123398)
* fix(ai): recover rejected WebSocket compaction

Native OpenAI WebSocket turns now rebuild full history over SSE when a replayed encrypted checkpoint is explicitly rejected, then suppress that checkpoint on later turns.

* ci: refresh merge check
2026-08-13 19:15:33 -07:00
Peter Steinberger c9621adf3e feat(google): add Gemini 3.7 Flash with LOW thinking floor (#123366)
* feat(google): add Gemini 3.7 Flash to the model catalog

* fix(google): floor Gemini 3.7 Flash thinking at LOW — MINIMAL retired upstream

* fix(google): satisfy no-map-spread in catalog row builder
2026-08-13 16:34:13 -07:00
Peter Steinberger 459891c035 fix(ai): session cost understates gpt-5.5 priority (fast mode) turns by 20% (#123152)
* fix(ai): managed OpenAI transport understates gpt-5.5 priority pricing by 20%

The managed Responses transport carried its own copy of the service-tier
pricing table in openai-responses-debug.ts (flat 2x for priority). The
canonical helper applyResponsesServiceTierPricing in
openai-responses-shared.ts was updated to 2.5x for gpt-5.5 priority
(#117298) but the transport copy was never touched, so UI cost for
managed-transport fast-mode turns understated the real spend.

Delete the duplicated table and delegate the transport's pricingOptions
to the canonical model-aware helper. Azure intentionally remains
tier-unpriced (it sets no pricingOptions).

* test(ai): pin managed-transport gpt-5.5 priority pricing at the transport boundary

ClawSweeper correctly flagged that the helper-only test also passes on
unfixed main. Add a mocked managed-transport run with a priority
response and nonzero model cost asserting the final usage cost is 2.5x
(fails at 24 vs 30 on the pre-fix flat table).
2026-08-13 14:26:38 -07:00
Ayaan Zaidi f70d5b8ba5 fix(reasoning-tags): prevent internal reflections in replies (#123196)
Treat <internal> blocks as private reasoning in the shared parser and remove Telegram raw-reasoning fallbacks. This keeps model reflections out of user-visible replies while preserving surrounding answer text.

Closes #122623

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Co-authored-by: WangYan <wang.yan29@xydigit.com>
2026-08-13 20:36:48 +05:30
ooiuuii c5690c97eb fix(ai): trim replay tool call ids (#111864)
* fix(ai): trim replay tool call ids

* fix(ai): trim replay tool call ids
2026-08-13 17:48:23 +08:00
Peter Steinberger 5eebaf9e5c refactor(ai): internalize ChatGPT SSE protocol (#122930) 2026-08-12 19:31:00 -07:00
Peter Steinberger 2335332a5b refactor(ai): remove Azure provider testing export (#122819) 2026-08-12 14:16:26 -07:00
Peter Steinberger 45a59030db fix(ai): recover missing OpenAI WebSocket response state (#122727)
* fix(ai): recover rejected WebSocket continuations

* fix(ai): keep WebSocket server error internal
2026-08-12 10:34:09 -07:00
Markus Hartung 4e12d0556b feat(ai): continue stateful OpenAI SSE turns (#122194)
* feat(ai): continue stateful OpenAI SSE turns

Use the prior OpenAI Responses ID for native stateful HTTP/SSE turns, retry missing server state with full history in the same turn, and keep stateless/custom routes unchanged.

Co-authored-by: Markus Hartung <mail@hartmark.se>

* test(ai): assert Responses retry attempt metadata

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-08-12 09:25:51 -07:00
Peter Steinberger 2cb9a75648 improve(gateway): compose live session stress probes (#122519)
* test(gateway): compose live session stress probes

Amp-Thread-ID: https://ampcode.com/threads/T-019feaaa-c7ed-769e-9f29-a3612bec72e7

* fix(ai): resume after Responses compaction checkpoints

Amp-Thread-ID: https://ampcode.com/threads/T-019feaaa-c7ed-769e-9f29-a3612bec72e7

* test(gateway): compose multi-session subagent probes

Amp-Thread-ID: https://ampcode.com/threads/T-019feaaa-c7ed-769e-9f29-a3612bec72e7

* fix(test): invalidate inlined schema transforms

Amp-Thread-ID: https://ampcode.com/threads/T-019feaaa-c7ed-769e-9f29-a3612bec72e7

* test(ai): cover empty compaction owners

Amp-Thread-ID: https://ampcode.com/threads/T-019feaaa-c7ed-769e-9f29-a3612bec72e7

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-08-12 06:22:08 -07:00
Peter Steinberger b080dd1e76 refactor: consolidate coercion contracts (#122458)
* refactor: consolidate coercion contracts

Centralize exact string, record, numeric, date, Boolean, argument, and structured-error coercions while preserving call-site semantics.

Migrate canonical-name collisions and deprecated internal SDK bypasses, deleting 55 net production/tooling lines. Expand declaration ownership enforcement to 101 allowed helpers and add a narrow export-completeness audit.

* fix: preserve standalone script coercions

Keep copied Control UI tooling self-contained and retain the trusted release harness module-relative source seam when the harness runs against an old target cwd.
2026-08-11 23:26:37 -07:00
Peter Steinberger 0c8c8d95c7 fix(ai): restore cached OpenAI continuation (#122483) 2026-08-11 23:24:57 -07:00
Peter Steinberger e30df72045 fix(worker): keep source bundles npm-installable (#122430) 2026-08-11 21:50:56 -07:00
Peter Steinberger 964c8c84c1 refactor: consolidate coercion ownership (#122299)
* refactor: consolidate coercion ownership

Centralize four canonical coercion helpers, migrate exact core and plugin duplicates through narrow Plugin SDK facades, and enforce declaration and plugin-normalization ownership boundaries.

The sweep adds eight focused SDK exports while deleting more production and tooling code than it adds. User-visible behavior is unchanged except for safer equivalent object and UI parsing at existing boundaries.

* fix: guard integer option ownership

Register resolveIntegerOption with the canonical function owner and extend the declaration-guard fixture so future local duplicates fail validation.

* fix: keep integer helpers on numeric facade

Remove the unshipped duplicate string-coerce exports and route every affected plugin consumer through the existing number-runtime contract.

* fix: point numeric coercion to number runtime

Make boundary and declaration diagnostics recommend the canonical numeric facade, with failing-before coverage for both guidance paths.
2026-08-11 17:14:53 -07:00
Peter Steinberger 087fb56f77 feat(moonshot): add native K3 video input (#122337) 2026-08-11 16:49:42 -07:00
Peter Steinberger 7eed2c3f21 feat(google): add current-turn native video input (#122074)
* feat(agents): add current-turn Gemini video handoff

* test(google): add live native video regression

* build(ai): emit provider types entrypoint

* fix(google): preserve video shedding on retry
2026-08-11 12:58:32 -07:00