[Amber] Fix: Bug: BOT_TOKEN is failing to update inside session pod because it is injected via env var instead of file mount#1050
Merged
Gkrumbach07 merged 1 commit intomainfrom Mar 26, 2026
Conversation
The runner token was previously injected as an environment variable via
SecretKeyRef, which Kubernetes resolves once at pod start and never
updates. When the operator rotates the runner token (refreshRunnerToken),
the env var in the long-running pod remained stale, causing authentication
failures.
Fix: mount the runner-token Secret as a volume file at
/var/run/secrets/ambient/bot-token. Kubelet automatically updates the
file when the Secret changes. Add a get_bot_token() helper in the runner
that reads from the file first and falls back to the BOT_TOKEN env var
for local/non-Kubernetes runs. Replace all os.getenv('BOT_TOKEN') call
sites with get_bot_token(), and update BackendAPIClient._make_request to
re-read the token on every call so long-lived clients always use the
current token.
The init container retains env var injection since it runs only once at
pod startup with a freshly minted token.
Fixes #1046
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Gkrumbach07
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated Fix by Amber Agent
This PR addresses issue #1046 using the Amber background agent.
Changes Summary
Pre-merge Checklist
Reviewer Notes
This PR was automatically generated. Please review:
🤖 Generated with Amber Background Agent
Closes #1046