Reapply "set auto compaction window for fcc-claude to 190K"

This reverts commit 7068533cdb.
This commit is contained in:
Alishahryar1
2026-05-17 19:58:44 -07:00
parent 7068533cdb
commit c0c1f3d554
5 changed files with 12 additions and 5 deletions
+7 -5
View File
@@ -120,7 +120,7 @@ The default model is already set to `nvidia_nim/z-ai/glm4.7`. You can change it
fcc-claude fcc-claude
``` ```
`fcc-claude` reads the current configured port and auth token each time it starts, sets the Claude Code environment variables, and then launches the real `claude` command. `fcc-claude` reads the current configured port and auth token each time it starts, sets the Claude Code environment variables (including a 190k-token `CLAUDE_CODE_AUTO_COMPACT_WINDOW` for auto-compaction), and then launches the real `claude` command.
## Choose A Provider ## Choose A Provider
@@ -257,7 +257,7 @@ For terminal use, prefer the installed launcher:
fcc-claude fcc-claude
``` ```
Keep `fcc-server` running while you work. The Admin UI manages proxy config, restarts the server when runtime settings change, and `fcc-claude` reads the current Admin UI-managed port and auth token every time it starts. Keep `fcc-server` running while you work. The Admin UI manages proxy config, restarts the server when runtime settings change, and `fcc-claude` reads the current Admin UI-managed port and auth token every time it starts. It also sets `CLAUDE_CODE_AUTO_COMPACT_WINDOW` to `190000` for auto-compaction.
### 2. VS Code Extension ### 2. VS Code Extension
@@ -267,7 +267,8 @@ Open Settings, search for `claude-code.environmentVariables`, choose **Edit in s
"claudeCode.environmentVariables": [ "claudeCode.environmentVariables": [
{ "name": "ANTHROPIC_BASE_URL", "value": "http://localhost:8082" }, { "name": "ANTHROPIC_BASE_URL", "value": "http://localhost:8082" },
{ "name": "ANTHROPIC_AUTH_TOKEN", "value": "freecc" }, { "name": "ANTHROPIC_AUTH_TOKEN", "value": "freecc" },
{ "name": "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY", "value": "1" } { "name": "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY", "value": "1" },
{ "name": "CLAUDE_CODE_AUTO_COMPACT_WINDOW", "value": "190000" }
] ]
``` ```
@@ -286,7 +287,8 @@ Set the environment for `acp.registry.claude-acp`:
"env": { "env": {
"ANTHROPIC_BASE_URL": "http://localhost:8082", "ANTHROPIC_BASE_URL": "http://localhost:8082",
"ANTHROPIC_AUTH_TOKEN": "freecc", "ANTHROPIC_AUTH_TOKEN": "freecc",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1" "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "190000"
} }
``` ```
@@ -411,7 +413,7 @@ Run them in that order before pushing. CI enforces the same checks.
- `fcc-server`: starts the proxy with configured host and port. - `fcc-server`: starts the proxy with configured host and port.
- `fcc-init`: optional advanced scaffold for `~/.fcc/.env`; prefer the **Admin UI** for normal configuration. - `fcc-init`: optional advanced scaffold for `~/.fcc/.env`; prefer the **Admin UI** for normal configuration.
- `fcc-claude`: launches Claude Code with the configured local proxy URL, auth token, and model discovery flag. - `fcc-claude`: launches Claude Code with the configured local proxy URL, auth token, model discovery flag, and a 190k `CLAUDE_CODE_AUTO_COMPACT_WINDOW` for auto-compaction.
- `free-claude-code`: compatibility alias for `fcc-server`. - `free-claude-code`: compatibility alias for `fcc-server`.
### 5. Extending ### 5. Extending
+1
View File
@@ -182,6 +182,7 @@ def _claude_child_env(
env.pop("ANTHROPIC_API_KEY", None) env.pop("ANTHROPIC_API_KEY", None)
env["ANTHROPIC_BASE_URL"] = local_proxy_root_url(settings) env["ANTHROPIC_BASE_URL"] = local_proxy_root_url(settings)
env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1" env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1"
env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] = "190000"
if token := settings.anthropic_auth_token.strip(): if token := settings.anthropic_auth_token.strip():
env["ANTHROPIC_AUTH_TOKEN"] = token env["ANTHROPIC_AUTH_TOKEN"] = token
return env return env
+1
View File
@@ -119,6 +119,7 @@ class CLISession:
else: else:
env["ANTHROPIC_BASE_URL"] = self.api_url env["ANTHROPIC_BASE_URL"] = self.api_url
env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1" env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1"
env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] = "190000"
env.pop("ANTHROPIC_API_KEY", None) env.pop("ANTHROPIC_API_KEY", None)
if token := self.auth_token.strip(): if token := self.auth_token.strip():
env["ANTHROPIC_AUTH_TOKEN"] = token env["ANTHROPIC_AUTH_TOKEN"] = token
+1
View File
@@ -533,6 +533,7 @@ class TestCLISession:
env = mock_exec.call_args.kwargs["env"] env = mock_exec.call_args.kwargs["env"]
assert env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token" assert env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token"
assert env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1" assert env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1"
assert env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] == "190000"
assert "ANTHROPIC_API_KEY" not in env assert "ANTHROPIC_API_KEY" not in env
@pytest.mark.asyncio @pytest.mark.asyncio
+2
View File
@@ -306,6 +306,7 @@ def test_claude_child_env_targets_current_proxy_config() -> None:
assert env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9090" assert env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9090"
assert env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token" assert env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token"
assert env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1" assert env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1"
assert env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] == "190000"
assert "ANTHROPIC_API_KEY" not in env assert "ANTHROPIC_API_KEY" not in env
@@ -355,6 +356,7 @@ def test_launch_claude_passes_args_and_child_env(
assert child_env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9191" assert child_env["ANTHROPIC_BASE_URL"] == "http://127.0.0.1:9191"
assert child_env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token" assert child_env["ANTHROPIC_AUTH_TOKEN"] == "proxy-token"
assert child_env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1" assert child_env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] == "1"
assert child_env["CLAUDE_CODE_AUTO_COMPACT_WINDOW"] == "190000"
assert child_env["KEEP_ME"] == "yes" assert child_env["KEEP_ME"] == "yes"
register_pid.assert_called_once_with(12345) register_pid.assert_called_once_with(12345)
unregister_pid.assert_called_once_with(12345) unregister_pid.assert_called_once_with(12345)