Commit Graph

155 Commits

Author SHA1 Message Date
大村愛弥 793f602f80 fix: remove bodyless 400/413 from overflow patterns to prevent false compaction (#119596)
* fix: remove bodyless 400/413 from overflow patterns to prevent false compaction

PR #67024 fixed the failover classification path (errors.ts) to not
classify bodyless 400/422 as 'format' errors. However, the compaction
trigger path (isContextOverflow in overflow.ts) still has the pattern
/^4(?:00|13)\s*(?:status code)?\s*\(no body\)/i in OVERFLOW_PATTERNS.

This means a bodyless 400 from any provider triggers compaction via
checkCompaction() -> isContextOverflow(), even though PR #67024
ensured the failover reason is null (not 'format'). The two paths are
independent: failover classification and compaction triggering use
separate functions.

A bodyless 400 cannot be a context overflow — real overflow errors
from all major providers include a descriptive body. A bare 400 with
no body is a transient/malformed error that should surface to the
user, not trigger a compaction loop.

Remove the Cerebras-specific pattern from OVERFLOW_PATTERNS. If
Cerebras returns bodyless 400/413 for actual overflow, it should be
handled with a more specific pattern or NON_OVERFLOW_PATTERNS exclusion.

AI-assisted.

* fix(ai): avoid compacting on bodyless 400 errors

---------

Co-authored-by: lykeion-dev <lykeion-dev@users.noreply.github.com>
Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
2026-08-05 20:53:02 -07:00
Vincent Koc a54bec799c fix(agents): observe native provider prompt egress (#119219)
* fix(agents): observe final provider prompt egress

* fix(agents): observe native provider prompt egress

* test(agents): type native prompt observer models
2026-08-04 22:46:07 +08:00
Vincent Koc 1fb4f3c709 merge: sync llama.cpp transport fix with main
* 'main' of https://github.com/openclaw/openclaw:
  test(qa): cover sandboxed exec behavior (#119053)
  test(qa): prove shared-channel memory recall (#119111)
  fix(telegram): keep request deadlines through response bodies
  test(qa): cover gateway plugin approvals (#119128)
  fix(ai): keep OpenAI tool call id truncation UTF-16 safe (#110471)
  fix: preserve live updater failure diagnostics (#119096)
  fix: recover new-session models through Gateway startup (#119120)
  test(qa): cover instruction profile artifacts (#119078)
  fix(telegram): record automatic delivery message ids
  test(qa): cover memory promotion safety (#119093)
  test(qa): prove overflow compaction pruning (#119033)
  fix(tool-search): preserve deferred MCP failures (#118363)
  fix(macos): keep setup activation within app checks
  test(setup): type provider kind fixture
  fix(setup): complete prepared model activation
  fix(protocol): regenerate Swift wizard models
  fix(ollama): activate the model selected during setup
  fix(setup): preserve the prepared model handoff
2026-08-04 14:51:35 +08:00
pick-cat 01e7fca716 fix(ai): keep OpenAI tool call id truncation UTF-16 safe (#110471) 2026-08-04 14:03:44 +08:00
Vincent Koc 9c854cb1a0 fix(ai): preserve Google simple completion sanitation 2026-08-04 13:58:58 +08:00
Vincent Koc 9501a8264b fix(ai): prefer provider-owned completion streams 2026-08-04 11:11:55 +08:00
zengLingbiao 780d6bf7b8 fix(ai): reject binary Codex websocket frames (#111138)
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-08-04 02:11:08 +08:00
Peter Steinberger 1140e56a37 test(ai): deduplicate legacy function-call fixtures (#118445) 2026-08-02 21:24:46 -07:00
Peter Steinberger 30c79e4db1 fix(inference): prevent lost cancellation, stuck compaction, and runaway tools (#118146)
* fix(inference): preserve cancellations, compaction, and tool-loop safety

* fix(inference): satisfy Codex and mock-provider type checks

* fix(codex): secure tool-free recovery and restricted turns

* fix(codex): satisfy host-prompt provenance lint
2026-08-02 14:42:01 -07:00
Peter Steinberger fb380b2e87 test(ai): consolidate provider fixtures (#118078) 2026-08-02 11:08:52 -07:00
Sebastien Tardif b300a0cfb3 fix(agents): cap DeepSeek DSML recovery buffer at 256 KB (#117175)
Co-authored-by: Sebastien Tardif <1413412+SebTardif@users.noreply.github.com>
2026-08-02 15:12:38 +08:00
Vincent Koc 1130f30445 fix(diagnostics): report provider HTTP status in timelines (#117403)
* fix(diagnostics): record provider response status

* fix(diagnostics): report managed Responses status
2026-08-01 23:36:20 +08:00
Yiğit ERDOĞAN afe024e8c7 fix(ai): assistant text blocks are run together on replay (#115743)
Chat Completions replay flattened every assistant text block with an empty
separator, so two distinct blocks came back as one word-joined sentence. The
same message shape survives distinctly on the Anthropic, Responses and Mistral
lanes, and the string-content flattener for strict OpenAI-compatible servers
already joins with a newline.

Two blocks arise routinely: streaming opens a new text block after a tool call,
and cross-model replay converts a thinking block into a text block.
2026-08-01 02:23:08 -07:00
Peter Steinberger b721cffa44 fix(inference): simplify lifecycle and preserve Codex tool identity (#117298) 2026-08-01 02:05:45 -07:00
Peter Steinberger 1f9ee89f25 fix(google): preserve canonical replay and provider error ownership (#117193)
* fix(google): preserve provider signatures and failure outcomes

* fix(google): satisfy SDK stream event and optional text types

* fix(google): preserve signed empty SDK response parts

---------

Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 22:52:45 -07:00
RileyJJY c7917cca36 fix(google-vertex): ignore blank project env (#109515) 2026-07-31 22:03:40 -07:00
Peter Steinberger cb16d739cf fix(inference): harden Codex streaming, cancellation, and live QA (#116012)
* fix(inference): harden Codex turns, streams, and live QA

* fix(inference): dispatch open CR-delimited response frames

* fix(inference): finish live goal and split streaming regressions

* fix(codex): wait for interrupted turn completion

* fix(codex): narrow terminal collector notification ownership

* fix(inference): harden completion authority and lifecycle

* fix(inference): use canonical source delivery contract

* test(inference): align lifecycle probes with current main

* style(inference): format source delivery verification

* fix(goals): prevent premature completion across staged work

* fix(qa): settle streamed goal turns before continuation

* fix(goals): require visible replies after goal completion

* test(qa): keep goal flow regressions within lint limits
2026-07-31 21:29:33 -07:00
Yiğit ERDOĞAN ec5fb470c2 fix(ai): Codex stream shows internal parser text on a malformed frame (#116966)
* fix(ai): Codex stream shows internal parser text on a malformed frame

The Codex SSE parse boundary rethrew JSON.parse failures with its own
message, so the three consumers that key off the shared malformed-fragment
marker by exact string equality could not recognise it and the internal
parser wording reached the operator verbatim.

Mirror the canonical transport contract instead: a SyntaxError becomes the
shared marker with the original error kept as cause, and anything else is
rethrown untouched. The WebSocket twin is left alone because two open PRs
own that block today.

* fix(ai): preserve consumer SSE errors

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-08-01 09:34:09 +08:00
Peter Steinberger d8ba00f8a2 fix(openai): clear ChatGPT SSE fallback per session (#117123)
* fix(openai): clear ChatGPT SSE fallback per session

* test(openai): prove ChatGPT fallback cleanup

* docs(openai): clarify fallback cleanup ownership
2026-07-31 18:24:46 -07:00
Peter Steinberger f8aa383698 fix(mistral): reject incomplete streamed tool terminals (#117137)
Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 18:22:35 -07:00
Peter Steinberger a7e0ebe8e6 fix(ai): preserve structured chat content and refusals (#117136)
Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 18:20:23 -07:00
Peter Steinberger e4d6e5603d refactor(ai): unify Anthropic streaming policy and usage accounting (#117086)
* refactor(ai): unify Anthropic streaming policy and usage accounting

* fix(ai): align shared cache TTL types with Anthropic SDK
2026-07-31 16:28:53 -07:00
Peter Steinberger ed84162454 fix(openai): canonical Chat cache-hit and billing accounting (#117043)
* fix(ai): preserve cached usage in managed chat completions

* test(ai): use canonical managed chat reasoning option

---------

Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 15:19:15 -07:00
Peter Steinberger 3cadc08593 fix(google): restore canonical Gemini and Vertex provider invariants (#117042)
Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 14:31:34 -07:00
Yiğit ERDOĞAN c9932f3cca fix(ai): malformed Anthropic stream frames expose raw event payloads (#116938)
The provider stream path interpolated the rejected SSE frame and its raw lines
into the thrown error, so text the model had generated reached logs and the
operator's error surface. The transport path already answers this exact condition
with the shared MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE and keeps the
SyntaxError on cause, and the user-facing substitution in
formatRawAssistantErrorForUi matches that constant exactly. Align the provider
path with it so the same failure reads the same way on both paths.

The error-event branch is left as is: its payload is parsed downstream to build a
meaningful operator message, so redacting it would be a regression.

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
2026-07-31 15:25:14 -05:00
Peter Steinberger e64b7041ec fix(openai): recover missing terminal response output (#116910)
Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 09:35:15 -07:00
Peter Steinberger 4a8ce9c336 fix(openai): finalize Chat tool calls from authoritative terminals (#116922)
Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 09:21:40 -07:00
Peter Steinberger d2047364a8 fix(google): preserve streamed termination and usage facts (#116822)
Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 05:29:40 -07:00
Peter Steinberger 754fddbc79 fix(anthropic-vertex): correct multi-region endpoints (#116757)
Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 04:50:24 -07:00
Peter Steinberger 0d40cfbb53 fix(google): surface blocked Gemini prompts (#116756)
Co-authored-by: Peter Steinberger <steipete@macos.shared>
2026-07-31 04:29:06 -07:00
Miorbnli 834fb2e3c2 fix(ai): prevent websocket cache clobber on concurrent acquire (#116216)
* fix(ai): prevent websocket cache clobber on concurrent acquire

The WebSocket session cache acquire path (expired or non-reusable cached
entry) used unconditional delete/set around the connectWebSocket() await.
A concurrent request could install a newer entry during that await, which
the resuming acquire then clobbered, orphaning the socket that carried the
real previous_response_id continuation and corrupting multi-turn Codex
conversations.

Mirror the release path's owner-checked helpers: delete via
deleteOwnedWebSocketSession, and install via a new setOwnedWebSocketSession
that only writes when the cache still matches what this acquire left behind
(the stale entry, or undefined after removing it / on first connect). A
different cached entry means a concurrent request already won the session.
The busy-cached branch is unaffected: it returns a transient socket and
never writes the cache.

* fix(ai): close CAS loser websocket promptly without leaking its socket

* fix(ai): correct verifyClient callback type in race regression test

* fix(ai): remove unused variable and fix lint in race regression test

* test(ai): prove concurrent websocket loser closes

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-07-31 09:36:33 +08:00
Josh Avant ce67ffb70e feat(agents): add tool-free isolated completion (#114343)
* feat: add isolated pure-inference completion

* fix(google): block ambient system prompt writes

* docs: refresh generated map
2026-07-30 13:24:45 -05:00
Yiğit ERDOĞAN 6ec3dbd92d fix(ai): tool calls fail when an unsupported schema keyword is nested (#115741)
* fix(ai): tool calls fail when an unsupported schema keyword is nested

The strip walked only properties, items, anyOf, oneOf and allOf, copying every
other value through untouched. A keyword the model rejects therefore survived
inside additionalProperties, prefixItems, patternProperties, contains,
propertyNames, not, if/then/else, dependentSchemas and $defs, and the request
was refused by the provider even though the strip reported success.

Walk the same containers the caller already enumerates in
agent-tools-parameter-schema.ts.

* fix(ai): cover all nested schema containers

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-07-29 23:08:19 +08:00
tiffanychum 4b09214866 fix(ai): avoid websocket cache clobber on stale reused release (#105634)
* fix(ai): avoid websocket cache clobber on stale reused release

* fix(ai): prefer-const holdFirstReuse in websocket cache race test

* fix(ai): avoid websocket cache release clobber

* fix(ai): add curly braces for websocket cache delete guard

* fix(ai): owner-check websocket cache deletes without LOC growth

* ci: bump plugin SDK public surface budget pins to match main tip

* fix(ai): satisfy curly lint for websocket cache owner delete

* ci: allowlist readonly state db and format SDK surface pins

* style: oxfmt plugin-sdk surface report

* ci: drop duplicate readonly state db kysely allowlist entry

* test(ai): prove cached websocket lease ownership

Move the contributor stale-release regression into the canonical cached transport suite and prove authenticated real WebSocket close, cancellation, and queued idle expiry cannot evict a replacement lease.

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-29 07:52:04 -04:00
Peter Steinberger c5d0b7dd39 refactor: retire legacy provider and secret paths (#115655)
* refactor: retire legacy provider and secret paths

* fix: remove stale cache retention import

* test: remove retired secret marker fallback
2026-07-29 04:36:20 -04:00
Peter Steinberger 6090386dc7 fix: make Codex harness caching and benchmark parity exact (#115663) 2026-07-29 03:33:36 -04:00
Peter Steinberger 98a066c90e fix(agents): project llama.cpp-safe tool schemas (#115598)
Co-authored-by: Jithin Mohandas <mohandasjithin@gmail.com>
2026-07-29 01:33:32 -04:00
Peter Steinberger e98675b4b2 refactor(code-mode): unify safe OpenAI tool filtering (#115460)
* refactor(code-mode): unify OpenAI tool surface filtering

* fix(code-mode): preserve transport visibility and test types
2026-07-28 21:12:43 -04:00
Peter Steinberger 388bcc43a1 fix: make Code Mode reliable across gateway and provider lifecycles (#115379)
* fix(code-mode): dispose suspended runs and propagate cancellation

* fix(code-mode): preserve request-visible provider tools

* test(code-mode): require real packaged gateway execution

* fix(gateway): load code mode cleanup only during shutdown
2026-07-28 15:21:54 -04:00
Peter Steinberger 641c82b5bd fix(qa): restore full-stack scenarios and truthful suite exits (#115290)
* fix(qa): restore full-stack scenarios and truthful suite exits

* test(qa): respect plugin boundaries and atomic media delivery
2026-07-28 13:00:22 -04:00
Peter Steinberger d28fb52651 fix(openai): preserve incomplete Responses stream output (#115132)
* fix(openai): recover incomplete Responses stream output

* test: include incomplete SSE in transport discovery
2026-07-28 07:03:05 -04:00
Peter Steinberger d1b8701e37 fix(openai): honor per-turn timeout and retry controls (#115017)
Honor existing per-turn timeout and retry controls across OpenAI Responses, Azure Responses, and OpenAI-compatible Chat Completions. Add real SDK HTTP regressions for all three transports.\n\nRefs: #114203
2026-07-28 05:04:51 -04:00
Peter Steinberger 0216fbd4e4 fix(providers): prevent idle timeouts during hidden reasoning (#114997) 2026-07-28 03:30:43 -04:00
Peter Steinberger 0297f0ed39 test(ai): freeze packed-package and stream parity contracts (#114843)
* test(ai): freeze provider and package parity

* refactor(ai): remove provider transport package cycles

* fix(ai): drop unused stream-options re-export
2026-07-27 23:43:57 -04:00
Peter Steinberger b5bb29a36e fix(code-mode): preserve direct tools and secure suspended runs (#114778)
Preserve trusted policy-required message delivery and native image/computer tools across Code Mode catalogs and provider transports. Keep preferred Gemini capability metadata during live discovery, escape MCP declaration keywords, and reject suspended-run resumes with missing owner identity. Add before-and-after regressions for each user path. Closes #114753.
2026-07-27 18:47:33 -04:00
Peter Steinberger 9588a10f12 refactor(ai): unify Responses transport factories (#114357)
* refactor(ai): unify Responses transport factories

* style(ai): format Responses transport executor
2026-07-27 12:40:48 -04:00
Onur Solmaz 89c5b02832 revert(openai): remove loopback Codex proxy support (#114616)
Reverting PR from runaway clanker, sorry! Won't happen again!
2026-07-27 23:15:42 +08:00
Peter Steinberger 17ed69e103 fix(agents): preserve prompt caches across tool discovery (#114572) 2026-07-27 09:58:19 -04:00
Onur Solmaz 6f8a67120c feat(openai): support loopback Codex proxies (#114555)
* feat(openai): support loopback Codex proxies

* fix(openai): preserve Codex proxy routes

* fix(openai): enforce canonical Codex proxy path

* fix(openai): support opaque proxy capabilities

* test(openai): isolate proxy capability coverage

* fix(openai): confine proxy capabilities

* test(openai): type proxy image config
2026-07-27 13:31:04 +00:00
Harjoth Khara 92eb942822 fix(ai): safely format circular provider stream errors (#107800)
* fix(ai): terminate Anthropic streams on circular error objects

* test(ai): reject with a plain circular object without Promise.reject

* test(ai): pin Anthropic error-message semantics and drop totality overclaim

* test(ai): assert terminal event type in Anthropic error-message test

* fix(ai): preserve circular provider error details

---------

Co-authored-by: Altay <altay@hey.com>
2026-07-27 16:28:40 +03:00