Repository navigation
Conversation
Contributor
Author
|
Picked dprevoznik to review: no one but the author has history on these files, so all candidates tied at the lightest queue; broke the tie toward the only other committer in this repo; nothing pending |
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.
Warning
Blocked: don't merge yet. The live
integrationrun fails because the Anthropic token exchange returns401 authentication_error(run). The cause is in repo settings, not this diff:GET repos/kernel/browser-loop/actions/oidc/customization/subreturnsuse_immutable_subject: true, sosubstarts withrepo:kernel@194616459/browser-loop@1214004226.subagainst the prefixrepo:kernel/*. Every other kernel repo checked (kernel,hypeship,hypeman,infra,kernel-images-private,cli,security-workflows) uses the defaultrepo:kernel/<repo>form.There are two ways to unblock this:
repo:kernel@194616459/*.Once either is done, re-run the
integrationjob.Summary
CI should not need the
ANTHROPIC_API_KEY/OPENAI_API_KEYorg secrets, so they can be deleted. Instead, jobs exchange their GitHub OIDC token for short-lived provider credentials through workload identity federation. This PR moves this repo's CI off both secrets.What actually used the keys
integration: onlytest/anthropic-native.integration.test.tscalls a model (Anthropic, two short requests). No integration test uses OpenAI. The live e2e suite is skipped in this job becauseLOOP_E2E_LIVEis unset.live-e2e: the OpenAI and Anthropic cases (and the openai-to-gemini switch case) needLOOP_E2E_OPENAI/LOOP_E2E_ANTHROPICunderCI. Neither is set, so these cases were already skipped. The last main run passed only the two moonshotai tests, with 10 skipped. Both keys were dead config here, so this PR drops them.Approach
SDK-native federation, plugged into pi's transport. The test goes through pi-ai's Anthropic transport, which builds its own SDK client (pi-ai bundles
@anthropic-ai/sdk0.91, which has no federation support). Loop's Anthropic client-toolset adapter needs that fetch transport, so a custom federating client can't be passed in.The test helper therefore uses the federation pieces from the repo's existing
@anthropic-ai/sdk0.117 devDependency, with no version bump:oidcFederationProviderdoes the jwt-bearer exchange.identityTokenFromFilereads the token file.TokenCachecaches the token and refreshes it.The resulting access token goes to pi through its per-request
envoverride asANTHROPIC_AUTH_TOKEN, which pi sends asAuthorization: Bearer. The OAuthanthropic-betaheader the API needs for bearer tokens is added alongside it.When
ANTHROPIC_API_KEYis set (local development), the helper returns it unchanged and federation is never touched.Token refresh
kernel/security-workflows/.github/actions/llm-credentials(pinned to a SHA) writes a fresh GitHub OIDC token toANTHROPIC_IDENTITY_TOKEN_FILEevery 30s and exports the federation settings. The helper callsTokenCache.getToken()before every request:Long runs therefore keep working, although this job takes about 5s of test time today. A final
if: always()step stops the refresh loop and deletes the token file.Files
.github/workflows/ci.yml:integrationnow grantscontents: read+id-token: write(noenvironment:).llm-credentialswith the Anthropic IDs from the orgvars, then stops it after the tests.integrationandlive-e2e. Other secrets are unchanged.packages/browser-loop/test/support/anthropic-auth.ts: newanthropicRequestAuth(). It returns the API key when set, otherwise federated per-request auth, orundefinedwhen neither is configured (the test then skips, as before).packages/browser-loop/test/anthropic-native.integration.test.ts: usesanthropicRequestAuth()instead of readingANTHROPIC_API_KEYdirectly.packages/browser-loop/test/anthropic-auth.test.ts: unit tests for the helper:Authorization: Bearer <token>, nox-api-key, and includes the OAuth beta.Testing
npm run build --workspace @onkernel/browser-loop, thennpm test --workspace @onkernel/browser-loop: 35 files, 447 tests passed.npx tsc -b: passes.npm run test:integration --workspace @onkernel/browser-loopwith no credentials: the Anthropic integration test skips cleanly..github/workflows/ci.yml: no findings.integrationjob.live-e2e,unitandtypecheck-and-ptywrightpassed.