Skip to content

fix(session-flow): seed the remote refs each resume-eval case names - #17700

Merged
kyle-sexton merged 7 commits into
mainfrom
fix/resume-eval-seed-remote-refs
Nov 21, 2026
Merged

kyle-sexton merged 7 commits into
mainfrom
fix/resume-eval-seed-remote-refs

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Refs: #17792

Summary

In the resume eval, the resumed reader looks for refs the case story names: a PR's head branch, a release branch, a tag. The seeded origin had none of them, and the eval sessions denied git ls-remote outright, so the reader's git -C <repo> ls-remote origin or git fetch origin was refused and the run counted as not delivered. In the last A/A, the before arm delivered 0 of 16 runs on re-decision-trimmed-to-fit and 0 of 15 on re-late-event.

This change seeds those refs locally and runs each eval session's shell commands in the Bash sandbox with no network host allowed, so a reader can read the run's local origin while any network attempt fails at the OS level. The owner decided both (Q63, Q66), recorded in the owner-decisions record and quoted in #17792.

Fix

  • New optional seed.remote_refs: full ref names (refs/heads/…, refs/tags/…, refs/pull/<N>/head). seed_run creates each one at the seeded HEAD in the run's local origin.git; tags are annotated. It adds a refs/pull/* fetch refspec when a pull ref is listed, then runs git fetch --prune --prune-tags origin against that local bare repo and sets origin/HEAD. A ref outside the three prefixes is refused. A case without the field seeds as before.
  • Eight cases gain the refs their story names, and each open PR's stub gh pr view answer carries a headRefName that is seeded. Tags the stories say are not cut yet (v1.8.0, v2.8.*, v2.14.0) and past release tags are not created.
  • Eval-session settings (run_settings): sandbox with enabled, autoAllowBashIfSandboxed, allowUnsandboxedCommands: false, failIfUnavailable: true (the session refuses to start without the sandbox rather than run unsandboxed), network.allowedDomains: [], network.strictAllowlist: true, and filesystem.allowWrite limited to the run folder and the harness temp directory.
  • write_run_settings writes each run's settings, and a second reader's private copy of the workspace gets its own, so its writable folder is the copy, not the first reader's run folder.
  • NETWORK_DENY, kept as a second layer beside the sandbox: curl, wget, WebFetch and WebSearch, and the URL (*://*) and user@host (*@*) forms of git ls-remote and git fetch, with and without -C. The blanket git ls-remote deny narrows to those forms. No allow rule is added. Earlier heads tried git allow and deny globs; review lanes and pr-verify found network forms those globs let through, which is why the sandbox replaces them.

Verification

  • uv run --with pytest python -m pytest -q plugins/session-flow/scripts/harness: 235 passed.
  • The settings test asserts the exact sandbox block, that curl, wget and 6 remote-URL git forms are denied (with and without -C), that 4 local origin reads (including --sort=v:refname and a refspec fetch) are not denied, and that no allow rule exists.
  • Seeding tests: a seed with remote_refs gives the exact git branch -r, git tag and rev-parse answers with the base clone's stale remote refs pruned; a seed without it pushes only HEAD; a ref outside the prefixes is refused; every open PR's pr view names a seeded headRefName; each not-yet-cut tag is absent.
  • Trials (before arm, Claude Code reader, 4 runs per case): seeds only, re-late-event 2/4 and re-decision-trimmed-to-fit 0/4 delivered; seeds plus the earlier git allow rules, 4/4 and 3/4. A trial on the sandbox settings is running; the do-not-merge label comes off when it delivers at least 2 of 4 per case.
  • scripts/run-ruff.sh check passes on the changed Python files.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 3 commits November 20, 2026 17:01
Resumed readers looked for a PR head branch, a release branch or a tag that
the case story names, found none in the seeded origin, and ran
git ls-remote or git fetch origin. Auto mode refuses those calls, so the
run counted as not delivered.

A new optional seed.remote_refs lists full ref names. seed_run creates each
at the seeded HEAD in the run's local origin.git (tags annotated), adds a
pull-ref fetch refspec when needed, and fetches with --prune, so
refs/remotes/origin/* and the tags mirror origin with no stale base-clone
ref left. A case without the field seeds as before.

Eight re-* cases gain the refs their story implies, and each open PR's
stub pr view answer now carries headRefName. No probe, grader or deny
rule changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A trial on the seeded refs still failed: readers confirm refs on the
remote with git -C <repo> ls-remote origin, which no rule matched, so
the auto-mode classifier refused it and the run did not deliver.

Eval sessions now allow git ls-remote and git fetch, with or without
-C. The URL, user@host and host:path forms stay denied (deny wins over
allow), and so does re-pointing a remote through git remote add or
set-url or git config remote.*, so a named remote stays the local
origin the harness created. The rules name no repository or path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 21, 2026 00:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T00:37:37.678336Z c189ab5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c189ab5f35

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44844509439

Failed GitHub API calls

No failed call recorded by the run job's scripts.

The host:path deny for git fetch (*:*) also matched a source:destination
refspec, so git fetch origin refs/pull/4460/head:review-4460 was denied
against the run's local origin, the PR-head fetch the seeded cases need.
fetch now denies only its URL and user@host forms; ls-remote, which
takes no refspec, keeps the host:path deny.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 7389ad0c67b8de7c78cc4218aa146033808cd0c3: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #17700, incremental (f0d5743..7389ad0)

I found no security issues in this push. This lane had already reviewed earlier heads, so the review was blocking only: SUGGESTION findings were dropped. I read every hunk of the three files in scope:

  • .changes/session-flow/fix-resume-eval-seed-remote-refs-a756c191.md
  • plugins/session-flow/scripts/harness/resume_eval.py
  • plugins/session-flow/scripts/harness/test_resume_eval.py

What changed:

  • Sandbox is now mandatory. run_settings sets "failIfUnavailable": True in the sandbox block (resume_eval.py#L101). On a host where the sandbox can't start, the session now refuses to run instead of falling back to unsandboxed Bash. This fixes my earlier IMPORTANT finding (discussion_r4650452757), and the settings test asserts the key in its exact-dict check.
  • Second network layer added back. NETWORK_DENY again denies curl and wget, plus the URL (*://*) and user@host (*@*) forms of git ls-remote and git fetch, with and without -C, beside the WebFetch and WebSearch denies. No allow rule is added, and the test asserts that none exists. These are denies only and widen nothing. The sandbox (allowedDomains: [], strictAllowlist: true, allowUnsandboxedCommands: false) stays the main network control. Any gap in the deny globs therefore still meets the OS-level block, so I'm not reporting one.
  • Each reader copy gets its own settings. The new write_run_settings helper now also runs for the second reader's private copy (resume_eval.py#L1490). Before, the copy kept the first reader's settings.json from copytree, which let it write to the first reader's run folder. Now it can write only to its own copy folder and the harness temp directory. This narrows what that reader can write.

Prior findings: both earlier inline findings are addressed. The git -C * global-option bypass went away with the allow globs in the last push, and the failIfUnavailable fail-open is fixed here.

Trusted paths and controls: none of the three files matches a TRUSTED PATHS: glob. Nothing here touches a trusted-actor check, lane token, kill switch, merge hold, .github/actions/* or a plugin manifest. The harness runs only on the operator's host, against case fixtures the owner wrote.

Spend: none beyond the prepaid eval runs the harness already makes.

critical-findings: 0

The ls-remote and fetch allow rules also passed --upload-pack=<cmd> (and
ls-remote's --exec and -u), which git runs through the shell against a
local remote, so a reader could run any command with no classifier
check. The eval sessions now deny those flags, the ext:: transport for
fetch, and any `git -C <dir> -c <config>` form that the -C allow rules
would otherwise pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton

Copy link
Copy Markdown
Member Author

claude-security-review finding (allow rules pass --upload-pack): CORRECT, fixed in 954bda8. NETWORK_DENY now also denies --upload-pack, --exec and -u for ls-remote, --upload-pack and the ext:: transport for fetch (bare and git -C *), and git -C * -c *, which the -C allow rules would otherwise pass with injected config. The permission test asserts 11 such forms are denied.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 7389ad0c67b8de7c78cc4218aa146033808cd0c3: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review (incremental, blocking only): resume-eval sessions run in the Bash sandbox (#17700)

No blocking findings in this push.

Scope: this review covers only what changed since f0d5743eb4, in three files: the changelog fragment, plugins/session-flow/scripts/harness/resume_eval.py and plugins/session-flow/scripts/harness/test_resume_eval.py. This lane already reviewed an earlier head of this pull request, so it reports blocking findings only. Advisory findings were dropped.

What changed

  • Sandbox is now required. run_settings sets sandbox.failIfUnavailable: true, so a session whose sandbox cannot start refuses to start. This settles the earlier fail-open thread.
  • Network denies are back as a second layer. NETWORK_DENY again denies curl and wget. It also denies the URL (*://*) and user@host (*@*) forms of git ls-remote and git fetch, with and without -C, beside WebFetch and WebSearch. No allow rule exists.
  • Second readers get their own settings.
    • A new helper, write_run_settings, writes settings.json writable at the folder it is given and at the harness temp directory.
    • seed_run now calls it.
    • _reader_workspace calls it for the copy after copytree (resume_eval.py#L1490), so the copy's allowWrite names copy_dir and not the first reader's run_dir.
    • This fixes this lane's earlier blocking finding (posted at f0d5743eb4). The new test test_a_second_readers_copy_gets_settings_that_name_its_own_folder checks both folders' settings.
  • Tests. The settings test checks the exact sandbox block, a set of network commands that must be denied, a set of local origin reads that must not be, and that no allow rule exists.

Scope notes

  • A separate security lane runs on this repository (pr-review-security-hosted.yml). Whether the sandbox and deny globs fully contain network access is that lane's call.
  • The settings test checks the deny rules with fnmatchcase. That only approximates Claude Code's own permission matching, so a pass there does not prove the real matcher behaves the same way.
  • Closing issue: none. The PR only refers to Resume-eval sessions: Bash sandbox instead of git permission globs #17792 and closes no issue, so there are no acceptance criteria to check.
  • Loosened checks: the prompt has no loosened_check_verdict: or loosened_check_patterns: lines, so this review used fail with no consumer entries. It also has no loosened_check_decision_record: line, so the citation requirement was not checked. The push replaces the strict permissions == {"deny": [...]} equality with a subset check plus behavioural deny/allow checks and a no-allow assertion. These pin the intended behaviour, so this review found no check loosened without a reason. Loosened checks would be marked: fail (plugin default); patterns: 0.
  • No plugin manifest changed in this push.
  • Spend: no money. Eval runs use only prepaid API usage.
  • The test results in the PR body are the author's claim and were not verified here: this lane has no shell.

Verifier dropped 0 of 0 candidates.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on 954bda8e26d5f1ab629ae4ad929411cc0031e138; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

The pr-verify verifier failed head f0d5743eb4188d3a0fa4386e770ef7a642b0bbfb. What it wrote, as data:

What it wrote (40 lines)
Summary: PR #17700 links no issue, so its trusted title and body are the spec. The ref-seeding part
  is delivered and tested. The new optional `seed.remote_refs` creates each listed ref in the run's
  local origin.git, then fetches with `--prune --prune-tags` and sets origin/HEAD. The diff refuses
  any ref outside refs/heads, refs/tags and refs/pull. Eight cases gain refs, and each open PR's `pr
  view` answer now carries a `headRefName` that is seeded. Tests cover all of this, and Test Python
  (0) and Test Bash (0) passed on the head commit
  (https://github.com/melodic-software/claude-code-plugins/actions/runs/44864297050/job/136724580095,
  https://github.com/melodic-software/claude-code-plugins/actions/runs/44864297050/job/136724580044).
  The permission change does not match the spec. The body describes allow rules for `git ls-remote`
  and `git fetch`, a narrowed network deny list, denies on re-pointing a remote, and a rules test
  covering 11+5 forms. It also says "No ... deny list changes". The diff does something else. It
  drops every Bash network deny (curl, wget, git ls-remote, URL forms of git fetch) and turns on the
  OS sandbox with `autoAllowBashIfSandboxed`. That is the Q66 replacement the body's own Hold line
  says still waits on an owner decision and the owner-decisions record. Removing these denies
  loosens a check. Only a closes or refs issue that links the owner-decisions record and quotes the
  owner's words can ask for that. This spec is a pull-request body, so it cannot, and the body gives
  no such link. The diff touches no file in the takeover set, and no binary files.
- plugins/session-flow/scripts/harness/resume_eval.py:28 The new `NETWORK_DENY = ("WebFetch",
  "WebSearch")` drops the Bash denies for curl, wget, `git ls-remote` and URL or user@host `git
  fetch`. Nothing in the spec asks for that, and no issue links the owner-decisions record with the
  owner's verbatim words. Either keep those deny entries next to the sandbox, or deliver the sandbox
  switch under an issue that carries the Q66 owner-decision link and the quoted words.
- plugins/session-flow/scripts/harness/resume_eval.py:42 `autoAllowBashIfSandboxed: True`
  auto-approves every Bash command, and there is no longer any network deny to fall back on. If the
  sandbox cannot start on the host, network access is no longer blocked. Make the run fail closed:
  keep the deny entries as defence in depth, or refuse to run when the sandbox is unavailable. Add a
  test that pins this behaviour.
- plugins/session-flow/scripts/harness/test_resume_eval.py:202 The test now checks only the exact
  settings dict and no longer proves any network command form is blocked. Keep or restore a test
  that asserts curl, wget and remote-URL git forms stay denied, or name the guard that now blocks
  them.
- PR body The Fix and Verification sections describe allow rules for `git ls-remote`/`git fetch`, a
  narrowed `NETWORK_DENY` with `*://*`, `*@*` and `*:*` forms, denies on re-pointing a remote, and a
  rules test covering 11 network and 5 re-pointing forms. None of that is in the diff. The body also
  says "No probe, grader, scoring, report code or deny list changes", while the diff replaces the
  deny list with a sandbox. Rewrite the body to describe the sandbox change the diff actually makes,
  and fix the Hold line, which says this exact change still waits on an owner decision.
- .changes/session-flow/fix-resume-eval-seed-remote-refs-a756c191.md:14 This entry announces the
  sandbox switch and the removal of the `git ls-remote` deny. Keep it in step with the outcome of
  the deny-list change above: drop or reword it if the denies are kept.

This pull request leaves the merge queue, and ci-status holds it out while it carries pr-verify-failed. A pr-verify pass removes the label, at a new commit or at this same head: once a trusted person edits the body, and only trusted people have edited it since the fail, this head is judged again, so a fail on the body or the issues it links needs only the body fixed, no new commit.

@github-actions github-actions Bot added the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 21, 2026
@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 21, 2026
The git allow and deny globs could not keep eval readers off the
network: reviews found --upload-pack, scp-style host:path fetches,
-C to another checkout and --exec-path all slipping through, because a
glob cannot tell which argument a colon or flag belongs to.

Each eval session now runs every shell command in the OS sandbox with
no allowed network host, a strict allowlist and no unsandboxed retry,
writable only in its working directory, its run folder and the harness
temp directory. The git ls-remote and fetch globs are gone, so a reader
can read the local origin's refs while any network attempt fails at the
OS level. WebFetch and WebSearch, which the sandbox does not cover,
stay denied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on f0d5743eb4188d3a0fa4386e770ef7a642b0bbfb; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on f0d5743eb4188d3a0fa4386e770ef7a642b0bbfb; the summary is in this lane's pull request comment.

claude-lane: claude-review

…dbox

pr-verify and the review lanes on f0d5743 found three gaps. The run
fell back to unsandboxed shells if the sandbox could not start; the
Bash network denies were gone, so nothing backed the sandbox up; and a
second reader's copied settings still named the first reader's run
folder as writable.

Eval sessions now set sandbox.failIfUnavailable, keep the curl, wget
and URL or user@host git ls-remote/fetch denies (with and without -C)
next to the sandbox, and every reader workspace gets settings written
for its own folder. Tests pin the denied forms, the local reads that
stay open, and the second reader's writable folder.

Refs: #17792

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the pr-verify-failed pr-verify failed this head; a pass at a new commit, or after a trusted body edit, removes it. label Nov 21, 2026
@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 21, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit d200bbe Nov 21, 2026
78 of 79 checks passed
@kyle-sexton
kyle-sexton deleted the fix/resume-eval-seed-remote-refs branch November 21, 2026 05:18
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant