Skip to content

fix(amp): proxy thread actors route#1

Open
edlsh wants to merge 636 commits intodevfrom
fix/amp-thread-actors-route
Open

fix(amp): proxy thread actors route#1
edlsh wants to merge 636 commits intodevfrom
fix/amp-thread-actors-route

Conversation

@edlsh
Copy link
Copy Markdown
Owner

@edlsh edlsh commented May 6, 2026

Summary

  • proxy Amp's new /api/thread-actors endpoint through the Amp upstream proxy
  • add route coverage for POST /api/thread-actors

Verification

  • git diff --check
  • env -u AMP_API_KEY -u AMP_URL -u RIVET_PUBLIC_ENDPOINT go test ./internal/api/modules/amp -count=1
  • env -u AMP_API_KEY -u AMP_URL -u RIVET_PUBLIC_ENDPOINT go build -o test-output ./cmd/server && rm test-output

Notes

  • Full go test ./... still has unrelated upstream failures in internal/registry and internal/runtime/executor on current origin/main.

lonr-6 and others added 30 commits April 3, 2026 17:11
fix qwen invalid_parameter_error
…-tool-repair-v2

fix: repair responses websocket custom tool call pairing
…inking-temperature

Normalize Claude temperature when thinking is enabled
…d-prefix-field

Feat(vertex): add prefix field
feat: 升级反重力 (antigravity) UA 版本为 1.21.9
Fetch the latest version from the antigravity auto-updater releases
endpoint and cache it for 6 hours. Falls back to 1.21.9 if the API
is unreachable or returns unexpected data.
feat: 动态获取 Antigravity User-Agent 版本号
Introduce `StartAntigravityVersionUpdater` to periodically refresh the cached Antigravity version using a non-blocking background process. Updated main server flow to initialize the updater.
Added Poixe AI sponsorship information, including referral bonuses and platform capabilities, to README files in English, Japanese, and Chinese. Updated assets to include Poixe AI logo.
Added comprehensive support for resolving proxy URLs from configuration based on API key and provider attributes. Introduced new helper functions and extended the test suite to validate fallback mechanisms and compatibility cases.
…unctions

Added comprehensive tests to ensure key order is maintained when modifying payloads in `normalizeCacheControlTTL` and `enforceCacheControlLimit` functions. Removed unused helper functions and refactored implementations for better readability and efficiency.
…laude

ensureAmpSignature injects signature:"" into tool_use blocks so the
Amp TUI does not crash on P.signature.length. when Amp sends the
conversation back, Claude rejects the extra field with 400:
  tool_use.signature: Extra inputs are not permitted

strip the proxy-injected signature from tool_use blocks in
SanitizeAmpRequestBody before forwarding to the upstream API.
…ved-thinking-amp-gzip-budget

fix(claude): enable interleaved-thinking beta, decode AMP error gzip, fix budget 400
Reconcile registry model states on auth changes
…-branch

