Repository navigation
fix(browser): resolve clipboard imports safely in bytecode builds - #1887
damianvtran wants to merge 4 commits into
Conversation
Agent review — round 1Reviewer: independent reviewer agent — openai/gpt-6.1-sol (temporary fallback after anthropic/claude-opus-5-5 provider quota failure; initial diff/guidance reads preceded the switch) Intent reviewed: minimal packaged-VM Electron resolution fix for secure action copy and page-button writes; preserve node-only imports and existing permission/gesture/privacy controls. No install, native build, full suite, or unrelated browser changes. Findings: no BLOCKER, MAJOR, MINOR, or NIT findings. Verdict: clean (terminal code-review round). Evidence derived independently at the pushed head in the manager-owned read-only worktree:
Evidence boundary: this is Node/V8 cached-data loader-contract proof with an Electron stub, not rebuilt/installed Electron or OS clipboard proof. Native post-fix proof remains BLOCKED by the disk-owner build hold, as briefed; no claim that the installed application has been repaired or native-validated. That separate QA/release decision is not supplied by this clean code review. |
QA report — round 1QA: independent qa-tester · Model: anthropic/claude-opus-5-5 (current served model; the earlier preflight report's Head: Verdict: BLOCKED — no native PASS claim. Evidence attempt 1 stopped at build prerequisite; no app launched. Intent: validate both lazy Electron clipboard callbacks in production V8 bytecode through the real desktop host, with only disposable synthetic data. Non-goals: full installer validation, production app/credentials, dependency installation/downloads, broad suites. Executed matrix
Disk / artifact receiptsThe bounded wrapper measured 9,585,889,280 bytes free before build setup and 9,489,711,104 after cleanup: a filesystem delta of 96,178,176 bytes (~91.7 MiB). This is filesystem drift, not a precise attribution of all concurrent writes. The isolated scratch tree later measured 47,984,640 allocated bytes. Final Only tracked sparse build inputs were materialized: renderer, preload, bin, build, and top-level resource PNGs. No source edits, lockfile edits, dependency-tree replacement or app launch occurred. Build log and summary retained in session scratch at Q1 — blocked build prerequisite / setup incidentThe isolated HOME caused the bare Bounded repair requiring a new authorized attempt: identify an already present package-manager/build executable compatible with the lockfile and invoke it explicitly without bootstrap/install; validate that prerequisite before dispatch. Do not run the error's suggested This report covers existing-runtime production-bytecode validation intent only; full electron-builder/installer validation and the currently installed app remain untested. No production/KOHO/Minerva tab or credential was accessed. No human reviewers requested or tagged. |
Agent review — round 2Reviewer: independent reviewer agent, openai/gpt-6.1-sol (actual fallback after anthropic/claude-opus-5-5 quota/provider failure). Reviewed the complete workflow/artifact-test delta only, against the brief's authorized exact-head hosted macOS arm64 production-bytecode artifact. Unchanged secure-copy callbacks retain the prior round; no native build, app launch, install, artifact download, or real credentials were used. R2-1 — MAJOR — Evidence executed on the briefed clean worktree with isolated HOME/config and an allowlisted environment:
Other reviewed paths: macOS checkout binds the immutable PR head and staging compares it to actual git HEAD; Ubuntu retains github.sha integration checkout, pnpm build and the CI run 43318034632 was read once: pending, no jobs yet, headSha 1e5ca17. This is not a CI-success claim. Native import/secure-copy behavior remains unproved by this review and by the artifact contracts. Verdict: not clean — one MAJOR (R2-1), no additional findings. |
Agent review remediation — round 2Implementer: coder / openai/gpt-6.1-sol (provider-quota fallback disclosed previously; no model/tool configuration changes).
Current head: |
Agent review — round 3Reviewer: independent reviewer agent, anthropic/claude-opus-5-5 (actual model this round; no fallback used this round). Retest: R2-1 only, plus the directly associated artifact contracts. This round is justified by the named open MAJOR from round 2. Reviewed the complete delta: exactly one command-mapping line in R2-1 resolved. The existing A11 assertion is byte-identical and now passes without weakening it. A separate exact-string comparison between the actual parsed workflow's release-contract command and Executed on the clean manager-owned worktree at the pushed head, with isolated HOME/config and an allowlisted environment: node --test --test-name-pattern="^(A11:|native artifact |staging )" scripts/ci-scope.test.mjs scripts/native-bytecode-artifact.test.mjsActual result: 7 tests, 7 pass, 0 fail — A11 plus all six artifact contracts, including execution of the unchanged workflow's actual inline staging code and its negative cases. Retention proof: CI run 43319106365 read once: pending, headSha 47a3d42. No CI-success claim. No build, install, download, app launch, or real credentials used. Consumer QA remains blocked on artifact availability per the brief; this review provides no native import/secure-copy behavioral proof and does not lift that QA limitation. Verdict: clean — no BLOCKER or MAJOR remains in this delta. Terminal code-review round. |
CI remediation — required macOS build OOMImplementer: coder agent, openai/gpt-6.1-sol (automatic quota fallback). Fixed in 7d4a31c: required Mac job failure, verified from actual logs as renderer heap exhaustion at ~1995 MB, exit 134. Set a 4096 MiB old-space budget only on the Mac CI build step, matching publish/candidate and leaving nominal OS/native headroom on GitHub's documented 7 GB arm64 runner. Linux unchanged; Electron identity probe and shipped runtime do not inherit NODE_OPTIONS. Added a regression assertion against parsed workflow budget and step-only scope; bytecode remains enabled and build count remains one per leg. Executed: artifact contracts 7/7; A11 command parity/wiring mutants 2/2; direct existing Biome binary passes; whitespace clean. Pending: independent CI-only delta review and hosted CI/artifact result. Existing clean product/artifact reviews are retained for unchanged bytes; this comment does not claim independent approval, native success, or lift the manager's merge/release hold. |
Agent review — round 4Reviewer: independent reviewer agent, anthropic/claude-opus-5-5 (actual model; no fallback this round). Retest: required-CI heap failure only. Reviewed the entire two-file delta: macOS build-step-only heap configuration and its focused regression test. This post-clean round is justified by the failed required macOS build, not a new product finding or expanded review scope. Failure independently verified: job 131554409741 is The remediation raises old-space to 4096 MiB only for the macos-15 build step. This matches Executed with isolated HOME/config and an allowlisted environment on the clean manager-owned worktree at the pushed head: node --test --test-name-pattern='^(A11:|A11 wiring mutants:|Mac CI build |native artifact |staging )' scripts/ci-scope.test.mjs scripts/native-bytecode-artifact.test.mjsActual result: 9 tests, 9 pass, 0 fail — seven artifact/workflow tests (including actual inline staging execution and new flag-scope assertion), plus both A11 parity contracts. CI run 43333806500 read once: pending, headSha 7d4a31c. No local build, dependency install, artifact download or app launch. No claim that the new budget has yet produced an artifact or resolved the hosted build. Consumer QA/native import and secure-copy proof remain outstanding; no QA hold is lifted here. Verdict: clean — no BLOCKER or MAJOR in this delta. Terminal code-review round; required CI and native evidence remain separate gates. |
QA report — round 2QA: independent qa-tester · Actual served model: anthropic/claude-opus-5-5. Head: Verdict: BLOCKED at required dependency prerequisite. No artifact download, runtime probe or app launch. Requested artifact (from manager's authorization, not independently downloaded/audited here):
Q2 — missing approved dependencies/runtime (environment prerequisite)Repro: read the PR worktree's node_modules symlink; Required repair is an explicitly authorized stable dependency/runtime source whose lockfile and Electron45.1.0 runtime are proven compatible, or a revised self-contained evidence artifact. Do not restore a borrowed owner lease implicitly or install dependencies under this slot. This is not a product callback failure. Local build attempts remain exhausted 3/3. Artifact-host lane stopped at preflight before any native process. Exclusive slot was returned immediately so the waiting lane can proceed. No production page, KOHO tab, real credential or clipboard content accessed. This intended proof is CI-built production bytecode on an existing compatible runtime, NOT a full installer and NOT the installed application. Neither native behavior nor installed-app remediation is claimed. No new tests/builds ran. Receipt retained in session scratch: |
QA report — round 3QA: independent qa-tester · Actual served model: anthropic/claude-opus-5-5. Verdict: BLOCKED — real production-bytecode host started, but the first real Python browser-tool open stalled on loadURL(about:blank). No copy/auth PASS claimed. Executed matrix
Q3 — first browser tab cannot complete about:blank loadThe real Python browser tool reached the isolated host and returned its typed loadURL(about:blank) timeout before the disposable fixture could load. A second inspection confirmed the host had actually started and remained hidden; the discovery instance/pid/profile are this lane's, and logs show backend discovery attempting only the intentionally inert127.0.0.1:9. No retry, alternate browser engine, direct-CDP input or production app restart was attempted. Root cause is not established. The later network-service/GPU termination log entries coincide with our teardown and are not claimed as the cause of the earlier stall. This is a blocked host interaction prerequisite, not evidence that either clipboard callback failed. A separately authorized host/tab diagnosis or compatible pre-exercised artifact/environment is required before another native flow attempt. Artifact/bytecode identity
This is CI-built production bytecode on an existing runtime, NOT a full installer, NOT the installed app, and NOT a successful secure-copy native pass. Resource/cleanup receiptFresh initial df15,230,400KiB available (>=5GiB); immediately before host controller14,373,257,216 bytes free; after exact reap15,427,125,248 bytes free. Peak measured owned retained+scratch allocation123,752,448 bytes, below752MiB; no cap/minimum-free violation. Shared free-space increases are not attributed to this lane. After preserving artifact manifest, hash/runtime audit, redacted tool results, host log and native summary, removed ONLY owned downloaded ZIP, extracted artifact app and disposable profile/config/HOME. Removed the scratch dependency symlink without touching its leased target. Final cleanup df15,035,552KiB free. Both process groups independently empty after cleanup. No synthetic copied value remained on the clipboard; no secret was written. The random fixture value was never printed. Slot and read-only dependency lease released, manager notified immediately after exact reap so #1888 can proceed. Local-build count remains3/3 exhausted; this lane performed NO build of any kind. No production page, KOHO tab or real credential accessed. Durable session receipts: artifact-round3/audit.json, artifact-manifest.json, native-summary.json, tool-results.json, host.log; qa-round3-native-artifact.md. No fixture payload/profile/archive retained. |
Merge disposition: native proof not obtainedThis PR merges on non-native evidence, by the delegator's capped decision (Aida, 2026-11-13). Native proof is missing. What is proven at head
What is NOT proven
Follow-up commitment. After this ships, we verify with a real Copy click and an agent |
Summary
Fix the packaged desktop browser's secure
copyaction and page-initiated clipboard writes failing at the Electron import boundary. Keep Electron resolution lazy for node-only consumers, but use CommonJSrequire("electron")instead of dynamicimport()in both clipboard callbacks. No permission, gesture, receipt, version or UI layout changes.Root cause
The installed desktop app (0.54.3, manager verified) rejects
browser action=copywithA dynamic import callback was not specified. Both callbacks used dynamic Electron imports; the packaged bytecode VM has no dynamic-import callback. Existing tests alias/integrate Electron into an ESM bundle and therefore missed the external import boundary. New tests externalize Electron, rehydrate V8 cached data and run the emitted CommonJS wrapper without that callback, preserving lazy-load and gesture-denial controls.Evidence
All live reproduction used a new owned desktop browser tab (
ui:22) and a disposable loopback fixture, with a randomly generated value in a password field. No production sites, production credentials, copied bytes in tool output, or existing tabs were used.browser action=copy selector=#disposableA dynamic import callback was not specified#copy, then snapshotNotAllowedError: the host did not allow the clipboard writeb0edf02e5d37db5c5527cf66465131a4019fed10; runnode scripts/run-desktop-tests.mjs --test-name-pattern='cached-data loader' scripts/browser-clipboard-copy.test.mjs; restore patched bytes in finallyERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING; armed page write acks falsenode scripts/run-desktop-tests.mjs scripts/browser-clipboard-copy.test.mjsbiome check src/main/browser/actions/page.ts src/main/browser/actions/clipboard-shim.ts scripts/browser-clipboard-copy.test.mjsgit diff --checkResource/isolation limits
No dependency installs, clones or full builds. Primary stale detached checkout and its untracked work remain untouched. Worktree uses a source/tests-only sparse checkout after a normal checkout failed ENOSPC; dependencies are shared from an existing worktree with a byte-identical lockfile. Disk headroom is volatile and the disk recovery owner has not cleared packaged evidence.
Push used the documented
PREPUSH_BYPASSwith the explicit disk-hold/sparse-checkout reason after scoped tests and Biome; whole type/build legs were NOT run locally. CI and independent code/QA rounds remain outstanding. Do not merge or release yet.Provenance
Implementation started on anthropic/claude-opus-5-5; provider quota triggered the harness fallback to openai/gpt-6.1-sol, which implemented and tested this patch. No role/model configuration was changed.
Targeted test evidence — native artifact plumbing
Artifact-only delta:
0190c4a81e74508e53cff18f5d85bd560a4aa068..1e5ca178525c00b8250fdcfadf0be983805ed595. The two clipboard fixes/tests are unchanged by this delta; the manager reports their round-1 code review clean. This CI support change still needs independent delta review. No merge/release authorization and no native success claim.Compatibility and cost
The previous Bytecode Build Check ran Ubuntu x64, which cannot supply the darwin arm64 bytecode needed by the pinned Electron 45.1.0 native host. The repository's
electron.vite.config.jsdocuments exact Electron/V8 identity;scripts/mac-build-arch.test.mjsdocuments host-architecture bytecode incompatibility. The same existing job now has Ubuntu +macos-15legs, with fail-fast disabled so the new leg cannot cancel the old gate. GitHub's hosted-runner reference identifiesmacos-15as arm64. This adds one hosted macOS install/build per selected CI run; no fourth local build, dependency install, clone, packaging or signing was performed. Linux keeps its merge-ref integration gate; Mac checks out the immutable source head directly.Artifact contract and security boundary
.github/workflows/ci.yml, jobbytecode-build, macOS leg only, after its existingpnpm buildand.jscassertion.ui-native-bytecode-darwin-arm64-<sourceHead>-<runId>-<attempt>, retention 1 day.${{ runner.temp }}/ui-native-bytecode/: all ordinaryout/files (main bytecode + loader, all preloads, renderer HTML/assets includingbrowser-approvals-overlay.html), publicpackage.json,manifest.json.sourceHead == checkout, run/workflow/repository identity, actual Electron/Node/V8 versions, darwin/arm64, V8 cached-data tag, per-file relative path/size/SHA256. Missing expected compiled surfaces, source-head mismatch, symlinks and.env*in output fail closed.node_modules, native libraries, backend seed, source checkout, environment files, credentials or profiles. OAuth bindings are CI dummy placeholders; shipped public metadata/config defaults are not personal secrets.http://127.0.0.1:9, NOT live port 1111 or a customer remote. Backend manager is disabled (true); Radient and PostHog hosts also bind to that inert loopback address. Manifest records these bindings. Runtime env cannot rewrite the compiled renderer URL. A consumer needs its own compatible fixture or must treat API-dependent states as unavailable; main also requires the recorded runtime API/disable-manager bindings, isolated HOME/config and a disposable profile. Backend discovery safety must still be checked by consumer QA; this artifact is not a sandbox or standalone app.node --test scripts/native-bytecode-artifact.test.mjs.env. No Electron launched.node scripts/check-build-env.mjsbiome check --write scripts/native-bytecode-artifact.test.mjs;git diff --checkgit push origin HEAD:fix/secure-copy-bytecodetsconfig.node.json+tsconfig.app.jsontypechecks. Type leg reported 38.1 s. No native build.1e5ca178525c00b8250fdcfadf0be983805ed595. Artifact not yet produced/consumed. Per manager, native setup/build exhausted 3 attempts; artifact is supporting evidence, not a substitute native test.Implementation model: started anthropic/claude-opus-5-5; provider quota switched this child to openai/gpt-6.1-sol before implementation. No role/model pins or tool configuration changed.
Targeted test evidence — round 2 remediation
Agent review remediation — round 2
Implementer: coder / openai/gpt-6.1-sol (provider-quota fallback disclosed previously; no model/tool configuration changes).
Scope:
1e5ca178525c00b8250fdcfadf0be983805ed595..47a3d421faa0822a8f6d035dc521f1275dbbaeae.47a3d421faa0822a8f6d035dc521f1275dbbaeae. Addedscripts/native-bytecode-artifact.test.mjsto the existingJOB_COMMANDS["check-types"]release-contract command inscripts/ci-scope.mjs, matching the CI workflow command exactly. The parity assertion is unchanged. One-line mapping change only; no workflow/product/version change in this remediation.node --test --test-name-pattern="^A11: every job's local commands" scripts/ci-scope.test.mjs→ tests 1, pass 0, fail 1, withCI runs a longer list than the local gatenaming the omitted native artifact test.node --test scripts/native-bytecode-artifact.test.mjs→ tests 6, pass 6, fail 0. Actual inline staging code re-executed on synthetic fixtures; no Electron/native build/download.biome check scripts/ci-scope.mjs→ Checked 1 file; no fixes applied;git diff --checkpassed.Current head:
47a3d421faa0822a8f6d035dc521f1275dbbaeae.Next CI run 43319106365 was pending at metadata readback. Prior run 43318034632 is cancelled/superseded, not passing evidence. Native artifact name for this run is
ui-native-bytecode-darwin-arm64-47a3d421faa0822a8f6d035dc521f1275dbbaeae-43319106365-<attempt>; the unchanged manifest mechanism requiressourceHead == checkout ==this new head. Artifact generation/consumption and native secure-copy proof remain pending, not inferred from these tests. No merge or release.Targeted test evidence — required macOS CI heap repair
CI-only delta:
47a3d421faa0822a8f6d035dc521f1275dbbaeae..7d4a31c55c435466e61780cee14da33699d41a8d. No product bytes, version, bytecode configuration, build count or Linux heap policy changed.Re-read the actual failed macOS CI job and sanitized job logs using
gh api .../actions/jobs/131554409741/logs --allow-escape-sequences: 8422 renderer modules transformed, Mark-Compact at 1995.7 MB,FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory, exit 134. Bytecode assertion/runtime/staging/upload steps were skipped; no artifact or native-success claim.The Mac build step now gets
--max-old-space-size=4096, matching the existing publish/candidate budget. GitHub runner specifications listmacos-15as arm64, 3 M1 CPUs, 7 GB RAM. 4096 MiB old-space leaves nominal roughly 3 GB for OS/non-heap allocations (not a total-process memory guarantee). The environment is restricted to the single build step: neither later Electron runtime probes nor shipped app inherit it; Linux receives no Node heap flag.node --test scripts/native-bytecode-artifact.test.mjsnode --test --test-name-pattern='A11' scripts/ci-scope.test.mjsnode node_modules/@biomejs/biome/bin/biome check scripts/native-bytecode-artifact.test.mjsgit diff --checkpnpm exec biome ...failed before running Biome due toERR_PNPM_LOCKFILE_CONFIG_MISMATCH; no install/lockfile changes were made. Used the existing repository Biome binary directly for the passing scoped check. Push used disclosedPREPUSH_BYPASSunder the existing resource/local-build hold; local typecheck/build were not run. No fourth local build, dependency install, extra hosted build step, app launch, credentials, reviewer request or release action. Independent delta review and required CI remain pending.Implementation model: openai/gpt-6.1-sol after automatic provider-quota fallback from anthropic/claude-opus-5-5; no role/model settings changed.