Pre-arm external buyer pilot watcher#21
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cca1854ae
ℹ️ 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".
| const startBlock = args.fromBlock && args.fromBlock !== true | ||
| ? BigInt(String(args.fromBlock)) | ||
| : await headBlock(); |
There was a problem hiding this comment.
Exclude the current head from the next-job scan
When the buyer already created a task in the block returned by this initial headBlock() call, the inclusive scan treats that existing task as the “next” one and immediately hands it to watch(). The watcher then stops looking for the task created after it was armed, so the intended pilot task can be missed; default the scan to the following block or snapshot and exclude logs already present at startup.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the latest branch commit. The default scan now begins at startup head + 1, and cap syntax is validated before PRE-ARMED is printed. Regression assertions and the complete agent:gate pass.
| async function watchNext(args) { | ||
| const buyer = String(args.buyer || "").toLowerCase(); | ||
| const jobDescription = String(args.jobDescription || ""); | ||
| const cap = String(args.cap || "0.5"); |
There was a problem hiding this comment.
Validate the cap before declaring the watcher pre-armed
When an explicit --cap is malformed, watch-next prints PRE-ARMED and waits successfully, but the existing cap validation in watch() runs only after the one-shot job has been discovered. The command therefore exits at the time-sensitive moment it was intended to protect, leaving the operator to restart during the 60-second enrollment window; apply the same cap validation before entering this loop.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the latest branch commit. The default scan now begins at startup head + 1, and cap syntax is validated before PRE-ARMED is printed. Regression assertions and the complete agent:gate pass.
There was a problem hiding this comment.
This is fixed in 3250a44 at lines 171-173: cap validation now runs before PRE-ARMED at line 182. The regression assertion and full agent:gate pass are included.
|
@codex review\n\nFixed both watcher findings and reran the full PolicyPool agent gate. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3250a44935
ℹ️ 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".
| const jobDescription = String(args.jobDescription || ""); | ||
| const cap = String(args.cap || "0.5"); | ||
| const targetAgent = String(args.targetAgent || "Foreman#4348"); | ||
| if (!/^0x[a-f0-9]{40}$/.test(buyer)) throw new Error("--buyer must be an address"); | ||
| if (!jobDescription) throw new Error("--job-description is required"); |
There was a problem hiding this comment.
Reject valueless job descriptions before arming
When watch-next is invoked with a valueless --job-description (for example, immediately followed by --cap), parseArgs stores true and this conversion turns it into the nonempty string "true", so the required-value check passes and PRE-ARMED is printed. The watcher then consumes the buyer's next one-shot job only for the preflight guard to reject that bogus description, potentially losing the 60-second enrollment opportunity; require a string value before announcing that the watcher is armed.
Useful? React with 👍 / 👎.
Summary
watch-nextso the pilot watcher can arm before the external buyer creates the Foreman taskSafety
Verification