Skip to content

fix(agentsapi): ignore saved cron tool lists at harness dispatch - #160706

Open
sjf-oa wants to merge 1 commit into
mainfrom
sjf/agentsapi-cron-current-tools
Open

sjf-oa wants to merge 1 commit into
mainfrom
sjf/agentsapi-cron-current-tools

Conversation

@sjf-oa

@sjf-oa sjf-oa commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Why

Agents API cron turns can fail before inference because the saved Gateway tool list does not include the native shell, file, and search tools. Agents API cannot enforce that per-job list across its native tool surface. The fix belongs to its harness, without changing cron behavior for other backends.

What changed

Agents API declares that its cron attempts use current agent tool policy. Shared harness dispatch consumes that declaration after choosing the actual backend and removes only toolsAllow from a copy of that attempt, before policy checks, host capabilities, and tool authority are prepared. Other backends and fallback attempts retain their original parameters.

Current configured restrictions, disabled tools, execution restrictions, and scheduled ownership remain enforced. Agents API still rejects a Gateway-only execution pin that its native shell cannot honor.

There are no changes to the cron service, job creation, stored job data, automation tools, or message grants. Cron continues to capture/store lists normally; Agents API ignores them at harness dispatch. Earlier scheduler checks still apply, so this addresses the reported native preflight failure rather than removing every upstream use of a cron list.

Validation

  • Revised implementation pushed before checks and review, as requested.
  • pnpm tsgo:core, pnpm tsgo:extensions, and git diff HEAD^ HEAD --check: passed.
  • Independent Auto Review of the narrowed implementation: no actionable P0/P1 findings. This is source review, not runtime proof.
  • Unit tests, formatters, and live tests were not run, per the requested workflow. No Gateway was changed or restarted.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling extensions: agentsapi size: M labels Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Security-sensitive guard cleared

Current revision: f4e982cb07828d2e2daa159be5ea2725f3b91ff4

This PR no longer changes files in the maintainer security-review tier.

Separate CODEOWNERS requirements still apply to security policy and enforcement files.

@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-cron-current-tools branch 2 times, most recently from 7560c4d to 84fda73 Compare September 28, 2026 20:53
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-cron-current-tools branch 2 times, most recently from d67f543 to 375b9e3 Compare September 28, 2026 20:57
@openclaw-barnacle openclaw-barnacle Bot added size: XS and removed gateway Gateway runtime size: L labels Sep 28, 2026
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-cron-current-tools branch from 375b9e3 to 12125c8 Compare September 28, 2026 20:58
@sjf-oa
sjf-oa force-pushed the sjf/agentsapi-cron-current-tools branch from 12125c8 to f4e982c Compare September 28, 2026 20:58
@sjf-oa sjf-oa changed the title fix(agentsapi): run automations with current agent tools fix(agentsapi): ignore saved cron tool lists at harness dispatch Sep 28, 2026
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 28, 2026, 5:06 PM ET / 21:06 UTC.

ClawSweeper review

What this changes

For scheduled Agents API turns, the branch ignores the job’s saved tool list at harness dispatch, documents the exception, and rejects Gateway-pinned execution.

Merge readiness

⛔ Blocked before merge - 10 items remain

Keep this PR open. Current main still rejects restricted Agents API cron attempts, but the proposed exception bypasses the documented creator-approved tool cap. That security boundary and the lack of final-effect proof block merge.

