Skip to content

Read session token from file (closes #10)#11

Merged
atheriel merged 3 commits into
mainfrom
session-token-file
May 11, 2026
Merged

Read session token from file (closes #10)#11
atheriel merged 3 commits into
mainfrom
session-token-file

Conversation

@nealrichardson
Copy link
Copy Markdown
Contributor

Summary

  • Adds an internal content_session_token() helper that prefers reading the content session token from the file pointed to by CONNECT_CONTENT_SESSION_TOKEN_FILE, falling back to the CONNECT_CONTENT_SESSION_TOKEN env var.
  • Wires connect_service_account_token() and connect_workload_token() to use the helper, so long-running processes pick up refreshed tokens on Connect 2026.02.0+.
  • Empty token files fall back to the env var rather than producing a zero-length token.
  • Updates docs, NEWS, and the mocking helpers; adds tests for each precedence path.

Mirrors the equivalent change in connectapi (posit-dev/connectapi#521).

Closes #10.

Test plan

  • `devtools::test()` — 43 tests pass
  • `devtools::check_man()` — no doc issues

🤖 Generated with Claude Code

nealrichardson and others added 2 commits May 8, 2026 09:00
Long-running processes need to pick up refreshed session tokens. On
Connect 2026.02.0+, the token is written to a file whose path is in
CONNECT_CONTENT_SESSION_TOKEN_FILE; fall back to the env var on older
Connect versions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
readLines(n = 1) returns character(0) on an empty file, which would
propagate as a zero-length content_token. Fall back to the env var
in that case.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nealrichardson nealrichardson requested a review from atheriel May 8, 2026 13:09
Copy link
Copy Markdown
Collaborator

@atheriel atheriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@atheriel atheriel merged commit 8161857 into main May 11, 2026
5 checks passed
@atheriel atheriel deleted the session-token-file branch May 11, 2026 19:33
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.

Read from CONNECT_CONTENT_SESSION_TOKEN_FILE, if exists

2 participants