Skip to content

Epic review: close the XHR redirect hole, add drift tests, align the docs - #460

Merged
neuromechanist merged 11 commits into
feature/issue-429-epic-browser-executionfrom
feature/issue-429-epic-review-fixes
Sep 23, 2026
Merged

neuromechanist merged 11 commits into
feature/issue-429-epic-browser-executionfrom
feature/issue-429-epic-review-fixes

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Summary

The fixes from the final review of the epic (#458). Four Sonnet reviewers covered the whole epic across the dimensions no single phase review could see: trust boundaries, contracts between the pieces, release readiness, and consistency across the documents. This addresses every finding except the ones listed under "Not changed", each with its reason.

Security: XMLHttpRequest followed a redirect off the egress allowlist

The worker's XMLHttpRequest shim checked a URL once at open() and then let the native implementation follow any redirect, so a 302 from an allowed origin reached anywhere. The fetch shim was fixed for exactly this in phase 2 (redirect: 'error'); XHR has no equivalent mode. It is now removed from the worker global outright, like WebSocket and EventSource. Nothing needed it: Pyodide loads its binary, lock and packages with fetch, and the namespace seal already removes every Python path that could reach XHR. Proven in real Chrome: chrome.js now serves an allowed path that 302s to a disallowed one, and with the old shim restored, Chrome's XHR followed the redirect and delivered the disallowed body; with the fix, XHR is refused before it looks at a URL and fetch rejects the real 302. Under Bun the old coverage was vacuous, since Bun has no XMLHttpRequest at all.

Drift tests where one value was kept in two places

  • ResultStatus in src/api/tool_results.py against the browser's statuses, now declared once in osa-runtime.js (RESULT_STATUS). Mutation-checked in both directions.
  • The workspace caps: save_script and save_artifact's docstrings are now generated from WORKSPACE_LIMITS, and a pytest checks the numbers in NEMAR's execute_code description against the real module.
  • The frontend job written out in both test.yml and tests.yml: a pytest asserts the two are identical, step by step.

Release

  • The Docker smoke test now fetches /nemar, then every wheel its runtime_lock lists, and fails unless each is a 200 whose sha256 matches. Verified against a live server, including a wrong hash, an empty lock and a 404.
  • A CHANGELOG.md entry under [Unreleased], which the epic lacked.

Documents

  • The design note's Architecture, Sequence, Server changes and Phasing sections now carry "As built" notes for the two-run transport (no interrupt(), no checkpointer), the NEMAR adoption row names eegprep-lean and how_to.python_browser, and the network paragraph says XHR is removed.
  • ADR 0010 names Phase 4c: the editable re-run panel #456 instead of a phase label, and says prerequisite 3 needs nemar-cli only for a site outside osc.earth.
  • The adopter guide states the 20-runs-per-reply cap, spells out URL and OPFS, and drops double-hyphen dashes.

Not changed

  • A parked call is closed out on the next use of the session, not on a timer. Under the two-run transport no stream is open when a call goes unanswered, so running the model in the background would produce a reply nobody receives. The next message or late result closes the call with a tool message telling the model it was not answered (abandon_pending_call). The design note now says this is deliberate.
  • The Python jobs in test.yml and tests.yml differ. That predates the epic; only the frontend job, which the epic added, is now held equal.
  • The Docker image does not copy frontend/. By design: the image is the API, and the widget ships from Cloudflare Pages (The Docker image never serves /frontend, silently #459, closed).
  • Accepted and already recorded as design choices: eviction can drop a parked session when every session in a community is parked (tested), the session store assumes a single process, and session_id is a routing key rather than a credential, with call_id entropy and the CORS allowlist as the barrier.
  • The claude-review check on Browser execution: run model-written Python in the reader's browser #458 failed inside the action itself (86 permission denials, no review posted); it is not a finding.

Test plan

  • uv run pytest -m "not network": 2718 passed, 50 skipped; the one failure is the known test_version_shows_version fails locally and passes in CI, because rich colorizes on a TTY #434 color-terminal test. ruff check and ruff format --check clean.
  • Every Bun suite CI runs, including test-egress.js 80, test-output.js 80, test-runtime-lifecycle.js 180, test-worker-core.js 190, test-widget-tools.js 222, test-runtime-bundle.js 25; build-runtime-bundle.js --check and build_runtime_lock.py --check current.
  • chrome.js: nemarlike 43 of 43 (three new redirect checks), control refused, workspace 40 of 40 and 14 of 14 after reload, warm and lock change.
  • The widget's integrity hash changes again; nemar.org re-pins after the release.

Part of epic #429.

Architecture, Sequence, Server changes and Phasing now carry as-built notes for the two-run transport: no interrupt(), no checkpointer, and a parked call closed out on next use. The NEMAR adoption row names eegprep-lean and python_browser, and the caps table gains the per-reply run cap.
ADR 0010 names #456 instead of a phase label and says prerequisite 3 needs nemar-cli only off osc.earth. The guide gains the per-reply run cap, spells out URL, OPFS and the File System Access API, and drops double-hyphen dashes.
Comment only; the guard source is bundled, so the bundle and its integrity pin are rebuilt.
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Preview Deployment

Name Link
Preview URL https://feature-issue-429-epic-revie-demo.osc.earth
Branch feature/issue-429-epic-review-fixes
Commit e26f11a

This preview will be updated automatically when you push new commits.

The drift test matched a single line, so a formatter-wrapped Literal would have failed it loudly. It now reads up to the closing bracket. Checked with a wrapped Literal (passes) and a Python-only status (fails).
@neuromechanist
neuromechanist merged commit 58b86cd into feature/issue-429-epic-browser-execution Sep 23, 2026
13 of 14 checks passed
@neuromechanist
neuromechanist deleted the feature/issue-429-epic-review-fixes branch September 23, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant