Commit Graph
2151 Commits
Author SHA1 Message Date
can1357 cb37a552f5 docs(changelog): documented the review-fix batch across packages
covers the 16-territory review fixes plus the triage follow-up round in coding-agent, ai, tui, and natives; also rewords the live-region IRC entries with fuller mechanism descriptions.
2026-06-10 01:28:24 +02:00
can1357 8a66c8786b fix(ai): surfaced Gemini stream errors and fixed Bedrock/AWS credential handling
in-band Gemini errors, promptFeedback blocks, and missing finishReason no longer report success; toolUse override stops masking SAFETY/MALFORMED finishes; schema normalization keeps DAG-shared subtrees while detecting true cycles; Google/AWS shared credential resolution detached from first caller's signal and bounded by own timeout; Bedrock keeps toolConfig under toolChoice none; eventstream cancels body on abnormal exit.
2026-06-10 01:26:31 +02:00
can1357 694a45040f fix(ai): fixed OpenAI provider stream assembly and gateway round-trips
Mistral thinking-as-text replay no longer crashes on string content; encrypted_content survives inbound reasoning parse; codex completed-handler sweeps unfinished tool calls; missing content_part synthesized on first delta; interleaved content/tool_calls no longer fragment calls; Azure completions honor AZURE_OPENAI_DEPLOYMENT_NAME_MAP; chat gateway round-trips reasoning_content; wire call_id loses internal item-id suffix.
2026-06-10 01:26:31 +02:00
can1357 2e9746ad61 fix(ai): hardened Anthropic provider streaming and gateway
retry loop honors retry-after headers; in-stream SSE error envelopes parsed structurally; duplicate message_start replays deduped; gateway rejects malformed known-type blocks, emits ping keepalives and complete terminal envelopes; image downscaling memoized per block.
2026-06-10 01:26:30 +02:00
can1357 e6ca4d5763 fix(ai): hardened core stream, retry, and abort infrastructure
abort-aware auth retry loop preserving resolver errors; EventStream.end() can no longer strand .result(); Copilot retry honors Retry-After; DSML hold-back only triggers on real section prefixes and marks capped params explicitly; idle-iterator hoists racers with bounded reaction retention; validation errors truncate embedded args; removed dead leaky iterateUntilAbort.
2026-06-10 01:26:30 +02:00
can1357 57ae61ed8a chore: bump version to 15.10.10 2026-06-09 23:20:47 +02:00
can1357 114a929d57 test(packages/ai): added Codex replay budget and flood limit tests
- Added a websocket connection-limit replay test asserting retry budget bounds.
- Added a tool-call flood scenario asserting post-tool-call whitespace deltas fail fast.
2026-06-09 23:19:55 +02:00
can1357 12a205973c test(packages/ai): added Codex test for orphan tool output folding
- Added coverage for folding orphan custom_tool_call_output into assistant messages.
2026-06-09 23:17:40 +02:00
can1357 f80d45aa6b fix(anthropic-provider): resolved Anthropic request and stream handling
- Added a 4-slot concurrency limiter for Anthropic multi-image resize work.
- Prioritized client-owned request fields and `claudeCodeVersion`-based `User-Agent` headers.
- Ignored terminal `message_delta` envelopes and treated missing `usage`/`delta` payloads as non-fatal.
- Stopped ping-only streams from consuming first-event watchdog logic and preserved timeout retries.
2026-06-09 23:17:26 +02:00
can1357 228c1ddd8d fix(openai-responses-providers): patched response flow and pairing logic
- Fixed Azure and OpenAI response flows by using stream request options, cache metadata, and replay checks.
- Fixed Codex websocket flow by clearing runtime state on reconnect failures and OPEN-state sends.
- Fixed response parsing robustness by skipping malformed signatures and repairing orphaned outputs.
- Fixed tool/result handling by mapping unknown call IDs, splitting composite IDs, and truncating duplicates.
2026-06-09 23:17:26 +02:00
can1357 ebc1e7216c fix(ai): fixed Anthropic OAuth, stop-reason, and stream retry regressions
- Exported and applied wrapFetchForCch only for OAuth Anthropic web-search calls.
- Mapped model_context_window_exceeded to "length" and mapped unknown stop reasons to "stop".
- Adjusted header and param generation to preserve caller User-Agent and gate Claude Code betas.
- Updated stream and strict-tool retry handling to clear terminal errors and prevent regressions.
2026-06-09 22:35:51 +02:00
can1357 9cfa4ce519 fix(providers): fixed OpenAI response-stream and websocket recovery handling
- Queued websocket transport errors without clearing previously queued stream frames.
- Handled response.incomplete stream events like completion for output IDs and stop reasons.
- Persisted final custom tool input and cleared parse buffers after tool-call completion.
- Blocked websocket connection-limit recovery when prior output existed and replay was unsafe.
2026-06-09 22:35:18 +02:00
can1357 cb4be79c05 fix(ai): mapped OpenRouter Anthropic adaptive reasoning to xhigh
- Exposed `xhigh` in catalog for OpenRouter Fable/Mythos and Opus 4.6+.
- Mapped user `high`/`xhigh` onto Anthropic `xhigh`/`max` effort scale.
2026-06-09 20:15:05 +02:00
can1357 7207929c72 chore: bump version to 15.10.9 2026-06-09 19:52:12 +02:00
can1357 8001ec2773 test(tests): replaced scratch repro with anthropic request-shaping tests
- Added Anthropic request-shaping coverage for adaptive and non-adaptive models in packages/ai/test.
- Removed obsolete scratch thinking test used for commit-boundary tracing in coding-agent.
2026-06-09 19:51:53 +02:00
can1357 ba5b9ed617 test(packages/ai): added Mythos and cache-control regression coverage
- Added Anthropic payload assertions for Claude Fable/Mythos 5 in alignment tests.
- Added role-to-system mapping test coverage for Claude Mythos 5 conversation messages.
- Added issue-1373 regression checks for Mythos default adaptive thinking on Bedrock.
- Added model policy expectations for Claude Mythos 5 generated metadata and effort mapping.
- Added cache-control regression test for empty assistant tool-call content in OpenAI completions.
2026-06-09 19:48:49 +02:00
can1357 abc98e7711 feat(packages/ai): added Anthropic catalog seeds and router fixes
- Seeded Anthropic curated fallback models into generation before discovery sources.
- Added claude-fable-5 and claude-mythos-5 model entries with 1,000,000 context and 128k max tokens.
- Enabled reasoning, text,image input, thinking controls, and larger limits across many models.
- Fixed OpenRouter Anthropic tool-call behavior for empty cache_control payloads.
2026-06-09 19:48:49 +02:00
can1357 7d73c88133 feat(packages/ai): added fable mythos support with adaptive tool policy
- Added Anthropic Fable and Mythos support by updating model kinds, parsing, and checks.
- Set Fable/Mythos compatibility and policy values, including 1M context, 128k max tokens, and costs.
- Enabled adaptive thinking display for claude-fable-5 and claude-mythos-5 and kept output effort low when disabled.
- Adjusted forced tool-choice and cache-control behavior for unsupported features and empty text content.
2026-06-09 19:48:49 +02:00
can1357 d8d40569d6 Merge remote-tracking branch 'origin/farm/3f9eb0f8/widen-first-event-timeout-deepseek-v4-reasoning' 2026-06-09 19:19:07 +02:00
roboomp c9c2da9c8a fix(ai): ranked antigravity bottleneck counters first
The google-antigravity ranking strategy originally returned the most-pressured
counter as primary and the runner-up as secondary. AuthStorage compares the
secondary ranking metrics before primary, so credentials with a dangerous
bottleneck but a healthy runner-up counter could outrank credentials with
balanced headroom.

