Skip to content

Add bounded task queue, disk admission and monitor state (#333 step 5) - #407

Merged
oxa-orchestrator[bot] merged 99 commits into
mainfrom
agent/333-work-queue
Nov 18, 2026
Merged

oxa-orchestrator[bot] merged 99 commits into
mainfrom
agent/333-work-queue

Conversation

@n0rpan

@n0rpan n0rpan commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Feature A (native work board). Owner acceptance #1214

T3 — retain the explicit oxa work --queue execution queue (#333), dependent on #397. Ready at the protected checkpoint refresh.

The queue is opt-in and sequential by default. It retains oldest-input ordering, disk admission, task status, report serialization and draining of admitted workers. It consumes private runner checkpoints and the trusted supervisor; it does not replace the native helper spool/board runner. Main's helper_queue and this execution queue retain separate modules and both histories.

Repairs reject duplicate branches across watched files, include common Git storage in the free-space floor, and count real surviving task leases after their input disappears. Archived unadmitted jobs are withdrawn while active identities remain. Shared publication fixes from #397 scrub notes before persistence/output, preserve origin host and owner PR text, retain pending saves through reports, and require fresh checks on explicit action reruns. Ordinary action recovery cannot reseal an unchecked head.

Removes: the inlined single-task CLI body moves into Context::planned so single-task/queue paths share trusted APIs. Inherited runner implementations are reconciled with main; helper06585e84, original drain/checkout controls and source history remain. No limits, timers, budgets or scanners are weakened. The generic content-scanner claim was adjudicated against the stated contract in397comment6958079581; no scanner feature is added.

Validation: archive regression failed44123544179 then passed44125941626. Three queue-specific controls failed44135796040 then passed44137411135; the shared recovery controls failed44146808409 then passed current-parent lane44148608394 and queue lane44148660051. Current main-conflict refresh4a6c1f60 includes parentcb7ae1fd; draft checks44155735350 passed and lane44155721637 is running. Synthetic isolated-HOME fixtures, mock providers, no local builds/tests or real credentials. Current required CI, Cloud qualification and narrow execution-boundary read remain gates. Landing follows #397, then #749/#776; auto-approver owns review requests.

Main refresh

96b609f8e9c5f4a596fc07a8751c2779e2ca8ca5 merges main 78d1dda2. The two conflict resolutions retain main's protected work-storage check, committed verification and mirrors, plus this PR's queue dispatch and its inherited #397 publication and report paths. The queue module, report adapter and dedicated queue tests are byte-identical to 4a6c1f60. The shared dispatch has formatting changes from composing the routes.

Ports the local execution portion of night-watch + feeder + goal-loop from #307. Landing still follows #397. Hosted lane 44174222208 and draft checks 44174235872 record qualification for this head. The required draft gate passed and the PR is ready for full required checks.

Queue bounds, reporting lease and current main refresh

The test-first x86_64 job ran 1,415 tests and failed on the two intended controls. Repaired head e89fb4e0 passed on x86_64 and ARM64. Queue reads are limited to regular files up to 1 MiB and 128 tasks per file. A surviving host report command keeps the same per-user reporting lease. The queue and publication tests reuse the repository fixture.

Removes: the duplicate queue test fixture implementation and the unbounded read path.

Earlier refreshed head 4227fe3cda4aedb0a806ba6bb511f7eaaef6e34c includes main edae4644 through #397. It preserves the queue's native execution path and uses the shared bounded report runner. Work1 owns the typed Claims binding and Work2 owns the pre-hardlink call. #407 owns native completion and process reconciliation. Landing follows #397.

Current required checks · Current hosted lane

Protected checkpoint refresh

Head 1bf6389508b235af7964f9f549996283ece92712 carries main f02fc17b through #397. Publication retries retain main's protected storage checks and the queue retains its report lease. GitHub confirmed this head is mergeable. It passed the draft required gate and was marked ready. The exact hosted lane tracks the refreshed head.

Continuous task ownership

The prior full run caught a contention failure between execution and reporting in the concurrent report test. At current head 7bd662d80968683e5f016dff0cac38623fe57ad7, the trusted CLI holds the same protected task lock across execution, publication and reporting. Commands still inherit it so a surviving process retains ownership. The queue continues to serialize reports with its distinct per-user lease.

Before-fix required job · Fixed x86_64 and ARM64 lane · Fixed full required checks

Native completion and original lease fencing

Head de1e27fc43025be662704a049bd3366c7ee20782 carries the shared report deadline refresh and Work1's exact public Core contract e7866a56. The typed caller uses the original binding's native task ID and branch, supplies the held task lock to the worker, and uses the existing queue loop. Once the worker joins, the queue reacquires the protected task lock, reads the current durable task checkpoint, and holds that lock through release of the original full lease. Incomplete or stale results retain their reservation. Publication and helper activation remain off.

The exact Work1 required checks and Work2 hosted consumer lane passed. The scoped local oxa-work compiler check passed. Hosted controls for this composed head cover exact identity, a surviving task lock, stale and incomplete checkpoints, and one dispatch/one release through the existing queue.

Composed required checks · Composed hosted lane

The composed head passed the full required workflow and both hosted architecture jobs. The x86_64 log confirms the exact durable completion control, one native dispatch and release before its queue event, and the concurrent reporting regression. Hosted regression log · Exact Codex review

Protected native CLI execution

Head 0872759532440a3a5e9804f61c8ab3703e0a4b6f preserves the #1090 PR packet route and carries the refreshed #397. The explicit native command consumes one admitted packet from the existing protected spool. It supplies the held task lock to the existing task runner and binds the retained started packet to the original attempt generation. On completion it joins the worker and holds the task lock through the durable checkpoint read and exact lease release. The command is disabled by default and runs offline pending deterministic supervisor isolation.

The queue now limits retained task identities, total input bytes and the number of input files. The test-first lane reproduced both aggregate-limit defects. Hosted oxa-work/oxa-cli qualification and required checks track this head. Work2 owns the composed refill-to-native real CLI fixture on #1223. Publication and helper activation remain off.

Current native entry and #1192 composition

The previous lane caught a guidance symbol renamed by #1090. This head uses the shared runner guidance function. A merge preview with #1192 f75653c3 composes the common-directory dispatch and the same protected storage guard with the held-lock native queue path. Hosted lane · Required checks.

Head 49ed0fce026a930f1d6838990981f89e87fedb7a.

The required workflow, CodeQL and the hosted oxa-work/oxa-cli lane passed at this head. The x86_64 log confirms the two aggregate queue limits, generation-bound spool recovery and whole-task lease settlement. Work2's composed real CLI fixture remains the end-to-end qualification. Hosted regression log · CodeQL

Conflict refresh after #1043 and #1099

Head a0a6ada024e43d38426622129d2cfd2042f08b03. The normal merge carries #1043 and #1099 through the existing held-lock execution path. The CLI native adapter, queue dispatcher and spool match the previously qualified versions. The issue-only composed CLI and the separate reviewed PR source guard are still in qualification.

Hosted lane · Required checks

Queue conflict resolution after #397 landed

Head 0731c3917de4ac7f228ee792e5dd53a0355c3056 merges landed #397 0095e879 after GitHub removed #407 for a merge conflict. The approved added and removed lines match in 15 of 16 paths. The remaining visibility change already landed through #1192. The native CLI, queue, original-lease settlement and spool are byte-identical to the approved head.

The required checks and CodeQL passed. The hosted lane passed 1,517 tests on each architecture, including generation-bound recovery and exact durable settlement. Required checks · CodeQL · Hosted oxa-work/oxa-cli lane

@n0rpan
n0rpan marked this pull request as ready for review November 15, 2026 17:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 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-18T00:15:59.396744Z 0731c39 Manual request
🔒 Security Review ✅ Completed 2026-11-18T00:19:10.904876Z 0731c39 Manual request

Security findings

Advisory findings (5)

ℹ️ 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 15, 2026

Copy link
Copy Markdown
Collaborator Author

First-pass review by oxa → oxc → anthropic/claude-opus-5-5 at head 5c227ed (O-241; the orchestrator adjudicates and enqueues).

I found two concrete defects. The first one breaks a workflow the PR itself documents.

  1. P2: oxa/oxa-work/src/queue.rs:120 (entry.metadata()?), called from scan at :184. Scanning stops at the first error, and so does the controller. The new docs tell users to archive queue files by hand. If a file is moved or deleted between read_dir and metadata(), metadata() fails with NotFound and the ? aborts run_queue. oxa work then exits while worker threads are still running, and process exit kills them mid-agent. Any other passing error in busy() (:198, :207, :300) or in the emit calls does the same. Failure scenario: you mv tasks/a.json archive/ while two workers are running. Both tasks are cut off partway through, and the run blocks until you resume it. No test covers deleting or renaming a file during a scan; tests/work_queue.rs has none.

  2. P3: oxa/oxa-work/src/queue.rs:125-140. A file is re-read whenever its mtime or size changes, and every task ID already seen in it is counted as a duplicate and added to failed. Failure scenario: you append a new task to an existing queue file. Every task already in that file is reported as a failure, the failed count rises, and oxa work --queue … --once exits 1 even though nothing actually failed. The same happens when a file is rewritten after it failed to parse: the earlier failure stays counted for good.

I found nothing that weakens a scanner, the sandbox or a budget. There are also no secrets or personal paths in the diff. The PR touches the problem-report lock, but not credentials or publishing logic.

TIER: T2
VERDICT: REVISE

🤖 Generated with Claude Code (oxa review lane)

@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@n0rpan

n0rpan commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: a0a6ada024

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

@oxa-orchestrator
oxa-orchestrator Bot enabled auto-merge November 17, 2026 23:57
@oxa-orchestrator
oxa-orchestrator Bot added this pull request to the merge queue Nov 17, 2026

@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

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

Reviewed commit: a0a6ada024

ℹ️ 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 on lines +113 to +114
let (draft, title, body) =
save_draft(&note.title, &note.notes, dirs, ctx, runner).map_err(|e| e.to_string())?;

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

P3 Badge Security: Skip controller probes while drafting offline reports

When an owner runs oxa --offline work ... --report-problems for a task containing a problem note, this call builds the draft before the offline check at line 121. Draft construction runs oxc status --json, whose implementation opens fixed loopback connections to ports 8092 and 8090. Thus hard-offline mode still makes network calls, although no note text is transmitted and GitHub remains blocked. Build offline drafts without diagnostic subprocesses or enforce the network guard before invoking them.

SECURITY.md reference: oxa/SECURITY.md:L24-L24

Useful? React with 👍 / 👎.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 18, 2026
@n0rpan

n0rpan commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@n0rpan

n0rpan commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex security review

@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: 0731c3917d

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

Comment thread oxa/oxa-work/src/lib.rs
Comment on lines +1073 to +1077
let lock = fs::OpenOptions::new()
.read(true)
.write(true)
.mode(0o600)
.custom_flags(shadow::OWNER_FILE_FLAGS)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reuse the existing task-lock implementation

The new LockedTask::open duplicates the task-lock opening, ownership validation and acquisition logic in lock_task in this same file, which remains used by tree::transfer_branch. Execution/publication and branch transfer therefore maintain separate implementations of the same security-sensitive locking responsibility. Extend the existing helper to support opening without creation and call it here so both paths retain one implementation, as required by the repository's reuse rule.

AGENTS.md reference: AGENTS.md:L32-L35

Useful? React with 👍 / 👎.

if binding != &canonical || task.branch != binding.branch {
return Err("prepared task does not own the bound native attempt".into());
}
task.id.clone_from(&binding.native_task_id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Support branch handoff between native attempts

When a finished native attempt is followed by another admitted packet for the same branch, the new binding produces a different task ID and therefore a different worktree directory, while the previous retained worktree still has that branch checked out. tree::prepare releases a previous worktree's branch only when Task::reviewed_head() returns a value, but that method recognizes only pr-<number>-<head> IDs, never these board-... IDs. Consequently the next attempt reaches git worktree add without releasing the branch and is blocked before its worker starts. Add a native-binding-aware handoff that safely detaches the finished prior worktree while preserving its contents.

Useful? React with 👍 / 👎.

@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

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

Reviewed commit: 0731c3917d

ℹ️ 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/queue.rs
Comment on lines +262 to +264
if let Some(file) = input_file(entry)? {
if files.len() == MAX_QUEUE_FILES {
return Err(format!(

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

P2 Badge Security: Bound all queue directory entries before filtering

MAX_QUEUE_FILES is applied only after input_file accepts a visible regular .json; hidden files, non-JSON files, and nonregular .json entries are uncounted. In the documented repository-controlled --queue ./tasks flow, an author can populate that directory with arbitrarily many ignored entries. Every watch iteration traverses them before admission, keeping the controller CPU-bound and delaying all tasks despite the aggregate limits. Fresh evidence beyond the earlier aggregate-input report is that the new 256-file cap applies only after filtering. Count all DirEntrys before calling input_file.

SECURITY.md reference: SECURITY.md:L16-L16

Useful? React with 👍 / 👎.

@oxa-orchestrator
oxa-orchestrator Bot added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 6604b06 Nov 18, 2026
31 checks passed
@oxa-orchestrator
oxa-orchestrator Bot deleted the agent/333-work-queue branch November 18, 2026 00:34
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