Commit Graph
278 Commits
Author SHA1 Message Date
Xubin Renandchengyongru a44f28e656 fix(webui): complete Copilot device sign-in in the browser
Reuse the device-flow adapter from #5498, expose its prompt in the existing OAuth dialog, and keep credential persistence scoped to uncancelled completion.

Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
2026-09-21 00:13:46 +08:00
Xubin Ren 448767d147 fix(webui): identify OAuth reauthentication behind fallback replies 2026-09-21 00:13:46 +08:00
Xubin Ren 024fe8f636 fix(webui): surface OAuth model catalog authorization failures 2026-09-21 00:13:46 +08:00
chengyongru 29ba4c7f2d fix(agent): remove local context tail truncation (#5820)
* fix(agent): remove local context tail truncation

* fix(agent): defer subagent type annotations

* fix(agent): require context consolidator for runner

* refactor(agent): minimize consolidator contract diff
2026-09-20 16:00:44 +08:00
Xubin Ren 8d0430c761 feat(webui): show persisted fallback preset on replies (NAN-133) 2026-09-20 15:16:35 +08:00
Arthur K.andchengyongru 0374f74bb7 fix(providers): preserve assistant content with tool calls (#5783)
* fix(providers/openai-compatible): config option to preserve message content with tool calls

* fix(providers): preserve assistant content with tool calls

---------

Co-authored-by: chengyongru <2755839590@qq.com>
2026-09-16 00:32:42 +08:00
chengyongru 0c5d8443ec fix(responses): omit provider item IDs from chat history 2026-09-12 16:45:52 +08:00
kkkhoo e5a137956f fix(responses): clean up replayed items before sending them to providers
Prevent Responses API errors when conversation history is reused in a new provider request.

Fresh and pending Chat-style history conversions no longer include stale
provider-generated item IDs, while preserving function-call IDs for tool
output linkage.

During opaque Responses state replay, remove unsupported status fields from
reasoning items before sending them to the provider. Preserve encrypted
reasoning content and other valid provider fields.

Add regression coverage for stale item IDs and replayed reasoning items with
unsupported status fields.
2026-09-12 16:45:52 +08:00
chengyongru 73410e0217 fix: stream internal model calls with idle timeouts (#5730)
* fix: stream internal model calls with idle timeouts

* fix(providers): reject streams without terminal events
2026-09-11 13:06:43 +08:00
Young Leeandchengyongru 20f115bf46 feat(providers): send x-opencode-session header for OpenCode session (#5662)
Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
2026-09-10 01:16:17 +08:00
Xubin Ren 92a297a6c8 fix(codex): refresh model catalog for Astra
The Codex catalog gates model visibility by client version. Requests advertising 0.144.0 succeed but omit Astra for an otherwise eligible account. Use the validated 0.153.4 catalog version so account discovery can expose it without changing model defaults or fallback entries.

Pin the expected wire version independently in the regression test and cover both Astra and future account models while preserving hidden-model filtering.
2026-09-09 01:03:39 +08:00
chengyongru b581a496a6 fix(ui): surface model retry status (NAN-34) (#5504) 2026-09-07 15:12:39 +08:00
KDB db918bddd3 test: stabilize flaky and environment-dependent tests
- test_catalog_bounds_failure_only_keys failed 3/5 runs on Windows: all
  three get() calls land within one time.monotonic() tick, so the eviction
  victim in _reserve() is decided by hash-seeded set iteration order among
  tied recency keys. Pin the catalog to a synthetic strictly-increasing
  monotonic clock (the constructor already accepts one) so the oldest
  entry is evicted deterministically. 5/5 stable after, 3/5 failures before.
- test_equivalent_workspace_paths_share_one_store requires directory
  symlinks, which need admin/developer mode on Windows (WinError 1314).
  Skip with the same pattern the file already uses for file symlinks.
- tests/agent/conftest.py: make_provider() assigned through a spec'd mock
  by reading provider.estimate_prompt_tokens first, which raises
  AttributeError because the attribute is not on the LLMProvider class
  spec; assign a MagicMock directly instead. Latent - no test hit the
  default-provider path until now.
2026-09-07 10:54:26 +08:00
chengyongru 972cdde8da fix(provider): preserve Codex prompt cache affinity 2026-09-03 16:09:51 +08:00
chengyongru d81aa5a4ab refactor(agent): let runner own context compaction (#5568)
* refactor(agent): consolidate accepted history under pressure

* fix(agent): align provider and session compaction

* refactor(agent): simplify runner context compaction

* refactor(agent): remove background token consolidation

* fix(agent): keep injected transcript messages distinct

* refactor(agent): unify native compaction summaries

* fix(agent): preserve native compaction boundary

* fix(agent): unify context compaction paths

* fix(agent): preserve exact compaction request boundaries
2026-09-02 18:05:54 +08:00
chengyongru e111b83af6 refactor(agent): unify runner request fitting (#5612)
* refactor(agent): unify runner request fitting

* fix(agent): fit every runner model request

* fix(agent): count resumed state during request fitting

* refactor(agent): consolidate request fitting state
2026-08-31 18:08:21 +08:00
chengyongru 6cd7063682 refactor(agent): defer transcript assembly to runner (#5608)
* refactor(agent): defer transcript assembly to runner

Keep persisted history and the fresh turn as explicit inputs until the Runner assembles the provider transcript. Preserve ContextBuilder and direct AgentRunner compatibility while making the save boundary structural.

Refs NAN-81.

* fix(providers): preserve mixed adjacent user content
2026-08-31 00:06:15 +08:00
Xubin Ren c02f013b17 fix(providers): harden OAuth model discovery 2026-08-29 21:22:20 +08:00
Xubin Ren 1c6483147e refactor(providers): localize OAuth model discovery 2026-08-29 21:22:20 +08:00
Xubin Ren 7941450a5d fix(providers): recover incomplete Grok searches 2026-08-29 21:22:20 +08:00
Xubin Ren 97fb9aaf72 fix(providers): complete OAuth model discovery 2026-08-29 21:22:20 +08:00
Xubin Ren bc4de246a4 feat(providers): discover OAuth model catalogs online 2026-08-29 21:22:20 +08:00
Xubin Ren 2389ab1f5a feat(providers): add Grok 4.6 subscription model 2026-08-29 21:22:20 +08:00
chengyongru 55f85b3c1f refactor(agent): remove duplicate progress streaming path 2026-08-27 10:56:07 +08:00
chengyongru 42f37dc4c0 fix(provider): stabilize Codex prompt cache routing (#5540) 2026-08-26 01:36:00 +08:00
chengyongru 2e7ebeb1ca fix(usage): record provider stream timing 2026-08-25 10:39:14 +08:00
chengyongru 2ac802b2d5 feat(usage): add unified provider usage backend 2026-08-25 01:22:25 +08:00
chengyongru 8bb3828487 fix(tui): preserve usage telemetry fields 2026-08-25 01:04:25 +08:00
chengyongru 9895c23cb5 refactor(providers): define typed usage contract 2026-08-25 01:04:25 +08:00
chengyongru b1cadf53c5 fix(codex): reuse TLS contexts across requests 2026-08-24 11:25:02 +08:00
Xubin Ren 48eea29313 feat(webui): unify turn observability 2026-08-22 20:51:24 +08:00
chengyongru 9ae3ae17da feat(providers): support DeepSeek V4 vision 2026-08-21 23:18:09 +08:00
chengyongru 9a6dc371b3 refactor: pass retry exhaustion callbacks explicitly 2026-08-21 16:46:38 +08:00
chengyongru f93d4c3ae4 fix(providers): retry before falling back 2026-08-21 16:46:38 +08:00
chengyongru 5b44ebdfd7 fix(providers): report Responses cached tokens 2026-08-21 14:01:00 +08:00
akinolur c7710238a8 fix(provider): retry Codex server_error
Mid-stream response.failed events from OpenAI carry
'server_error' (underscore), but the transient-error marker
list only had 'server error' (space). is_transient_response
missed it, so the retry loop gave up on the first attempt
instead of using its normal 1s/2s/4s backoff.
2026-08-21 10:52:34 +08:00
Xubin Ren 8dc08853e4 fix(providers): preserve legacy OrcaRouter custom configs 2026-08-16 00:26:51 +08:00
XiaoHuo888 fd2d419956 feat(providers): add OrcaRouter as a named gateway provider
Registers OrcaRouter (https://www.orcarouter.ai) as a built-in OpenAI-compatible gateway provider mirroring the OpenRouter wiring: registry spec (sk-orca- key prefix, default base URL), ProvidersConfig field, WebUI icon/brand + deferred model list, docs, and tests.
2026-08-16 00:26:51 +08:00
shen0122 4de728a555 fix(anthropic): treat stream idle timeout as inactivity only, not total time 2026-08-14 23:18:13 +08:00
chengyongru edec29e997 feat(providers): support DeepSeek V4 Pro Responses 2026-08-13 01:02:41 +08:00
LHMQ878 f5cf4dcd2c fix(providers): stop writing API keys into process os.environ
OpenAICompatProvider already passes api_key into AsyncOpenAI. Mutating
shared os.environ leaked credentials across providers (gateway overwrite
and setdefault first-writer-wins).

Fixes #4784
2026-08-12 02:35:40 +09:00
chengyongru 57d81bc1cd fix(providers): preserve nanobot tools with OpenRouter server tools (#5335)
* fix(providers): preserve functions with extra body tools

* docs(providers): clarify extra body tool merging
2026-08-11 18:23:27 +08:00
chengyongru ff6deda178 fix: modernize dependency recovery guidance (#5282) 2026-08-07 13:58:13 +08:00
chengyongru 67805f5db8 feat: add provider-native request switches (#5254) 2026-08-05 18:26:39 +08:00
chengyongru 4e8702a47b fix(anthropic): support Opus 5 effort controls (#5236) 2026-08-04 13:38:54 +08:00
chengyongru 44b7e1bf41 fix(providers): keep serde errors explicit 2026-08-03 18:06:45 +08:00
arcdrake22 6eda67b50c fix(providers): keep reasoning items wire-valid for DeepSeek Responses
convert_messages() emitted reasoning items with ``content`` as a plain
string whenever preserve_reasoning was enabled (the DeepSeek spec).
DeepSeek's Responses gateway rejects that shape with a serde error
("input: invalid type: string ..., expected a sequence"), which surfaced
only after token consolidation cleared provider_state and forced the
full-history conversion path; replayed server items already carry list
content, which is why normal multi-turn requests never failed. Serialize
reasoning content as a list of output_text parts, matching the OpenAI
Responses schema and DeepSeek's accepted wire shape (verified live against
api.deepseek.com/responses).

The serde fallback classifier introduced in the previous commit remains as
a last-resort safeguard for any remaining wire incompatibility.

Tests: extend test_preserves_deepseek_reasoning_content to the array shape;
add a full-history regression with the observed failing item, a
replay/consolidation regression covering both replayed and converted
reasoning items, and provider-level request fixtures for both paths.
Full suite: 5773 passed, 22 skipped (only the known local-only
channels/sms packaging failure remains).
2026-08-03 18:06:45 +08:00
arcdrake22 fb2688fd37 fix(providers): fall back to chat completions on serde body rejections
DeepSeek's new Responses endpoint (deepseek-v4-flash) intermittently rejects valid request bodies with serde deserialization errors such as 'input: invalid type: string ..., expected a sequence'. These were not classified as compatibility errors, so affected conversations died instead of falling back to Chat Completions.

The wire format is correct (input serializes as a list), so this is a server-side Responses compatibility issue; Chat Completions is strictly more permissive, making fallback safe. Extend the fallback classifier to recognize serde body-parsing markers. Repeated failures still trip the existing circuit breaker.
2026-08-03 18:06:45 +08:00
Xubin Ren e7ec981f79 test(providers): verify Eden AI gateway contract 2026-08-03 16:40:13 +08:00
arcdrake22 08fe9f7b3a fix(image): send Gemini Flash hints via generationConfig.imageConfig
The live v1beta API rejects the legacy responseFormat.image block
(enum-based aspectRatio/imageSize fields) for gemini-3.1-flash-lite-image
with INVALID_ARGUMENT, even for documented plain-string values. Gemini
Flash image models accept plain-string hints under
generationConfig.imageConfig instead (e.g. aspectRatio 16:9, imageSize
1K), which the API accepts. Switch the flash path to imageConfig and
update the provider tests accordingly. Other providers (aihubmix,
ollama, imagen) are untouched.
2026-08-03 11:22:09 +08:00