Return the bottleneck as secondary and the runner-up as primary, and update the
strategy contract test to lock the ordering invariant.

Fixes #2187
2026-06-09 13:06:00 +00:00
roboomp e64aa62682 fix(ai): rotated google-antigravity accounts when capacity exhausted
Cloud Code Assist's quota-exhaustion 429 carries 'You have exhausted your
capacity on this model. Your quota will reset after …'. The literal
'capacity' hit the MODEL_CAPACITY_EXHAUSTED branch in parseRateLimitReason
before the 'quota will reset' suffix had a say, downgrading the failure to
a 45-75s transient backoff; isUsageLimitError missed the same shape, so
agent-session.ts (line 8314) and auth-storage.ts (line 3457) never invoked
markUsageLimitReached. The session kept hammering the exhausted credential
while the retry layer bailed on the multi-hour retry-after, even when
sibling Antigravity OAuth accounts had headroom.

- Short-circuit parseRateLimitReason for 'quota will reset' / 'exhausted
  your capacity' to QUOTA_EXHAUSTED before the MODEL_CAPACITY fallthrough.
- Extend USAGE_LIMIT_PATTERN so isUsageLimitError matches the Antigravity
  phrasing too, enabling credential-rotation paths in agent-session,
  auth-retry, stream, and the auth-gateway.