Priority: P0
Reviewed head: f4e982cb07828d2e2daa159be5ea2725f3b91ff4
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused change addresses a real preflight failure, but it bypasses persisted tool authority and has no real-path proof.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: Authority-chain proof required: the changed harness dispatch removes the saved cap before Agents API native execution, but the PR supplies no after-fix cron trace showing an allowed result and rejection before shell, file, or search I/O for a forbidden creator. Typechecks and source review are supplemental; no stored-data format changes. A redacted runtime transcript or logs would help, and updating the PR body should trigger re-review; otherwise a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Authority-chain proof required: the changed harness dispatch removes the saved cap before Agents API native execution, but the PR supplies no after-fix cron trace showing an allowed result and rejection before shell, file, or search I/O for a forbidden creator. Typechecks and source review are supplemental; no stored-data format changes. A redacted runtime transcript or logs would help, and updating the PR body should trigger re-review; otherwise a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 8 items Introduced bypass: The pinned PR hunk clears toolsAllow for cron attempts after selecting a harness that declares current-agent policy, before tool authority is prepared.
Saved-cap contract: The current automation documentation says --tools restricts job tools, including an empty deny-all list, and agent-created jobs cannot widen the creator’s captured cap.
Scheduler handoff: Cron still passes the stored toolsAllow list into the embedded agent run; its message grant is separately minted from that list.
Findings 1 actionable finding [P1] Preserve the creator-approved cron tool cap
Security Needs attention Restricted cron jobs can reach native tools: The selected harness erases a persisted allowlist before its policy and tool-authority checks. A job whose creator excluded shell, file, or search can therefore reach those Agents API native effects when current agent config permits them.

How this fits together

The cron scheduler stores a job’s approved tool list and passes it to the selected agent harness. The harness prepares Gateway tools and, for Agents API, an OpenAI-hosted session that can perform native actions.

flowchart LR
  A[Job creator] --> B[Stored cron tool cap]
  B --> C[Scheduler admission]
  C --> D{Selected harness}
  D --> E[Gateway tool policy]
  D --> F[Agents API native tools]
  E --> G[Tool actions]
  F --> G
Loading

Decision needed

Question Recommendation
May an Agents API cron job use native shell, file, and search tools that its stored creator-approved tool cap excludes? Keep saved caps authoritative: Reject Agents API attempts that cannot enforce the saved cap and explain how an authorized creator can reauthorize the job.

Why: The branch deliberately changes the meaning of persisted job authority, so source review cannot authorize that security and upgrade tradeoff.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Authority-chain proof required: the changed harness dispatch removes the saved cap before Agents API native execution, but the PR supplies no after-fix cron trace showing an allowed result and rejection before shell, file, or search I/O for a forbidden creator. Typechecks and source review are supplemental; no stored-data format changes. A redacted runtime transcript or logs would help, and updating the PR body should trigger re-review; otherwise a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Preserve the creator-approved cron tool cap (P1) - For a job saved with toolsAllow: ["read"] or [], this assignment removes the cap before host policy and Agents API preflight. The job can then reach native shell, file, or web search tools that its creator could not grant, contrary to the documented cron cap contract. Keep that cap effective at the final tool boundary or require explicit reauthorization before dispatch.
  • Resolve security concern: Restricted cron jobs can reach native tools - The selected harness erases a persisted allowlist before its policy and tool-authority checks. A job whose creator excluded shell, file, or search can therefore reach those Agents API native effects when current agent config permits them.
  • Resolve merge risk (P1) - A stored cron cap such as read-only or deny-all can be discarded before Agents API native tool preparation, giving the job shell, file, or search access its creator did not approve.
  • Resolve merge risk (P1) - The new Gateway-pinned execution check can stop previously running Agents API jobs at preflight; the PR does not establish an upgrade recovery path or fresh-install and upgrade behavior.
  • Complete next step (P2) - Resolve the saved-cap authority bypass, establish an upgrade path for Gateway-pinned jobs, and provide allowed and forbidden final-effect proof before merge.
  • Improve patch quality - Preserve or explicitly reauthorize the saved cron cap before Agents API native effects.
  • Improve patch quality - Add final-effect proof for an allowed creator and the nearest forbidden creator, including rejection before native I/O.
  • Improve patch quality - Show fresh-job and upgrade behavior for Gateway-pinned existing jobs.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P1] Preserve the creator-approved cron tool cap — src/agents/harness/selection.ts:209-215
  • [high] Restricted cron jobs can reach native tools — src/agents/harness/selection.ts:214
