Skip to content

Fix harness link grants and oversized Lead resume replay - #80

Merged
LikC1606 merged 1 commit into
mainfrom
fix/harness-link-grants-resume
Dec 1, 2026
Merged

LikC1606 merged 1 commit into
mainfrom
fix/harness-link-grants-resume

Conversation

@LikC1606

@LikC1606 LikC1606 commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Harness read roots. harnessReadRoots followed symlinks and .git files in the launch workspace and profile and added their targets to the home allowlist. The agent can write both directories, so a link or forged .git file planted in one turn exposed home content such as ~/theorem-os-runs on the next launch. The link scan is replaced by worktreeMetadata. It follows a .git file only when the metadata directory sits outside the checkout, names the checkout back through its gitdir file, and lies under the shared repository's worktrees/. .lake/packages links still resolve through the trusted cache roots from the environment.

Oversized Lead resume. A native team Lead with a budget gate and a direct provider resumes without excludeTurns to keep the usage replay. Once its history exceeded the 8 MiB stdio frame limit, startup failed with math_codex_transport_closed:frame_too_large. The team kept the same root thread, so continuous cooling retried it every 300 s forever. Seen on balance-full-prove2me.

  • createCodexMathSession now reopens the thread once with excludeTurns: true when that resume reply is too large. The next turn's cumulative total still includes the skipped replay.
  • planResearchCooldown stops cooling an oversized frame that recurs after one cooldown. Other transport_closed causes cool as before.

Tests

  • tests/harnessProcess.test.ts: planted links, nested links, forged and stranger .git files and a symlinked .git grant only the declared roots, and bwrap cannot read the target. A verified worktree is still granted.
  • tests/codexSessionAgentControl.test.ts: a budget-gated Lead with an 8 MiB history resumes on the second attempt with excludeTurns. This test fails on main with frame_too_large.
  • tests/workerRecovery.test.ts: covers the cooldown cutoff.
  • Focused suites (harnessProcess, codexSession*, agentTeamResearch, research*, workerRecovery) pass: 623 tests. tsc --noEmit and bun scripts/build.ts pass.

Not deployed. Running solvers are not changed by this PR.

🤖 Generated with Claude Code

Harness read roots no longer follow symlinks or `.git` files that the
agent can write in its workspace or profile. A `.git` file widens the
home allowlist only when its worktree metadata names the checkout back
and lies under the shared repository's `worktrees` directory.

A native Lead resumed with a budget gate requested turn history for the
usage replay. When that reply exceeded the 8 MiB stdio frame limit, the
session failed and continuous cooling retried it indefinitely. The host
now reopens the thread once with `excludeTurns`; the next turn's
cumulative total still includes the skipped replay. An oversized frame
that recurs after one cooldown stops the run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LikC1606
LikC1606 merged commit 0860f41 into main Dec 1, 2026
4 checks passed
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