fix(#705): refresh OIDC token during agent runs to prevent expiry - #726
Conversation
Site previewPreview: https://19ba7353-site.fullsend-ai.workers.dev Commit: |
Review: #726Head SHA: 8d2439d SummaryClean, well-scoped fix for the OIDC token expiry bug (#705) that was killing 69% of WIF-mode agent runs. The implementation adds a background goroutine in FindingsInfo
FooterOutcome: approve Previous runReview: #726Head SHA: 0c26979 SummaryThis PR adds a background OIDC token refresh goroutine to FindingsInfo
FooterOutcome: approve Previous run (2)Review: #726Head SHA: 0c5d081 SummaryThis PR adds a background goroutine to refresh the GitHub Actions OIDC token every 4 minutes during agent runs, solving the critical ~10-minute token expiry issue that was silently killing 69% of Code agent runs. The implementation is clean, well-scoped, follows existing patterns (mirrors the heartbeat goroutine), and includes solid test coverage. No blocking findings. FindingsLow
Info
FooterOutcome: approve |
… expiry The GitHub Actions OIDC JWT expires after ~10 minutes. Agent runs exceeding this window fail with invalid_grant when the Google auth library re-exchanges the stale token. Add a background goroutine that re-fetches the OIDC token from the GitHub OIDC endpoint every 4 minutes and SCPs the fresh token into the sandbox, keeping agent sessions alive for the full timeout. Changes: - prepare-sandbox-credentials.sh: export FULLSEND_GCP_OIDC_URL and FULLSEND_GCP_OIDC_AUTH to GITHUB_ENV so the runner can re-fetch tokens during the run. - run.go: add runOIDCRefresh/refreshOIDCToken using context.Context for immediate cancellation on shutdown, with sync.WaitGroup to guarantee the goroutine exits before sandbox teardown. - run_test.go: unit tests for HTTP fetch, error handling, empty response, context cancellation, and goroutine lifecycle. Review feedback addressed: - fullsend-ai#726 (fullsend-ai-review) - context.Context threaded through for immediate shutdown cancellation - Test renamed for clarity (FetchSucceedsSCPFails) - Added TestRefreshOIDCToken_CancelledContext Closes fullsend-ai#705 Signed-off-by: Adam Scerra <ascerra@redhat.com> Assisted-by: Cursor
0c5d081 to
0c26979
Compare
|
fullsend review is working on this — view logs |
… expiry The GitHub Actions OIDC JWT expires after ~10 minutes. Agent runs exceeding this window fail with invalid_grant when the Google auth library re-exchanges the stale token. Add a background goroutine that re-fetches the OIDC token from the GitHub OIDC endpoint every 4 minutes and SCPs the fresh token into the sandbox, keeping agent sessions alive for the full timeout. Changes: - prepare-sandbox-credentials.sh: export FULLSEND_GCP_OIDC_URL and FULLSEND_GCP_OIDC_AUTH_FILE to GITHUB_ENV. The auth header is written to a file (credentials-in-files pattern) rather than exported as a bare env var. - run.go: add readOIDCAuthFile, runOIDCRefresh, refreshOIDCToken using context.Context for immediate cancellation on shutdown, with sync.WaitGroup to guarantee the goroutine exits before sandbox teardown. Validates OIDC response is JSON before writing. - run_test.go: unit tests for auth file reading, HTTP fetch, error handling, empty/non-JSON response, context cancellation, and goroutine lifecycle. Review feedback addressed (PR fullsend-ai#726): - fullsend-ai-review: context.Context for shutdown cancellation, test renamed for clarity, added CancelledContext test - @ralphbean: credentials-in-files pattern for OIDC auth header, json.Valid check on response body Closes fullsend-ai#705 Signed-off-by: Adam Scerra <ascerra@redhat.com> assisted-by: cursor
0c26979 to
8d2439d
Compare
|
fullsend review is working on this — view logs |
The GitHub Actions OIDC JWT expires after ~10 minutes. Agent runs exceeding this window fail with invalid_grant when the Google auth library re-exchanges the stale token.
Add a background goroutine that re-fetches the OIDC token from the GitHub OIDC endpoint every 4 minutes and SCPs the fresh token into the sandbox, keeping agent sessions alive for the full timeout. Closes #705
Assisted-by: cursor