fix: isolate user credentials from project agent execution - #4214
Conversation
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Warning Review limit reachedNext included review available in 57 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (22)
📝 WalkthroughWalkthroughThe change adds deterministic source snapshot fingerprints, intrinsic-safe context handling, freshness validation, explicit Studio MCP discovery, and separate request and project runtime credentials for agent execution. ChangesSource snapshot and adapter capabilities
Agent execution and context isolation
Documentation and regression coverage
Estimated code review effort: 5 (Critical) | ~120 minutes Merge Risk: 🟡 Moderate · up to This PR prevents request-scoped bearer tokens from reaching project-controlled execution, but runs may still abort when no runtime proxy token is available, and subclass adapter overrides may be skipped during dispatch. These bounded availability and correctness risks require a fix or explicit owner acceptance before merge. Sequence Diagram(s)sequenceDiagram
participant AgentStreamHandler
participant FSAdapterWrapper
participant SourceContext
participant ProjectRuntime
AgentStreamHandler->>FSAdapterWrapper: Capture source snapshot fingerprint
AgentStreamHandler->>SourceContext: Load and validate source configuration
AgentStreamHandler->>FSAdapterWrapper: Verify fingerprint after configuration and credential handoff
AgentStreamHandler->>ProjectRuntime: Run policy, discovery, MCP, sandbox, and environment operations
AgentStreamHandler->>FSAdapterWrapper: Verify fingerprint after discovery
FSAdapterWrapper-->>AgentStreamHandler: Return fingerprint or freshness error
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 20.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 89 functions across 31 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Thanks for your contribution, @claude! Before we can merge this PR, we need you to accept our Contributor License Agreement (CLA). Missing CLA entries for: @claude. How to sign: Add contributor entry lines in By adding your name, you agree to the CLA. This is a one-time step. If you are contributing on behalf of a company, please see our Corporate CLA. |
📦 Client bundle boundary
A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in |
b5c77e0 to
0f2c89c
Compare
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Squashed from: - fix: isolate user credentials from agent runtime
0f2c89c to
0c44e60
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f2c89c2b7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb1a9caafc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c24091607
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Proactively completed the same credential-scope hardening pattern in exact head Fresh verification: focused adapter, proxy manager, multi-project, batching, API store, and isolated prototype suites; @codex review |
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Addressed the exact-head strict-freshness finding in Fresh verification: full agent-stream handler suite, typecheck, semantic audit, docs generation, npm build, full lint CI, and @codex review |
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Resolved the Code Quality false positive in exact head Fresh focused batching and prototype tests, typecheck, semantic audit, and @codex review |
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eda346fc0f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Sealed the complete source-refresh mutation and invalidation dispatch chain in exact head Fresh adapter and prototype regressions, typecheck, semantic audit, npm build, full lint CI, and @codex review |
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6d456de48
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Sealed authenticated source identity lookup in exact head Fresh adapter tests, typecheck, semantic audit, npm build, full lint CI, and @codex review |
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
Forced branch refreshes execute while an adapter holds request authority. Snapshot identity dispatch is now ECMAScript-private so project-authored prototype mutations cannot observe that credential during refresh. Constraint: Branch freshness checks run beneath signed request authority Rejected: Capture a prototype method at module load | class-private dispatch makes the invariant explicit at every call site Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep credential-bearing source refresh helpers off mutable prototypes Tested: Adapter and prototype-pollution suites; typecheck; formatting; lint; diff check Not-tested: Hosted CI pending exact-head push
There was a problem hiding this comment.
kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Addressed the authenticated refresh identity dispatch finding on exact head |
|
Integrated the author-added identity-prototype regression at exact head @codex review |
|
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |



Motivation
Description
credentials.authTokenas the project runtime credential by deriving aprojectRuntimeTokenfrom the existing runtime/proxy token (ctx.proxyTokenor host env) and using that for project environments and sandbox setup inAgentStreamHandler.apiAuthTokenfor framework-owned platform and studio MCP interactions and for request-scoped control-plane context, but do not inject it intoprojectAgentSandbox.authTokenorbuildAgentStreamEnv.proxyToken(files changed:src/server/handlers/request/agent-stream.handler.ts).VERYFRONT_API_TOKENequals the request-scoped user token with expectations that project execution sees the runtime proxy token instead (file changed:src/server/handlers/request/agent-stream.handler.test.ts).Testing
git diff --checkwhich produced no check failures and committed the changes asfix: isolate user credentials from agent runtime.deno test --no-check --allow-all src/server/handlers/request/agent-stream.handler.test.tsbut the environment lacks Deno (deno: command not found), so unit tests could not be executed here.npx -y deno test --no-check --allow-all src/server/handlers/request/agent-stream.handler.test.tsto bootstrap Deno, but the npm registry request failed with HTTP 403, so tests remain unrun in this environment.git status --shortandgit diff --stat, both of which reflect the intended focused diff (2 files modified: handler and its tests).Codex Task
Summary by CodeRabbit
New Features
Bug Fixes
Documentation