sususu98
cf249586a9
feat(antigravity): configurable signature cache with bypass-mode validation
...
Antigravity 的 Claude thinking signature 处理新增 cache/bypass 双模式,
并为 bypass 模式实现按 SIGNATURE-CHANNEL-SPEC.md 的签名校验。
新增 antigravity-signature-cache-enabled 配置项(默认 true):
- cache mode(true):使用服务端缓存的签名,行为与原有逻辑完全一致
- bypass mode(false):直接使用客户端提供的签名,经过校验和归一化
支持配置热重载,运行时可切换模式。
校验流程:
1. 剥离历史 cache-mode 的 'modelGroup#' 前缀(如 claude#Exxxx → Exxxx)
2. 首字符必须为 'E'(单层编码)或 'R'(双层编码),否则拒绝
3. R 开头:base64 解码 → 内层必须以 'E' 开头 → 继续单层校验
4. E 开头:base64 解码 → 首字节必须为 0x12(Claude protobuf 标识)
5. 所有合法签名归一化为 R 形式(双层 base64)发往 Antigravity 后端
非法签名处理策略:
- 非严格模式(默认):translator 静默丢弃无签名的 thinking block
- 严格模式(antigravity-signature-bypass-strict: true):
executor 层在请求发往上游前直接返回 HTTP 400
按 SIGNATURE-CHANNEL-SPEC.md 解析 Claude 签名的完整 protobuf 结构:
- Top-level Field 2(容器)→ Field 1(渠道块)
- 渠道块提取:channel_id (Field 1)、infrastructure (Field 2)、
model_text (Field 6)、field7 (Field 7)
- 计算 routing_class、infrastructure_class、schema_features
- 使用 google.golang.org/protobuf/encoding/protowire 解析
- resolveThinkingSignature 拆分为 resolveCacheModeSignature / resolveBypassModeSignature
- hasResolvedThinkingSignature:mode-aware 签名有效性判断
(cache: len>=50 via HasValidSignature,bypass: non-empty)
- validateAntigravityRequestSignatures:executor 预检,
仅在 bypass + strict 模式下拦截非法签名返回 400
- 响应侧签名缓存逻辑与 cache mode 集成
- Cache mode 行为完全保留:无 '#' 前缀的原生签名静默丢弃
2026-04-09 21:12:40 +08:00
sowar1987
9c2992bfb2
test: align signature cache tests with cache behavior
...
Co-Authored-By: Warp <agent@warp.dev >
2026-01-22 17:12:47 +08:00
sowar1987
22ce65ac72
test: update signature cache tests
...
Revert gemini translator changes for scheme A
Co-Authored-By: Warp <agent@warp.dev >
2026-01-22 17:12:47 +08:00
Luis Pater
d9c6317c84
refactor(cache, translator): refine signature caching logic and tests, replace session-based logic with model group handling
2026-01-21 18:30:05 +08:00
Luis Pater
ef4508dbc8
refactor(cache, translator): remove session ID from signature caching and clean up logic
2026-01-21 13:37:10 +08:00
Luis Pater
65ad5c0c9d
refactor(cache): simplify signature caching by removing sessionID parameter
2026-01-21 12:38:05 +08:00
Luis Pater
88bf4e77ec
fix(translator): update HasValidSignature to require modelName parameter for improved validation
2026-01-21 11:31:37 +08:00
Luis Pater
2ce3553612
feat(cache): handle gemini family in signature cache with fallback validator logic
2026-01-21 10:11:21 +08:00
hkfires
9b72ea9efa
fix(translator): enhance signature cache clearing logic and update test cases with model name
2026-01-20 20:02:29 +08:00
Luis Pater
e49a1c07bf
chore(translator): update cache functions to include model name parameter in tests
2026-01-20 18:36:51 +08:00
Luis Pater
8d9f4edf9b
feat(translator): unify model group references by introducing GetModelGroup helper function
2026-01-20 13:45:25 +08:00
Luis Pater
020e61d0da
feat(translator): improve signature handling by associating with model name in cache functions
2026-01-20 13:31:36 +08:00
Luis Pater
543dfd67e0
refactor(cache): remove max entries logic and extend signature TTL to 3 hours
2026-01-12 00:20:44 +08:00
hemanta212
47dacce6ea
fix(server): resolve memory leaks causing OOM in k8s deployment
...
- usage/logger_plugin: cap modelStats.Details at 1000 entries per model
- cache/signature_cache: add background cleanup for expired sessions (10 min)
- management/handler: add background cleanup for stale IP rate-limit entries (1 hr)
- executor/cache_helpers: add mutex protection and TTL cleanup for codexCacheMap (15 min)
- executor/codex_executor: use thread-safe cache accessors
Add reproduction tests demonstrating leak behavior before/after fixes.
Amp-Thread-ID: https://ampcode.com/threads/T-019ba0fc-1d7b-7338-8e1d-ca0520412777
Co-authored-by: Amp <amp@ampcode.com >
2026-01-09 13:33:46 +05:45
이대희
e04b02113a
refactor: Improve cache eviction ordering and clean up session ID usage
...
Improve the cache eviction routine to sort entries by timestamp using the standard library sort routine (stable, clearer and faster than the prior manual selection/bubble logic), and remove a redundant request-derived session ID helper in favor of the centralized session ID function. Also drop now-unused crypto/encoding imports.
This yields clearer, more maintainable eviction logic and removes duplicated/unused code and imports to reduce surface area and potential inconsistencies.
2025-12-19 13:14:51 +09:00
이대희
bbcb5552f3
feat(cache): add signature cache for Claude thinking blocks
2025-12-19 10:28:12 +09:00