Skip to content

chore: sync upstream v7.3.4 - #6

Merged
t1sh0o merged 380 commits into
mainfrom
chore/sync-upstream-v7.3.4
Sep 16, 2026
Merged

t1sh0o merged 380 commits into
mainfrom
chore/sync-upstream-v7.3.4

Conversation

@t1sh0o

@t1sh0o t1sh0o commented Sep 16, 2026

Copy link
Copy Markdown

Summary

Merge upstream v7.3.4 into the fork (previous base: v7.2.140, synced Aug 24 in #5).

Motivation — the Claude Code fingerprint UA. v7.2.140 hardcodes claude-cli/2.1.220 as the Claude fingerprint User-Agent. Anthropic rejects that version for claude-fable-5-1, which needs >= 2.1.251. Upstream v7.3.4:

  • bumps defaultClaudeFingerprintUserAgent to claude-cli/2.1.258 (external, cli) (internal/runtime/executor/helps/claude_device_profile.go:23);
  • adds a configurable claude-header-defaults block (internal/config/config.go:147, documented in config.example.yaml:707) so the UA, version fields and client-detection timeout can be set from config instead of being compiled in.

Everything else is routine upstream drift (Codex/Antigravity/Grok/Kimi fixes, Meta OAuth, executor refactors).

Conflicts and how they were resolved

  1. README.md — kept the fork's version verbatim (--ours). The fork README is the AMPECO patch log, not upstream's product README; upstream's changes were sponsor/doc churn.
  2. internal/translator/openai/claude/openai_claude_request_test.go — kept both sides: our cache_control tests (..._PreservesContentWhenStrippingCacheControl, TestStripCacheControl_IsIdempotent) and upstream's new ..._ToolWithoutInputSchemaDefaultsParameters / patternProperties tests. gofmt clean.

Auto-merged with no conflict, patch intent verified by hand:

  • Patch 1 (reasoning fallback in the OpenAI→Claude response path) — intact in openai_claude_response.go, comment and fallback both present.
  • Patch 2 (cache_control strip in the Claude→OpenAI request path) — intact; stripCacheControl still applies inside convertClaudeRequestToOpenAI so both the plain and WithCompat entry points are covered.
  • Patch 4 (strip Claude entries from the antigravity catalog) — upstream's models.json ships 12 antigravity entries including claude-opus-4-6-thinking and claude-sonnet-4-6; the merged tree has the 10 non-Claude entries and neither Claude one. .github/scripts/refresh-model-catalogs.sh (the post-refresh strip run by every build job) survived untouched.
  • Patch 3 stays retired (upstream detects OAuth tokens natively; the deployment uses OAuth credential files).

Verification

  • CGO_ENABLED=0 go build ./... — clean. (CGO_ENABLED=1 fails locally only on an unaccepted Xcode licence, not on code; CI builds with CGO on its own runners.)
  • go test ./... — 96 packages ok. One package fails: internal/runtime/executor (TestMetaExecutor_ExecuteSuccessAndRateLimit, TestOpenAICompatExecutorToolResultContentByInputModalities). Pre-existing upstream breakage — the same two tests fail identically on a pristine v7.3.4 worktree with none of our patches applied. Nothing in this merge touches them.
  • go test ./internal/translator/openai/claude/ — ok, all fork patch tests pass. go vet clean on that package.

Cutting the release (after this merges — not done here)

The workflow fires on any pushed tag; RELEASE_VERSION is the tag with the leading v stripped, so v0.1.6-ampeco produces CLIProxyAPI_0.1.6-ampeco_darwin_aarch64.tar.gz (the same shape as v0.1.5-ampeco). prepare-release creates the GitHub release, then build-hosted / the Linux+FreeBSD jobs upload their archives plus checksums.txt.

git checkout main && git pull
git tag -a v0.1.6-ampeco -m "sync upstream v7.3.4 (claude-cli/2.1.258 fingerprint)"
git push origin v0.1.6-ampeco
gh run watch -R ampeco/CLIProxyAPI "$(gh run list -R ampeco/CLIProxyAPI -w release -L1 --json databaseId -q '.[0].databaseId')"
gh release view v0.1.6-ampeco -R ampeco/CLIProxyAPI   # expect CLIProxyAPI_0.1.6-ampeco_darwin_aarch64.tar.gz

Story: sc-1282470

🤖 Generated with Claude Code

https://claude.ai/code/session_01VuxEAEJGjppWEdZHwuoUFk

sususu98 and others added 30 commits September 4, 2026 18:21
… developer messages (router-for-me#5490)

- Responses API: only hoist developer/system messages before conversation starts to systemInstruction, keeping token 0 cache prefix immutable. Demote mid-session developer messages to user role and merge consecutive user turns via MergeAdjacentGeminiUserContents without crossing functionResponse boundaries.
- Tool Call Buffer: buffer mid-session developer messages during pending function calls and emit after functionResponse, preserving valid tool pairing and reason replay.
- Chat Completions API: apply the same leading/mid-session distinction for system/developer messages and guard against empty parts.
- Claude Messages API: align role: "developer" in messages with role: "system", demoting to <system-reminder> user turns and avoiding upstream 400s.
- Validation: update ValidateGeminiFunctionCallPairing to allow intervening user turns before functionResponse, matching upstream Antigravity tolerance.
- Role Normalization: ensure functionResponse turns in Antigravity are always normalized to role: "user".
…nd config loading

- Make optional config loading fail on malformed YAML or validation errors
- Separate DCA token expiry from minted API key expiry in Meta token storage
- Remove global runtime fallbacks from MetaExecutor to prevent cross-account bleed
- Deduplicate inflight DCA minting using singleflight.Group and persist refreshed keys
- Resolve Meta API key in management APICall tool and support DCA minting
- Align models.json with supported chat endpoints and valid thinking levels
- Expand unit tests covering DCA refresh, singleflight, multi-account isolation, and APICall
- Include Meta API key count in client load metrics and diff reporting
…tions

- Add `gpt-6-astra` model specifications and capabilities to registry models.
- Update Codex client models configuration and instructions for `gpt-6-astra`.
- Bump default Codex client version and user-agent to `0.153.3` in model fetcher tool.
- Retain `supported_reasoning_levels` as an empty array instead of deleting the key when no reasoning levels are supported or compatible.
- Continue deleting `default_reasoning_level` when reasoning levels are empty.
- Remove `gpt-5.4` and `gpt-5.4-mini` specifications from registry models.
- Remove deprecated `gpt-5.4` configuration from Codex client models.
- Normalize `generationConfig.thinkingConfig.thinkingLevel` to canonical uppercase enum values (`MINIMAL`, `LOW`, `MEDIUM`, `HIGH`).
- Prevent upstream HTTP 400 invalid argument errors caused by case-sensitive validation.

Closes: router-for-me#5481
…escans

- Track auth revisions and file observations to detect changes that occur while background auth scans are in flight.
- Invalidate and drop stale scanned auth records in `refreshAuthState` when concurrent file modifications or deletions are observed.
- Reject out-of-order delayed snapshot updates in `dispatchAuthUpdates` using watcher-local revision counters.

Closes: router-for-me#5528
… or results

- Detect advisor tool calls and advisor results in conversation history.
- Preserve forwarded system prompt blocks in top-level system instead of splicing them into message turns or prepending reminders.
- Prevent message index shifts that break layout bindings for encrypted advisor results and trigger upstream 400 errors.

Closes: router-for-me#5470
…e quota resets

- Mark Codex usage limit errors as credential-scoped across HTTP and WebSocket executors.
- Support both top-level and nested error structures with case-insensitive matching when parsing retry-after resets.
- Propagate prevalidated candidate context to session affinity and built-in selectors during auth selection.

Closes: router-for-me#5529
…reporting queue

- Reuse coresession.ExtractSessionInfo across HTTP headers and request payloads to unify canonical session prefix namespaces with the scheduler.
- Extract hierarchical session identities in two phases: initial extraction from request headers on entry, and authoritative deep extraction once request payloads and metadata are available.
- Support Claude Code multi-level subagents (X-Claude-Code-Agent-Id, metadata.agent_id) and Codex thread fork lineages.
- Propagate SessionID and ParentSessionID across ClientRequestMetadata, UsageReporter, and coreusage.Record without root_session_id.
- Include session_id and parent_session_id in queuedUsageDetail for Home LPushUsage forwarding and Redis consumption with self-loop guards.
- Add comprehensive test coverage for canonical headers, body extraction, ghost parent elimination, and self-referential loop guards.
- Update default Codex executor user-agent and model override headers to `codex-tui/0.153.3`.

Closes: router-for-me#5521
- Add `upsertAuthResult` to incrementally update only affected model shards after request completion.
- Cache supported model sets per auth using registry epoch tracking to avoid redundant lookups.
- Preserve full shard synchronization for auth lifecycle events and credential-scoped results.

Closes: router-for-me#5061
sususu98 and others added 26 commits September 14, 2026 14:25
- Add `stream-bootstrap-timeout` configuration (defaulting to 0/unlimited, recommended 20s behind reverse proxies) to bound how long early handshake or trickled events may hold response headers.
- Release stream buffering into normal in-stream delivery once the time budget is exhausted on both SSE and WebSocket executors.
- Deliver post-timeout overload and status-bearing errors in-stream rather than triggering credential failover, preventing latency doubling on long reasoning turns.
- Provide thread-safe mock clock test harness and comprehensive unit tests covering timeout release, unlimited default, disabled ceilings, and post-timeout error delivery.
…ootstrap-timeout

feat(codex): add optional time ceiling for stream bootstrap buffering
Skip plugin bootstrap for legacy --discover/--discover-json so logrus
cannot prefix JSON stdout, and let CLI/config include lists scan
non-default adapters such as docker0.
Empty --config now resolves to the working-directory config.yaml, and
link-local fallback hostnames are restricted to DNS-safe labels before
they are printed.
Always advertise CPA-<ID> or <service-name>-<ID> so LAN instance names
are unique from local state instead of probing mDNS at process start.
Extract parseDevinManualPaste for headless and loopback login, return
access_denied (and CSRF mismatches) instead of an unrecognized-format
error, collapse authorization URL query construction, and lock the
headless URL shape plus paste edge cases in tests.
Load scan filters without full config normalization, honor --timeout
exactly, stop argv pre-scan at --, restart ads when interface indexes
change, and reject UDP DNS-SD service types.
…ode-login

feat(devin): support port-free manual code login in no-browser mode and align OAuth URL parameter order
…way-discovery

feat(discovery): introduce mDNS/DNS-SD LAN service advertising and CLI discovery
…call

- Ensure `methodBytes` and `request` are kept alive across dynamic library invocation on Windows to prevent premature garbage collection.

Closes: router-for-me#5807
… envelopes

- Add `Error.Error`, `Error.StatusCode`, `NewError`, and `NewErrorEnvelope` helpers in `sdk/pluginabi`.
- Support extracting and forwarding HTTP status codes in Go plugin executor examples and generator script.
- Document plugin executor error handling and client HTTP status mapping conventions.

Closes: router-for-me#5809
… routing

- Verify observed compaction response replay and retention across subsequent turns.
- Test plugin route overrides, provider auth pinning, and home runtime auth handling during compaction.

Closes: router-for-me#5811
… execution

- Add `ForcedProvider` and `AuthID` fields to `HostModelExecutionRequest` and `ModelExecutionRequest`.
- Pin credentials via `WithPinnedAuthID` and forward forced provider options during model execution and streaming.
- Forward forced provider and auth ID from plugin host callbacks to model execution handlers.

Closes: router-for-me#5814
…d actions

- Add tests to verify that runtime hooks, auth modifications, and related updates do not block on unrelated operations such as antigravity probes or plugin virtual models.
- Introduce detailed scenarios, e.g., stale disables, batch operations, and conflict handling during concurrent auth updates.
- Refactor locking mechanisms to avoid unnecessary blocking during hooks and model registrations.

Fixed: router-for-me#5813
Closes: router-for-me#5773
…s payload

- Introduce `sanitizeGeminiInteractionsUnsupportedInputIDs` to remove `id` fields from Gemini interactions `input` and `content` items.
- Update execution logic to apply the sanitization process before upstreaming payloads.
- Add tests to ensure payloads are correctly sanitized and validate `call_id` pairing for Gemini interactions.

Closes: router-for-me#5828
…ed tests

- Introduce `isTransientTransportError` to identify transient transport errors such as TLS handshake, DNS, and connection resets.
- Extend retry logic to handle these errors without enforcing credential cooldown.
- Add new constants, such as `ErrorCodeTransientTransport`, to categorize and manage these errors.
- Refactor `conductor_selection` to distinguish request-retry round errors.
- Add comprehensive tests covering transport retries, cooldown behavior, and transient error handling.

Closes: router-for-me#5829
…AI and Gemini translators

- Introduce logic to convert orphaned or unpaired `function_call_output` into user text instead of mismatched tool responses.
- Add `buildOpenAIResponsesStandaloneToolOutputTextParts` and `appendStandaloneResponsesToolOutputAsUser` helpers for managing orphaned outputs.
- Update OpenAI, Gemini, and Antigravity translators to ensure unmatched tool outputs are surfaced correctly.
- Add comprehensive test cases for both Gemini and OpenAI translator workflows to validate behavior for orphan function outputs and explicit call IDs.

Closes: router-for-me#5831
- Introduce `promoteOpenAIResponsesReasoningTextToSummary` to move `reasoning_text` parts from content to summary when the summary is empty.
- Clear `reasoning.content` to comply with Codex schema constraints (`maxItems: 0`).
- Implement safeguards for handling cleartext reasoning, preserving valid encrypted content, and stripping invalid `encrypted_content`.
- Add comprehensive tests to validate behavior for promoting reasoning texts, preserving existing summaries, and ensuring sanitization rules.

Closes: router-for-me#5825
…a-summary

feat(plugin-quota): add typed summary metrics
…son logic

- Introduce `hasValidToolCallArguments` to validate tool call arguments in OpenAI response translation.
- Update `effectiveOpenAIFinishReason` logic to consider argument validity for determining finish reasons like `tool_calls` or `length`.
- Extend finish reason assignment during response parsing to ensure robust handling of invalid or truncated tool call arguments.
- Add comprehensive test coverage for various tool call argument scenarios and finish reason outputs.

Closes: router-for-me#5836
Bring in native Meta (Muse Code) provider support while keeping the
existing Devin integration and original Meta commit history.
- Introduced `MetaExecutor` to support native Meta (Muse Code) API operations, including `Execute`, `ExecuteStream`, and `CountTokens`.
- Added logic to handle Meta-specific `responses` endpoint, including request preparation, enriched authentication, header management, and response translation.
- Implemented token counting functionality with custom `CountTokens` logic.
- Updated `meta_executor` to process streamed and non-streamed responses, maintaining compatibility with the Codex schema.
- Added utility functions to handle events, errors, and enriched metadata common to Meta API requests.
- Extended `models.json` to include Meta's updated configuration with additional thinking levels like "minimal" and "max."
- Introduced comprehensive tests to validate Meta-specific execution, streaming, header assignments, and response formatting.
- Introduced `meta` as a supported OAuth channel for model aliasing and request-scoped error rules.
- Added alias config to rename `muse-spark-1.3` as `muse-latest` with enforced mapping and fork behavior.
- Extended error rules for `meta` to classify "context_length_exceeded" responses with status `400` as `stop` actions.
- Updated examples and synthesizer logic to merge exclusions and apply Meta-specific mechanisms.
Sync the fork with upstream v7.3.4 (previous base: v7.2.140).

Motivation: the hardcoded Claude Code fingerprint User-Agent in v7.2.140
(claude-cli/2.1.220) is rejected by Anthropic for claude-fable-5-1, which
requires >= 2.1.251. v7.3.4 defaults to claude-cli/2.1.258 and adds a
configurable `claude-header-defaults` block.

Conflicts resolved:
- README.md: kept the fork's AMPECO patch log verbatim (ours).
- internal/translator/openai/claude/openai_claude_request_test.go: kept both
  sides - the ampeco cache_control tests and upstream's new tool/schema tests.

AMPECO patches preserved: reasoning fallback (response), cache_control strip
(request), antigravity Claude catalog strip (models.json +
.github/scripts/refresh-model-catalogs.sh).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VuxEAEJGjppWEdZHwuoUFk
@github-actions

Copy link
Copy Markdown

This repository does not allow modifying AGENTS.md in pull requests.

Detected changes:

  • AGENTS.md

Please revert these changes and open a new PR without touching AGENTS.md.

@github-actions github-actions Bot closed this Sep 16, 2026
@t1sh0o t1sh0o reopened this Sep 16, 2026
@t1sh0o
t1sh0o merged commit 57f43d8 into main Sep 16, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.