- Add antigravityRankingStrategy and register it under
  DEFAULT_RANKING_STRATEGIES so multi-account selection consumes the
  per-counter Antigravity usage report (already sorted ascending by
  remainingFraction in fetchAntigravityUsage) instead of falling back to
  round-robin.
- Cover the regression with parseRateLimitReason / isUsageLimitError tests
  on the literal Antigravity message, plus a ranking-strategy contract
  test asserting primary/secondary mapping and the 24h fallback window.

Fixes #2187
2026-06-09 13:00:42 +00:00
roboomp f5f4f2265b fix(ai): widen first-event watchdog for DeepSeek V4 reasoning
DeepSeek V4 reasoning models on api.deepseek.com emit no SSE bytes
while the model finishes its private chain-of-thought, which routinely
takes longer than the generic 100s first-event budget under load.
The OpenAI completions stream then aborts with
"OpenAI completions stream timed out while waiting for the first event"
and silently retries, doubling user-visible latency on almost every chat.

getOpenAICompletionsStreamIdleTimeoutFallbackMs now returns a 300s
floor for reasoning models when (provider === "deepseek") or
(baseUrl includes api.deepseek.com). first-event floors at idle, so
the watchdog gains 5 minutes — enough for reasoning warm-ups — without
changing steady-state streaming behavior. Mirrors the existing GLM
coding-plan widening.

Fixes #2177
2026-06-09 09:16:41 +00:00
can1357 74d4f00928 chore: bump version to 15.10.8 2026-06-09 05:06:04 +02:00
can1357 eb1a46baf5 feat: added injectable fetch transport across AI and coding network flows
- Added optional FetchImpl fields to compaction, proxy, AI, coding-agent, and mnemopi options.
- Threaded injected fetch implementations through OAuth, discovery, and search/LLM request flows.
- Removed exported hookFetch utility and its package entrypoint from utils.
- Replaced global-fetch test monkeypatching with per-test FetchImpl mocks across test suites.
2026-06-09 04:51:17 +02:00
can1357 af33e4055e fix(ai): omitted max token capping for OpenRouter completions
- Added OpenRouter detection in openai-completions parameter construction and skipped max-token emission for non-Kimi OpenRouter routes.
- Preserved existing 64k-cap clamping behavior for non-OpenRouter requests and model-specific limits.
- Expanded max-output-token tests to cover OpenRouter omission behavior and Kimi-over-OpenRouter token handling.
2026-06-09 04:50:58 +02:00
can1357 05aad9c39b feat(ai): added upstream provider attribution and capped OpenAI output-token requests
- Added `AssistantMessage.upstreamProvider` and emitted it as `pi.gen_ai.response.upstream_provider` telemetry.
- Clamped OpenAI-family output caps to `OPENAI_MAX_OUTPUT_TOKENS` and model limits to avoid oversized token requests.
2026-06-09 03:34:53 +02:00
can1357 c57d8b18b2 fix(ai/codex): recovered from whitespace-only tool-call argument loop
- Stopped aborting the shared per-request AbortController, which latched and blocked stream reopens.
- Dropped the half-built degenerate tool call and replayed the request, bounded by a retry limit of 2.
- Surfaced the original error once retries are exhausted, without polluting the message.
2026-06-09 02:33:44 +02:00
can1357 1a2602ce92 chore: bump version to 15.10.7 2026-06-09 00:32:37 +02:00
can1357 8f4a7955a1 chore: reformat 2026-06-09 00:27:10 +02:00
can1357 8a32d2ab33 Merge remote-tracking branch 'origin/farm/36563f95/strip-context-management-on-forced-tool-choice' 2026-06-09 00:26:38 +02:00
can1357 521efb385d Merge remote-tracking branch 'fork-basedcorp99/fix-antigravity-zero-usage' 2026-06-09 00:26:27 +02:00
roboomp abc2fe663f style: bun run fix 2026-06-08 21:56:11 +00:00
roboomp 4461d89617 fix(ai): preserve completed thinking signatures when a turn is aborted mid-output
Interrupting the model during its visible output produced an assistant turn
whose thinking block had already finished streaming (fully signed) followed
by partial text. `transformMessages` stripped the signature from every
thinking block of an aborted/errored turn, so the valid signature was
replayed empty (`signature: ""`) and signature-enforcing Anthropic
rejected the next request with HTTP 400 "Invalid `signature` in
`thinking` block" — including when routed through an LLM gateway baseUrl.