feat(gitstore): add support for specifying git branch (via GITSTORE_G…
…nking-signature

fix: preserve Claude thinking signatures in Codex translator
…de-safe-alignment-sentinels

test(claude): add compatibility sentinels and centralize builtin fallback handling
…e-signature

fix(amp): strip signature from tool_use blocks before forwarding to Claude
…en-usage-fix

Fix missing `response.completed.usage` for late-usage OpenAI-compatible streams
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
luispater and others added 28 commits May 3, 2026 22:26
- Added functions to handle tool conversion, including namespace-based tools and web search tools.
- Improved parameter normalization and tool input schema standardization.
- Integrated logic to handle qualified tool names and map override functionality.
- Refactored existing tool processing for better extensibility and maintainability.

Fixed: router-for-me#3199
- Added `filterKimiEmptyAssistantMessages` to identify and remove empty assistant messages with no content, tool links, or reasoning.
- Integrated logging to track the number of dropped messages.
- Updated tests to validate the filtering logic for both empty and valid assistant messages.

Fixed: router-for-me#1730
… channel sends

All streaming executors use bare channel sends (out <- chunk) inside goroutines
that process upstream SSE responses. When the downstream consumer disconnects
(client timeout, network drop, etc.), these sends block indefinitely, causing
the goroutine and all associated resources (HTTP response body, scanner buffers,
translation state) to leak permanently.

Over time, leaked goroutines accumulate monotonically, leading to RSS growth
from ~30MB to 3.7GB+ and eventual OOM kills on resource-constrained VPS hosts.

Fix: Replace all bare 'out <- ...' sends with:
  select {
  case out <- ...:
  case <-ctx.Done():
    return
  }

This ensures goroutines terminate promptly when the request context is canceled,
allowing GC to reclaim all associated resources.

Affected executors (9 files, 36+ send sites):
- antigravity_executor.go (5 sites)
- gemini_cli_executor.go (6 sites)
- gemini_vertex_executor.go (6 sites)
- aistudio_executor.go (4 sites)
- gemini_executor.go (3 sites)
- openai_compat_executor.go (3 sites)
- claude_executor.go (4 sites)
- codex_executor.go (2 sites)
- kimi_executor.go (3 sites)
- Implemented `validateClaudeStreamingResponse` to ensure upstream streaming data integrity.
- Added new tests to verify response validation, including empty streams, error events, incomplete streams, and valid streams.
- Integrated validation logic into the Claude executor's streaming handler, returning detailed errors for malformed upstream data.

Fixed: router-for-me#2193
…tool-output-mismatch

fix(websocket): skip stale state merge after client-side compact
- Skip setting values for non-string `type` fields to prevent runtime errors.

Closes: router-for-me#2226
- Added logic to reset `pinnedAuthID` and replay transcript on unauthorized, forbidden, or throttling errors.
- Enhanced error handling in `forwardResponsesWebsocket` with detailed status inspection.
- Introduced `shouldReleaseResponsesWebsocketPinnedAuth` to determine auth reset conditions.
- Updated state management to preserve prior request and response data during forced replay.

Fixed: router-for-me#2230
- Added `setToolCallOutputContent` to process various content types, including arrays and fallback cases.
- Implemented robust handling for specific tool output types like text, image URLs, and files, ensuring proper serialization.
- Improved fallback logic to handle unexpected or missing data.

Fixed: router-for-me#2313
Closes: router-for-me#2349
…jectid

fix(gemini-cli): use backend project ID from onboarding response
- Moved `ApplyThinking` logic earlier in `openai_compat_executor` to align with configuration application sequence.
- Added test to verify payload override precedence over Thinking suffix configuration.
- Introduced `claudeUsageTokens` struct for detailed token usage tracking.
- Replaced `calculateClaudeUsageTokens` with `Merge` and `OpenAIUsage` methods for better modularity.
- Enhanced integration of usage tokens into response processing, enabling more accurate reporting of token details.

Fixed: router-for-me#2419
…ency

- Integrated `StripVertexOpenAIResponsesToolCallIDs` to remove tool call ID data from request bodies and translated requests.
- Ensures uniformity and avoids unnecessary payload data propagation.

Fixed: router-for-me#2549
…sponses

- Added check to prevent processing of empty `function.name` values, ensuring valid data is handled.

Fixed: router-for-me#2557
- Added trimming for stream input lines to prevent processing of unnecessary whitespace.
- Improved handling of unsupported prefixes and malformed JSON responses, ensuring errors are recorded and propagated appropriately.

Fixed: router-for-me#2690
…e-per-request-map

fix(amp): smart-mode tool name fixes + deep-mode response repair
…protocol-parity

Align Codex websocket protocol semantics
- Introduced methods for setting and retrieving model aliases in execution and usage contexts.
- Enhanced `UsageReporter` and related structures to include client-requested aliases.
- Updated tests to validate alias propagation and ensure correct usage reporting.
- Adjusted metadata handling in CLIProxyAPI executors to address alias integration.
- Implemented `/v0/management/usage` endpoint for fetching queued usage records from Redis.
- Included validation for `count` parameter to ensure positive integers.
- Added unit tests for queue retrieval and validation, with authentication validation in integration tests.
- Updated management routing to include the new endpoint.
… routes/tests

- Renamed handler and test methods for better clarity on functionality.
- Updated route from `/v0/management/usage` to `/v0/management/usage-queue`.
- Adjusted integration and unit tests to reflect new naming and routes.
- Replaced sponsor `z.ai` with `PackyCode` and updated related descriptions, images, and links in `README.md`, `README_CN.md`, and `README_JA.md`.
- Removed outdated sponsor entries for `Poixe AI` in all README files.
- Added new image assets for PackyCode (`packycode-cn.png` and `packycode-en.png`).
@github-actions github-actions Bot changed the base branch from main to dev May 6, 2026 17:14
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

This pull request targeted main.

The base branch has been automatically changed to dev.

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.