Agent review details

Security

Needs attention: Clearing a creator-approved cron cap before native tool preparation can grant a restricted job shell, file, and search actions.

PR surface

Source +12, Docs +19. Total +31 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 15 3 +12
Tests 0 0 0 0
Docs 2 19 0 +19
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 34 3 +31

Review metrics

Metric Value Why it matters
Plugin harness policy 1 new optional capability It changes how a public harness contract interprets persisted cron tool authority.

Merge-risk options

Maintainer options:

  1. Preserve the job cap (recommended)
    Keep the saved cap in final tool preparation, reject unsupported native execution, and document how affected jobs regain authorized access.
  2. Approve a reauthorized exception
    If maintainers want current-agent semantics, require explicit reauthorization of existing jobs and proof that unauthorized native effects are rejected.
  3. Pause the capability
    Defer this harness policy until Agents API can enforce the saved cap or a safe migration is specified.

Technical review

Best possible solution:

Keep creator-approved cron caps authoritative through final Gateway and native effects; give unsupported Agents API jobs a clear reauthorization path and prove allowed, forbidden, and Gateway-pinned cases.

Do we have a high-confidence way to reproduce the issue?

Yes, source gives a clear path: an Agents API cron attempt with a saved read-only or empty cap is rejected on main, while this branch clears that cap before harness preflight. No live run was supplied or executed in this read-only review.

Is this the best way to solve the issue?

No. Ignoring every saved list changes creator-approved authority; a cap-preserving rejection with actionable reauthorization is safer unless maintainers approve and prove a narrower exception.

Full review comments:

  • [P1] Preserve the creator-approved cron tool cap — src/agents/harness/selection.ts:209-215
    For a job saved with toolsAllow: ["read"] or [], this assignment removes the cap before host policy and Agents API preflight. The job can then reach native shell, file, or web search tools that its creator could not grant, contrary to the documented cron cap contract. Keep that cap effective at the final tool boundary or require explicit reauthorization before dispatch.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5c3d2ee89723.

Labels

Label changes:

  • add P0: The introduced dispatch rule can bypass a creator-approved cron tool restriction.
  • add merge-risk: 🚨 compatibility: Existing jobs gain different tool semantics, and Gateway-pinned Agents API jobs may begin failing at preflight.
  • add merge-risk: 🚨 security-boundary: Clearing the saved cap can expose native shell, file, and search actions to a restricted job.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Authority-chain proof required: the changed harness dispatch removes the saved cap before Agents API native execution, but the PR supplies no after-fix cron trace showing an allowed result and rejection before shell, file, or search I/O for a forbidden creator. Typechecks and source review are supplemental; no stored-data format changes. A redacted runtime transcript or logs would help, and updating the PR body should trigger re-review; otherwise a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P0: The introduced dispatch rule can bypass a creator-approved cron tool restriction.
  • merge-risk: 🚨 security-boundary: Clearing the saved cap can expose native shell, file, and search actions to a restricted job.
  • merge-risk: 🚨 compatibility: Existing jobs gain different tool semantics, and Gateway-pinned Agents API jobs may begin failing at preflight.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Authority-chain proof required: the changed harness dispatch removes the saved cap before Agents API native execution, but the PR supplies no after-fix cron trace showing an allowed result and rejection before shell, file, or search I/O for a forbidden creator. Typechecks and source review are supplemental; no stored-data format changes. A redacted runtime transcript or logs would help, and updating the PR body should trigger re-review; otherwise a maintainer can comment @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [high] Restricted cron jobs can reach native tools — src/agents/harness/selection.ts:214
    The selected harness erases a persisted allowlist before its policy and tool-authority checks. A job whose creator excluded shell, file, or search can therefore reach those Agents API native effects when current agent config permits them.
    Confidence: 0.93

What I checked:

Likely related people:

  • Sarah Fortune: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: agentsapi merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants