Skip to content

fix(proxy): make TokenSaver message compression opt-in#2

Merged
Electricitysheep merged 1 commit into
mainfrom
fix/tokensaver-opt-in
Jul 6, 2026
Merged

fix(proxy): make TokenSaver message compression opt-in#2
Electricitysheep merged 1 commit into
mainfrom
fix/tokensaver-opt-in

Conversation

@Electricitysheep

Copy link
Copy Markdown
Owner

问题

代理默认对超过 8000 字符的消息静默截断(并改写 git diff / JSON),客户端无从知晓。作为 drop-in OpenAI 兼容代理,接长上下文 coding agent 时这是致命行为。

修复

压缩改为显式 opt-in:TOKEN_SAVER_ENABLED=trueconfig.tokenSaverEnabled)。默认逐字节透传。.env.example 补充说明。

测试

  • 新增回归测试:默认配置下 9000 字符消息原样到达 provider(修复前被截为 8000+标记);开启开关后才压缩
  • 全套件 40/40 通过,tsc 干净

🤖 Generated with Claude Code

The proxy silently truncated any message content over 8000 chars and
rewrote git diffs/JSON by default — fatal for a drop-in OpenAI-compatible
proxy carrying long coding-agent contexts, and invisible to the client.

Compression now requires TOKEN_SAVER_ENABLED=true (config.tokenSaverEnabled).
Default behavior is byte-for-byte passthrough.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Electricitysheep
Electricitysheep merged commit 5b28d5b into main Jul 6, 2026
1 check passed
@Electricitysheep
Electricitysheep deleted the fix/tokensaver-opt-in branch July 6, 2026 14:50
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.

1 participant