Skip to content

Feature A: Normalize captured bases before sandboxed task checkout - #1043

Merged
oxa-orchestrator[bot] merged 11 commits into
mainfrom
oxa/issue-1027
Nov 17, 2026
Merged

oxa-orchestrator[bot] merged 11 commits into
mainfrom
oxa/issue-1027

Conversation

@oxa-agent

@oxa-agent oxa-agent Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Feature A (#1214), T3. Fixes #1027. Ports #307's worktree lifecycle and post-commit publish row: a new task uses the captured base without moving another checkout or freezing inconsistent aliases in the same batch.

Resolve the actual Git ref instead of guessing from remote-name spelling. Tags and symbolic local aliases cannot nominate a mutable local base. An empty no-checkout holder reserves an eligible stale base through the existing sandboxed checkout operation; a concurrent checkout makes Git refuse the reservation. The update compares the original OID without dereferencing aliases, runs before checkout callbacks, and preserves unexpected contents during cleanup.

The existing planner freezes batch inputs before callbacks. A local base and its sole requested remote fast-forward target share the captured commit and acceptance commands. Conflicting remote targets do not select a winner. Saved checkpoints and main's object-integrity, reviewed-branch, bounded-execution and committed-acceptance guards remain. No new store or checkpoint schema.

Validation of final source 5ed1e3dc114b1849b581b5a80eb12fffc2aee0f0:

  • Lane 44199231686 SUCCESS: selected oxa-cli, oxa-parity and oxa-work on x86_64 and ARM64.
  • Required CI 44199135531 SUCCESS, including the mandatory sandbox partitions and inventory guard; required check names verified coherently.
  • Current-head Code review clear and security review clear; execution-boundary owner read recorded. All nine previous review threads addressed and resolved.
  • Tests-first ac139a53 failed at runtime before the fix. Retains all original controls and adds tag, symbolic-ref, concurrent-checkout, batch-alias and callback-order regressions. A separately corrected fixture expectation is not counted as product failure proof.
  • Configured rustfmt and git diff --check pass. No local builds/tests.

Merged through the normal queue as 0611054fa399c1b44584af5688d877c8279aad38. Retains the complete existing oxa/issue-1027 history and every test; normal main merges resolved actual conflicts. Removes host-side ref mutation in favor of the existing sandboxed operation. Helpers remain paused; no lab script changes.

A fresh task worktree shares the source repository's refs. When the local
branch a task base names stayed behind the commit the base resolves to
(for example a local `main` after the checkout fetched a newer one), the
task's own diff against `main` read as the whole repository divergence.

Advance that branch when no work can be lost: only when it is a strict
ancestor of the frozen base, no worktree has it checked out, and the
update is a compare-and-swap against the observed tip. Any other state
is left untouched and never blocks the task.

Refs #1027
@oxa-orchestrator
oxa-orchestrator Bot marked this pull request as ready for review November 17, 2026 15:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 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-17T23:31:08.139015Z 5ed1e3d Manual request
🔒 Security Review ✅ Completed 2026-11-17T23:33:55.940199Z 5ed1e3d Manual request

Security findings

Advisory findings (1)

ℹ️ 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.

@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

First-pass review by oxa → oxc → chatgpt/gpt-6.1-sol at head 39a0bc1 (O-241; the orchestrator adjudicates and enqueues).

  • P2 — oxa/oxa-cli/tests/work_continue.rs:270: The new fast-forward test necessarily fails: setup() checks out main, and this test never switches away. fast_forward_stale_base() explicitly refuses to move checked-out branches (tree.rs:76), so local main remains stale and cannot equal origin/main. Detach the source checkout before running the worker to exercise the intended eligible-branch case.
  • P2 — oxa/oxa-cli/tests/work_continue.rs:290: The checked-out-branch test fails during setup: main is already checked out in project, so Git rejects worktree add … main. Furthermore, its task base is fetched, which makes the helper inspect refs/heads/fetched, not main; even after fixing setup, the final assertion would pass without the new protection and would not test its stated behavior.

TIER: T2
VERDICT: REVISE

🤖 Generated with Claude Code (oxa review lane)

Both fixtures kept the source checkout on `main`, so the sandboxed base
merge had to leave the checked-out branch where it was and the new
worktree never agreed with its base. Put the source checkout on its own
branch first, assert the frozen base is the fetched commit, and name the
base after that ref so the branch-advance path is what the tests cover.

Refs #1027
@oxa-agent
oxa-agent Bot marked this pull request as draft November 17, 2026 15:47

@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: 39a0bc1536

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread oxa/oxa-cli/tests/work_continue.rs Resolved
Comment thread oxa/oxa-cli/tests/work_continue.rs Resolved
Comment thread oxa/oxa-work/src/tree.rs Resolved
Comment thread oxa/oxa-work/src/tree.rs Resolved

@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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 39a0bc1536

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread oxa/oxa-work/src/tree.rs Resolved
@oxa-orchestrator
oxa-orchestrator Bot marked this pull request as ready for review November 17, 2026 15:53
@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

First-pass review by oxa → oxc → chatgpt/gpt-6.1-sol at head 769bd7c (O-241; the orchestrator adjudicates and enqueues).

Codex findings

  • FIXED — oxa/oxa-cli/tests/work_continue.rs:269: the lagging-base test now selects origin/main and switches the source checkout to source.
  • FIXED — oxa/oxa-cli/tests/work_continue.rs:291: the second test releases main before adding the review worktree.
  • CONFIRMED — P2, oxa/oxa-work/src/tree.rs:54: a tag origin/main can resolve to a descendant of local main; the remote-name heuristic then incorrectly advances main to that tag without verifying the remote-tracking ref.
  • CONFIRMED — P2, oxa/oxa-work/src/tree.rs:87: another process can check out main between the worktree check and ref update; the OID comparison still succeeds, leaving that checkout’s files/index inconsistent with its advanced HEAD.
  • CONFIRMED — P1, oxa/oxa-work/src/tree.rs:87: the host-side update-ref can execute a project’s reference-transaction hook outside the sandbox; metadata_git neither disables hooks nor isolates HOME/network, enabling credential access or offline bypass.

TIER: T3
VERDICT: REVISE

🤖 Generated with Claude Code (oxa review lane)

@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: 769bd7cf10

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread oxa/oxa-work/src/tree.rs Resolved
Comment thread oxa/oxa-work/src/tree.rs Resolved
The base-branch advance ran `git update-ref` on the host. `update-ref`
fires the repository's `reference-transaction` hook, so a branch that lags
its fetched base would execute project-controlled code outside the
sandbox -- the path worktree creation already closes by pinning
`core.hooksPath=/dev/null`.

Pin the same hooks path for that one metadata command and add a
regression test: a failing `reference-transaction` hook must neither stop
the advance nor run on the host, and the base branch still reaches the
fetched commit. The work doc now says the move is host metadata.

Refs #1027
@oxa-agent
oxa-agent Bot marked this pull request as draft November 17, 2026 16:09
@oxa-orchestrator
oxa-orchestrator Bot marked this pull request as ready for review November 17, 2026 16:11
@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

First-pass review by oxa → oxc → chatgpt/gpt-6.1-sol at head f67becd (O-241; the orchestrator adjudicates and enqueues).

Codex findings

  • FIXED — Lagging-base test now selects origin/main and switches the source checkout to source.
  • FIXED — Checked-out-base test releases main before adding the review worktree.
  • CONFIRMED (P2) — oxa/oxa-work/src/tree.rs:54: a tag named origin/main can resolve as the frozen base, yet the helper advances local main without verifying the remote-tracking ref.
  • CONFIRMED (P2) — oxa/oxa-work/src/tree.rs:87: a concurrent checkout between the worktree check and update-ref lets the update move a checked-out branch, leaving its files/index inconsistent with HEAD.
  • FIXED — Host-side ref updates now explicitly disable repository hooks with core.hooksPath=/dev/null.
  • CONFIRMED (P2) — oxa/oxa-work/src/tree.rs:213: all batch bases are frozen first; an origin/main task advances main, leaving a subsequent main task on its frozen stale base and producing the misleading diff this PR intends to prevent.
  • CONFIRMED (P2) — oxa/oxa-work/src/tree.rs:213: normalization still follows sandboxed checkout, so post-checkout hooks see the stale base and can reject checkout or generate incorrect metadata.

Additional defect

  • P2 — oxa/oxa-cli/tests/work_continue.rs:341–344: The new hook regression test commits on source but pushes unchanged main. Consequently origin/main and main remain identical, and assert_ne!(fetched, stale) always fails before exercising the fix. Additionally, installing the hook before fixture checkout/commit causes those host Git commands to create the very marker files the final assertions forbid. Push source:main and install the hook after fixture preparation.

TIER: T3
VERDICT: REVISE

🤖 Generated with Claude Code (oxa review lane)

@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: f67becdb3b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread oxa/oxa-cli/tests/work_continue.rs Resolved
Comment thread oxa/oxa-work/src/tree.rs Resolved
The hook regression test checked out `source` before committing, so the
fixture committed onto `source` and pushed an unchanged `main`. The fetched
base then equalled the stale one and the fixture's own precondition failed.
Build the fetched commit on `main`, then leave it, and install the
reference-transaction hook afterwards so only the runner's host metadata
could run it.

Refs #1027
@oxa-agent
oxa-agent Bot marked this pull request as draft November 17, 2026 16:20
@oxa-orchestrator
oxa-orchestrator Bot marked this pull request as ready for review November 17, 2026 16:26
@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

First-pass review by oxa → oxc → chatgpt/gpt-6.1-sol at head 15eef36 (O-241; the orchestrator adjudicates and enqueues).

Codex findings

  • FIXED — oxa/oxa-cli/tests/work_continue.rs:269–281: the lagging-base test now selects origin/main and switches the source checkout to source, freeing main.
  • FIXED — oxa/oxa-cli/tests/work_continue.rs:298: the checked-out-elsewhere test switches to source before adding the main worktree.
  • CONFIRMED — P2 — oxa/oxa-work/src/tree.rs:51–55: a tag named origin/main can resolve ahead of the remote-tracking ref, yet this code still selects local main for advancement. If the tag’s commit descends from main, the runner advances main to the tag rather than the fetched branch.
  • CONFIRMED — P2 — oxa/oxa-work/src/tree.rs:76–98: another Git process can check out the branch between the worktree check and update-ref. Checkout does not change its OID, so the compare-and-swap succeeds underneath that worktree, leaving its files and index inconsistent with its new HEAD.
  • FIXED — oxa/oxa-work/src/tree.rs:93–95: the host-side update explicitly sets core.hooksPath=/dev/null, preventing the reported reference-transaction hook escape.
  • CONFIRMED — P2 — oxa/oxa-work/src/tree.rs:213: all batch bases are frozen first (oxa/oxa-cli/src/work_cmd.rs:162–177). An earlier origin/main task advances main, while a later main task still starts from its frozen stale commit; its diff against main consequently includes unrelated base divergence.
  • CONFIRMED — P2 — oxa/oxa-work/src/tree.rs:213: normalization remains after sandboxed checkout. A post-checkout hook comparing against main therefore sees the stale base and can reject checkout or generate incorrect metadata before normalization occurs.
  • FIXED — oxa/oxa-cli/tests/work_continue.rs:340–345: the hook test commits and pushes main before switching to source, so the pushed commit now advances origin/main.
  • CONFIRMED — P2 — oxa/oxa-work/src/tree.rs:74–98: symbolic branch refs are neither resolved for the checked-out check nor rejected. If local main aliases a checked-out branch, the check misses that target, but update-ref dereferences the alias and advances the checked-out branch underneath its files.

TIER: T3
VERDICT: REVISE

🤖 Generated with Claude Code (oxa review lane)

@oxa-agent
oxa-agent Bot marked this pull request as draft November 17, 2026 21:03
@oxa-agent oxa-agent Bot changed the title WIP: work: fast-forward a local base branch that lags the fresh worktree Feature A: Normalize captured bases before sandboxed task checkout Nov 17, 2026
@oxa-agent
oxa-agent Bot marked this pull request as ready for review November 17, 2026 22:58
@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 5ed1e3dc11

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 5ed1e3dc11

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@oxa-orchestrator
oxa-orchestrator Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 0611054 Nov 17, 2026
31 checks passed
@oxa-orchestrator
oxa-orchestrator Bot deleted the oxa/issue-1027 branch November 17, 2026 23:45
oxa-agent Bot pushed a commit that referenced this pull request Nov 17, 2026
oxa-agent Bot pushed a commit that referenced this pull request Nov 17, 2026
oxa-agent Bot pushed a commit that referenced this pull request Nov 18, 2026
# Conflicts:
#	oxa/oxa-cli/src/work_checks.rs
#	oxa/oxa-cli/tests/common/work.rs
#	oxa/oxa-work/src/committed.rs
#	oxa/oxa-work/src/lib.rs
#	oxa/oxa-work/src/tree.rs
@oxa-agent

oxa-agent Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Merged as 0611054fa399c1b44584af5688d877c8279aad38. The merge-group integration run passed on that exact landed commit. Source 5ed1e3dc passed lane 44199231686 and required CI 44199135531, with current-head Code/security review and the required owner read; the nine prior review threads are resolved.

The Core binding API slice also merged in #1220. #1097 remains Draft on its existing branch while candidate 18bc55c7 completes fresh qualification. Native caller/completion acceptance remains with its assigned owners; this lifecycle merge does not claim the entire #307 row complete. Helpers remain paused.

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.

dogfood: The checkout's local main ref is a stale snapshot, not the PR base

1 participant