Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(wrapper): forward subscription OAuth tokens to the helper

Rodrigo Palharesfacf33a54d8e
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb1d4cda..0683e783 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
session starts, user prompts, and pre-tool events now advance shared or
identity-only fallbacks; other events refresh exact session mappings, and
dropped-subagent preflight no longer publishes scope (#372).
+- Both wrappers (`bin/ai-memory` and `bin/ai-memory.ps1`) now forward
+ `ANTHROPIC_OAUTH_TOKEN` and `CLAUDE_CODE_OAUTH_TOKEN` to the helper
+ container. Their API-key counterparts were already in the passthrough list,
+ so subscription-token setups (`claude setup-token`,
+ `AI_MEMORY_LLM_PROVIDER=anthropic-oauth`) silently lost their credential at
+ the container boundary. The visible symptom is that the retry `status`
+ itself recommends — `llm-test --provider anthropic-oauth` — fails with a
+ missing-token error, because `llm-test` runs client-side in the helper
+ rather than on the server ([#379]).
## [1.24.0] - 2026-08-04
diff --git a/bin/ai-memory b/bin/ai-memory
index 1a2d85d7..fb932323 100755
--- a/bin/ai-memory
+++ b/bin/ai-memory
@@ -365,6 +365,8 @@ for var in \
CLAUDE_CONFIG_DIR \
CLAUDE_CODE_SESSION_ID \
ANTHROPIC_API_KEY \
+ ANTHROPIC_OAUTH_TOKEN \
+ CLAUDE_CODE_OAUTH_TOKEN \
OPENAI_API_KEY \
COPILOT_GITHUB_TOKEN \
GITHUB_COPILOT_API_TOKEN \
diff --git a/bin/ai-memory.ps1 b/bin/ai-memory.ps1
index 65193830..4d35670a 100644
--- a/bin/ai-memory.ps1
+++ b/bin/ai-memory.ps1
@@ -118,6 +118,8 @@ foreach ($Name in @(
"AI_MEMORY_ALLOWED_HOSTS",
"CLAUDE_CODE_SESSION_ID",
"ANTHROPIC_API_KEY",
+ "ANTHROPIC_OAUTH_TOKEN",
+ "CLAUDE_CODE_OAUTH_TOKEN",
"OPENAI_API_KEY",
"VOYAGE_API_KEY",
"LLM_API_KEY",
diff --git a/crates/ai-memory-cli/tests/packaging.rs b/crates/ai-memory-cli/tests/packaging.rs
index ac38f15a..5bf091e0 100644
--- a/crates/ai-memory-cli/tests/packaging.rs
+++ b/crates/ai-memory-cli/tests/packaging.rs
@@ -1305,6 +1305,24 @@ fn selinux_label_exception_requires_enforcement_and_daemon_support() {
);
}
+#[test]
+fn wrapper_forwards_subscription_oauth_tokens_to_the_helper() {
+ // `llm-test` runs client-side, inside the helper container, so the retry
+ // that `status` itself suggests fails with a missing-token error unless
+ // the subscription tokens reach it. The API-key variables were already
+ // forwarded; their OAuth counterparts were not. Both wrappers keep their
+ // own hand-maintained list, and both had the same hole.
+ for wrapper_path in ["bin/ai-memory", "bin/ai-memory.ps1"] {
+ let wrapper = read_repo(wrapper_path);
+ for var in ["ANTHROPIC_OAUTH_TOKEN", "CLAUDE_CODE_OAUTH_TOKEN"] {
+ assert!(
+ wrapper.contains(var),
+ "{wrapper_path} must forward {var} to the helper container"
+ );
+ }
+ }
+}
+
#[test]
fn macos_docs_use_valid_install_commands_and_release_body_points_to_them() {
let docs = read_repo("docs/macos.md");