fix(copilot): stop returning generate_api_key plaintext on the in-band tool route - #8042
Merged
Merged
Conversation
…d tool route Tool results reach the model over two lanes, but the model-facing projection was applied on only one. The resume lane runs results through getToolCallTerminalData, which reduces generate_api_key to its status message. The in-band route (POST /api/copilot/tools/execute) returned the handler output verbatim, so the freshly minted plaintext workspace API key crossed to the model and into the turn transcript. The egress projection cannot cover this: its registry is a catalog of pre-existing environment and credential secrets, built once per turn, so a key minted mid-turn is invisible to it. Apply toolResultForModel at the route so both lanes return the same model-facing projection. It is an identity for every other tool.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
|
This branch was previously deployed
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.
Summary
getToolCallTerminalData, which reducesgenerate_api_keyto its status message; the in-band route (POST /api/copilot/tools/execute) returned the handler output verbatim, so the freshly minted plaintext workspace API key crossed to the model and into the turn transcript.toolResultForModelat the route so both lanes return the same model-facing projection. It is an identity for every tool exceptgenerate_api_key.sim_keychip now renders masked there. Redacting at the shared projection instead is not an option — the main lane's client carve-out reads that same projected output, so it would break the chip everywhere.Type of Change
Testing
generate_api_keyreturns only the status message and nokeyfield; a non-generate_api_keyresult carrying akeyfield is untouched; a failed call passes its error through. Verified the new test fails when the fix is reverted.vitest run app/api/copilot lib/copilot— 2636 passed, 3 skippedtsc --noEmitclean,bun run lintclean,check:audits47/47 passing,docs-manifest:checkin syncChecklist