Repository navigation
feat(server): agents save a value shown in a browser tab to a private file - #802
Conversation
… file A computer-use agent could see a key on a dashboard but had no way to move it into a file: the server browser denies the clipboard and shares none with the host, so it asked the user to paste the key instead. preview_save_secret reads one located element in a server browser tab (an input's value, or an element's visible text) after checking its own frame is https, and writes it through SecretRequests.saveCaptured to a fresh 0600 file in the private files directory that the 24-hour sweep already clears, now including abandoned .partial files. The tool returns only the path, length and tab. Desktop-hosted tabs, non-https frames, Playwright protocol logging and calls forwarded from a linked environment are refused with fixed messages, and every Playwright failure on the path is replaced before the timeline, broker or logs see it. Closes #799 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
What: Independent review round 1 requests changes for incomplete required proof and an unaccepted context-budget increase; no confirmed secret-leak defect was found in the inspected code. Reviewed exact head Blocking readiness findings
Non-blocking correction
Cleared concerns and inspection limits
Proof accountingExecuted: read-only Reused: GitHub's exact-head successful Build and Typecheck, Lint, Fork Stack Model and Release Smoke checks. The author's focused test report and mutation claim were read but were not independently rerun, so they are reported evidence, not my executed proof. Several CI test shards were still pending when inspected; no complete green CI claim is made. Unverified: real-page acceptance, paid model eval, runtime log/span non-disclosure, and the branch cases above. No API/eval spend, real provider turn, browser session or deployment occurred. Elon record
Cleanup: no worktree, code change, dependency installation or test resource was created. The task-owned temporary comment file is removed after publication; the provided checkout remains untouched. Reviewer: GPT-6.1 Sol, Codex harness. |
#775 removed the login gate, so the registry entry's purpose drops "tabs in a login". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
The secrets source rule accepted only review findings and pingdotgg/t3code Issues, so secret-browser-key-to-file, which cites the fork Issue by URL, failed run.test.ts. The case now cites #799 and the rule accepts that form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Paid eval, head 8cb2ae0 (authorized by the owner, 2026-11-18): |
The paid eval of secret-browser-key-to-file failed 0/3: agents load preview tools by name, never loaded preview_save_secret, and read the revealed key with preview_evaluate or a snapshot. One sentence in each of those two descriptions names the tool; the rerun passed 3/3. The tool list grows by 200 bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Eval follow-up on 4f8f92e. Cause of the 0/3 on 8cb2ae0: agents pick preview tools by name from the deferred list (every sample loaded status, snapshot, click, evaluate) and only see descriptions after loading, so none loaded Fix: one sentence each in
Case unchanged. |
|
What: Independent review round 2 passes at exact head Scope and verdictReviewed against base Verdict: success. Blocking code/proof findings within this PR's control: none. Nothing besides the two excluded owner gates blocks merge in this review. This is a review verdict, not a declaration that every CI or owner acceptance gate has passed. Round-2 findings
Evidence and limitsRead both
Elon record
Reviewer: delegated GPT-6.1 Sol through Prism, Codex harness; verdict published by the parent review coordinator. No review-owned scratch files, worktrees, dependencies or processes were created; the supplied checkouts and eval artifacts were preserved. |
Agent work on this PREstimated cost at least $1.54 · 34 responses · 75 sessions · 84 min wall time
Flags: 4 human corrections · 24 large tool outputs · 2 repeated commands · 25 repeated reads · 2 repeated skill loads · 15 unpriced responses Details: snapshot, prices, coverage, counters
Token counters by model (native counter semantics; never added across semantics):
Generated tokens (reasoning and other output are disjoint; other output includes code, tool calls and replies):
Usage by work phase (this task's own responses):
Recorded activity by phase (observations, not separate token bills):
Selected rates (USD per million tokens). These rates value the report at the selected schedule date; they do not establish historical prices or subscription spending.
Other output and reasoning are priced without double counting inclusive native output. Missing rates remain unknown. Local measurement from native records; usage totals are not billing. Updated in place by |
What changed: A browser agent can save a value shown on an https page, such as an API key, to a private 0600 file with one
preview_save_secretcall; the value never appears in the tool result or the tab timeline.Why: The server browser denies
navigator.clipboardand shares no clipboard with the host, so on 2026-11-18 a computer-use agent with Stripe test keys on screen had to ask the owner to paste them.So what: Ready for independent review on this head; it merges under the repository's standing merge authority once checks and
review/independentare green. The paid eval run was not done (no API key or proxy on bestia), see below.Refs #799 (closes after the live run on a real page, per the owner's 2026-11-18 decision)
How it works
preview_save_secret{ tabId?, locator, timeoutMs? }resolves one element handle, checks that handle's own frame ishttps:, then reads the same handle:inputValue()forinput/textarea, otherwise the element must be visible and the value is itsinnerTextwith U+200B/U+00AD stripped and trimmed. Empty, multi-line or over-4 KB values are refused and nothing is written.SecretRequests.saveCaptured: the same private files directory (0700) andwx+rename 0600 writer assavePasted, its own HMAC input (captured+ a fresh random nonce), so a capture never shares a name with a pasted file or an earlier capture. The existing 24-hour sweep deletes it; the sweep now also deletes abandoned.partialfiles.{ saved: true, path, length, tabId }, with notoolIcon(the page URL can carry the value).cause(PreviewSaveSecretError): desktop-hosted tab, element frame not https (anabout:srcdociframe in an https page included),DEBUGenablingpw:protocol/pw:api(checked before any Playwright read, independent of vault settings; the check is factored out ofCredentialVault), and a call that arrives from a linked environment (client.linked,capability_denied). Local threads, link-origin ones included, get the path. Every Playwright failure on the path is replaced beforerecordAction, the broker or logs see it; the broker passes only the decoded reason.saveSecretoperation, input/result/error schemas), MCP presentation entry, Browser guide section,docs/map.mdpart,docs/fork-features.mdentry, one eval case. Desktop hosts do not advertisesaveSecret. No i18n keys (no new React copy). Web and mobile only use the shared presentation entry.Deviation from the Issue design
loginInProgress, from theLOGIN_OPERATIONSgate". fix(browser): a credential-fill sign-in keeps the page readable #775 (merged while this was in progress) deleted the login state and that gate on the owner's 2026-11-17 decision, so there is nothing to refuse against; the rebased branch drops that refusal and its test assertion. Everything else follows the Issue's Implementation decisions.Elon record
expectPrefix(it puts key fragments in arguments) and the login refusal, whose mechanism fix(browser): a credential-fill sign-in keeps the page readable #775 removed.Proof
Run on bestia in this worktree, Chrome for Testing 157.0.8103.78 (
CHROMERIA_TEST_CHROMIUM), fresh test state; no live T3 state, real site or real key.apps/server/src/preview/CredentialLogin.integration.test.ts, describe "saving a page value in a real browser", through the in-process MCP server (callTool("preview_save_secret")) with a routed https fixture page:#key(an element whose text carries U+200B/U+00AD) and#field(an input) to files under<secretsDir>/files, mode 0600, exact values;structuredContentis exactly{ saved, path, length, tabId }; the fully serialized result contains none of the page's values.text=/sk_test_dup/(strict-mode violation), missing element and anabout:srcdociframe are each refused with their fixed message, the result carries no page value, and no file is written beyond the two saves; the tab's action timeline shows the six failures without any page value.http://page and a call from a linked client (client.linked: true) are refused, nothing written.serverBrowserOnlymessage), nothing written.DEBUG=pw:apiin the server's config, the call is refused before reading, nothing written.apps/server/src/secrets/SecretRequests.test.ts"a captured value gets a fresh owner-only file that no pasted key names": two captures of the same value and a pasted key named after the first capture get three distinct files; 0600; the sweep deletes them and an abandoned.partialafter 24 hours. That test fails on the old sweep pattern (.partialsurvives).Commands, all green on this head's tree:
pnpm exec vp run check:changed: format, lint, knip, graphql, typecheck (38 packages), test (10 files) pass.pnpm exec vp test runonCredentialLogin.integration,SecretRequests,ServerBrowser,PageSubscriptions.integration,preview/handlers,AgentContextBudget: 173 passed, 4 skipped (PageSubscriptions.integration's own skip condition; its fixture change is covered by typecheck).bash scripts/fork-check.sh --upstream upstream:fork-check: OK.node scripts/browser-doc-check.mjs --numbers: numbers match.agentContextBudget.json:mcpToolListJsonBytes255944 → 258829, the measured size with the new tool's schema and description (+2,885 bytes); the test asks for the measured value.Eval
Fork-owned case only, per
docs/fork.md: addedsecret-browser-key-to-file(bad) toevals/mcp-tool-use/cases/secrets.ndjson, reproducing the 2026-11-18 episode: a computer-use child with a revealed test key must callpreview_save_secret, must not callrequest_secretorpreview_evaluate, must not touch the host clipboard, and the fixture value must appear in no tool input, output or text (a snapshot after reveal or printing the file fails).--dry-runbuilds it and the model seespreview_save_secretin its deferred tool list. Not run on a model: bestia has noANTHROPIC_API_KEYin.envand no CLIProxyAPI on 8317, so the three-sample run needs the user's key or proxy. Onmainthe case fails by construction (the tool does not exist). Its fixture key is deliberately not key-shaped: GitHub push protection rejected the first,sk_test_+ alphanumerics, version.Not proven
Upstream first
Searched
pingdotgg/t3codeissues, PRs andupstream/mainhistory (save secret browser,clipboard preview,secret file preview,api key browser agent,saveSecret|preview_save_secret|saveCaptured). Nothing equivalent; the closest is the closed #35410 (send_secret, agent-to-user delivery), a different direction.Model and harness: Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code