Anthropic delivers a block's signature at `content_block_stop` before the
next block's `content_block_start`, so a thinking block followed by
text/tool_use is necessarily complete and valid. Only the single mid-stream
block at the abort point can hold a partial signature. Strip just that
final block now; completed thinking blocks keep their replayable
signatures. Abandoned end_turn+tool_use turns are unchanged (all their
signatures remain stripped).

Co-authored-by: DeprecatedLuke <16418011+DeprecatedLuke@users.noreply.github.com>
Fixes #2144
2026-06-08 21:55:23 +00:00
can1357 53e74c9e68 test(ai): expect provider-qualified modelId in pi-native client request
The auth-gateway client now sends `${provider}/${id}` (008981112) and the
gateway registry keys on the qualified id first. Update the stale request-shape
assertion that still expected the bare `claude-sonnet-4-5`.
2026-06-08 22:52:42 +02:00
roboomp 85891a5784 test(ai): locked orphan context_management strip on forced tool_choice
Pins issue #2123: OAuth requests to adaptive-thinking Claude Opus
(4.6+) attach a 'context_management.edits[clear_thinking_20251015]'
block alongside 'thinking'. When the eager-todo prelude (and other
plan-mode paths that force tool_choice to 'tool'/'any' on the first
user turn) routes through 'disableThinkingIfToolChoiceForced',
'params.thinking' is stripped; 15.10.4 left the orphan
'params.context_management' behind, producing a 400 with
'clear_thinking_20251015 strategy requires thinking to be enabled
or adaptive'. The 15.10.5 fix in 0890b2be6 already drops both
fields together — the new repro test asserts this invariant for
both the named-tool and 'any' forced shapes so the strategy can
never outlive its enabling thinking payload again.

Fixes #2123
2026-06-08 20:46:20 +00:00
can1357 7d2eb3c550 chore: bump version to 15.10.6 2026-06-08 22:39:20 +02:00
can1357 0089811129 fix(coding-agent/cli): qualified model IDs to avoid cross-provider collisions
- Updated PI native streaming requests to send model identifiers as provider-qualified keys.
- Updated the auth-gateway model registry to store `${provider}/${id}` first and retain legacy bare IDs as fallback keys.
2026-06-08 22:31:34 +02:00
can1357 eca1623b83 chore(ai): align AIML registry import 2026-06-08 15:50:12 -03:00
can1357 5ec1814f66 fix(ai): exclude AIML media models 2026-06-08 15:48:21 -03:00
can1357 2b569f8518 fix(ai): filter AIML chat catalog 2026-06-08 15:48:21 -03:00
can1357 59a688f5c0 fix: address easy issues review 2026-06-08 15:47:57 -03:00
can1357 8f23ba511b fix: close several easy issues 2026-06-08 15:47:21 -03:00
basedcorp99 0dbe34fcb1 fix(usage): separate Antigravity backend counters 2026-06-08 19:53:10 +02:00
can1357 348ba44293 chore: bump version to 15.10.5 2026-06-08 19:11:24 +02:00
can1357 f8c214574f test: migrated repro test to package subpath imports
- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` subpaths.
2026-06-08 19:10:47 +02:00
can1357 502c5bfae4 Merge remote-tracking branch 'origin/farm/461547d7/fix-moonshot-kimi-k26-empty-stream' 2026-06-08 19:08:40 +02:00
can1357 9edf773b81 feat(coding-agent): centralized tool filtering for discovery mode with forced tool activation
- Introduced filterInitialToolsForDiscoveryAll() to centralize tool filtering when discovery mode is "all", replacing inline logic in createAgentSession.
- Added forceActive parameter to ensure tools required by forced tool_choice features (e.g., eager todo) remain active in the request, preventing provider 400 errors.
- Updated eager todo enforcement to check active tool set instead of registry, ensuring it respects tool discovery hiding.
2026-06-08 19:08:31 +02:00
can1357 9d457f73d9 test: migrated test imports to package subpath exports
- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths.
2026-06-08 19:03:55 +02:00
can1357 e79415e78b revert: codex obfuscation parameters 2026-06-08 19:03:49 +02:00
can1357 31b6f0bf31 refactor(ai): consolidated provider config into single-source registry
- Derived descriptors, default-model map, env keys, login list, and refresh dispatch from one ProviderDefinition per provider.
- Disabled OpenAI Codex stream obfuscation and interrupted whitespace-only tool-call argument deltas.
- Derived auth-broker callback ports and paste-code login set from the registry.
2026-06-08 18:48:43 +02:00