Skip to content

Harden harness path projection, executable lookup and profile init - #58

Merged
LikC1606 merged 1 commit into
mainfrom
fix/harness-minor-robustness
Nov 28, 2026
Merged

LikC1606 merged 1 commit into
mainfrom
fix/harness-minor-robustness

Conversation

@LikC1606

Copy link
Copy Markdown
Collaborator

Follow-up to #57 with the three smaller harness issues found in the same review.

Changes

  • Role text projection (sealedRoleText): host workspace and profile paths are replaced only as whole path components, in a single pass, longest first. Before, replaceAll turned /runs/w-profile into /workspace-profile when the workspace was /runs/w, and also rewrote /runs/w2 and /mnt/runs/w.
  • Executable lookup: research and sealed launches now share locateHarnessExecutable. The sealed path used fs.existsSync, so a directory or a non-executable file earlier on PATH could shadow the real binary. Scripts run through runtime.interpreter still only need to be regular files. The research path now ignores relative PATH entries, matching the sealed path.
  • Web worker profile init (bindWebWorkerProfile): if a first binding was interrupted after the profile was created but before the binding file was written, every later bind failed on mkdirSync. With no binding file, nobody has used the profile yet, so the leftover copy is removed and initialization runs again.

Tests

New cases in tests/sealedHarness.test.ts (projection boundaries, nested workspace, lookup rules) and tests/webHarness.test.ts (recovery after an interrupted binding).

Locally on h200: 51 passed, 4 skipped, 1 failed across the six harness test files. The one failure is harnessProcess.test.ts "lets a Mathlib writer start a nested sandbox…" (bwrap: execvp bun), which also fails on main because that host has no bun. tsc --noEmit is clean.

🤖 Generated with Claude Code

- sealedRoleText rewrites host workspace/profile paths only as whole path
  components, in one pass, so /runs/w no longer corrupts /runs/w-profile,
  /runs/w2 or /mnt/runs/w, and a nested workspace maps correctly.
- Research and sealed launches share locateHarnessExecutable: absolute,
  cwd-relative with a separator, else the first executable regular file on
  absolute PATH entries. Sealed lookup no longer accepts directories or
  non-executable files; a script run through runtime.interpreter still
  only needs to be a regular file.
- bindWebWorkerProfile discards a profile copy left by an interrupted
  first binding instead of failing on mkdir forever.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LikC1606
LikC1606 merged commit a66fee4 into main Nov 28, 2026
4 checks passed
@LikC1606
LikC1606 deleted the fix/harness-minor-robustness branch November 28, 2026 14:50
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