Skip to content

fix(cron): retain app access when owners replace allowed tools - #170498

Merged
steipete merged 2 commits into
mainfrom
upd/upd-l1584
Oct 13, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/upd-l1584

Conversation

@steipete

@steipete steipete commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #170298

What Problem This Solves

An owner replacing an automation's toolsAllow could receive a successful update while the selected Codex app tool remained unavailable at run time.

User Impact

A fresh authenticated owner turn can replace the tool cap and capture the app authority needed by that automation. An owner whose capture is unavailable receives an error naming the requested tools and explaining how to recreate the automation. Non-owner managers retain their existing cap-edit workflow: replacing the cap clears captured app authority, and the next run reports that app access needs reauthorization. Ordinary edits preserve captured authority.

Why This Change Was Made

Management grants were suppressing creator capture in the tool adapter and discarding creator grants in the Gateway scope. Preserve those separate authorities, capture only for the job's original owner session/account, and validate owner capture against the same scope restrictions as cron.add, including the locked update precondition. Non-owner management authority cannot lend creator authority. Runtime authority storage and reconciliation remain with the existing cron owner.

Net change: +22 production lines, +169 test lines, +5 documentation lines. No config, schema, or dependency changes.

Evidence

  • Revised regression exercises the real tool → Gateway handler → CronService/store path with existing captured app authority: owner replacement, already-visible tools, other sessions, other accounts, borrowed capture, and missing capture. All ten cases pass. Manager edits persist the new cap, clear captured authority, and retain the reauthorization marker; an owner without capture leaves storage unchanged. Against the previous PR head, the three manager cases failed at the overly broad refusal as expected.
  • After the review correction, all six focused suites passed: 169 tests in 483.88 seconds wall time. These cover Gateway policy adoption/validation/caller scope, admin tool edits, service authority clearing, and forwarding reauthorization into the next run. The changed regression file used 24.485 seconds of test time. The unchanged next-run reauthorization-forwarding case took 46.442 seconds; no timeouts, retries, or assertions were weakened.
  • Core typecheck, Gateway-method test typecheck, targeted lint, formatting, and isolated review passed for the corrected code. The review found no actionable P0–P2 issues.
  • Before this adjustment, the full 38-file sibling proof passed at 06449419fdcb45c9e45f70e327b77e205452e823: 672 tests in 1,669.75 seconds, with source-fingerprint verification. All 28 affected test type graphs also passed then. The lead requested focused proof for this correction; the shared CronService authority/reconciliation owners remain unchanged.
  • The earlier full node scripts/check-changed.mjs completed in 1,738.27 seconds and failed only at the inherited Knip unused-export findings listed below. The lead confirmed these are unrelated to this patch and may support in-flight work; they remain unchanged. No check was disabled and no baseline was changed.

Inherited, unrelated Knip findings:

  • scripts/lib/postgres-schema-catalog.mts: literal
  • src/agents/failover-error.ts: hasProviderRequestSizeCeiling
  • src/tts/tts.ts: getResolvedSpeechProviderConfig (ttsRuntime)
  • ui/src/app/app-root.tsx: OpenClawApp
  • ui/src/app/app-shell-view.tsx: ApplicationShell
  • ui/src/app/shell-layout-traits.ts: ShellLayoutController
  • extensions/workboard/src/test/postgres-fixture-contract.ts: PostgresFixtureReply

@clawsweeper

clawsweeper Bot commented Oct 13, 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 size: M labels Oct 13, 2026
@steipete
steipete marked this pull request as ready for review October 13, 2026 01:42
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 13, 2026
@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR lets matching owners capture fresh Codex app authority when replacing an automation’s allowed tools.

Example: The original owner replaces an automation’s toolsAllow with ["calendar_search"] from a fresh authenticated Codex turn.

  • Before: Management authority suppresses creator capture, so the update succeeds without restoring scheduled app access.
  • After: The update captures and stores fresh app authority, or rejects an owner update whose capture is unavailable.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful production-owner regression and a focused repair support limited confidence; material authority-chain validation remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An owner receives a successful automation update, but its scheduled run still cannot access the selected Codex app.
Reason: The maintainer-authored direction restores documented owner reauthorization and explicitly retains non-owner management edits.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open: it repairs a current, documented owner-reauthorization defect while preserving cross-owner management edits; no concrete introduced code bug was found.

Priority: P2
Reviewed head: 7a01f5a2fb28288d72e770e9f6356789aaf9b570

Before merge

  • Add real behavior proof - Authority-chain proof required: the corrected regression reaches real tool, Gateway, and CronService/store owners, but injects creator resolution and an opaque app envelope. Demonstrate that revoking management or creator authority while the combined update is pending prevents persistence, then show that the resulting scheduled authority permits the intended app and rejects a foreign prepared account or revoked app before app I/O. The inspected historical screenshots cover different behavior, and the previous review’s requested final-effect scenario remains unaddressed. Supply redacted terminal output, logs, or a recording, removing credentials and private endpoints. 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.
  • Resolve security review attention item - No concrete bypass was found; clearance depends on the authority-chain evidence specified below.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not exercise revocation during the combined management-and-creator update through persistence, followed by allowed and forbidden scheduled app effects.
Agent review details

How this fits together

The Automations tool carries separate management and creator grants into Gateway validation, then CronService persists the authority ceiling consumed by scheduled Codex execution.

flowchart TD
  A[Authenticated owner turn] --> B[Automations tool]
  B --> C[Gateway caller scope]
  C --> D[Locked update validation]
  D --> E[CronService authority storage]
  E --> F[Scheduled Codex runtime]
  F --> G[App policy and execution]
Loading

Technical review

Best possible solution:

Keep the focused same-owner capture repair and validate the combined authority path through persistence and scheduled app execution.

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

Current main suppresses creator capture in both the tool adapter and Gateway management scope, establishing the reported missing-authority path; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch repairs both suppression points, reuses existing grant and persistence owners, and repeats owner-scope validation under the update lock.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against bd9ba9105b4a.

Provenance checked

  • Management updates excluding creator capture changes intended behavior with a stated reason (499ee4b: Gateway-wide management deliberately preserved creator execution ceilings without recapture.)
  • Fresh scheduled app authority keeps the original intent (acb61d3: Capture exact creator-thread app authority and retain its profile/account binding and current-policy ceiling during scheduled execution.)
  • Requester provenance and scheduled policy keeps the original intent (9ee5c26: Management authority cannot substitute for the owning account’s native requester authorization.)

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete bypass was found; clearance depends on the authority-chain evidence specified below.

Evidence

What I checked:

PR surface

Source +22, Tests +169, Docs +5. Total +196 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 60 38 +22
Tests 1 183 14 +169
Docs 1 9 4 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 252 56 +196

Review metrics

Metric Value Why it matters
Production versus regression growth Production net +22 lines; tests net +169 lines The regression growth exercises distinct owner/account outcomes through actual Gateway and persistence owners.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Existing scheduled app access can remain unavailable after successful updates, with replacement creation providing a reported workaround.
  • merge-risk: 🚨 security-boundary: The change enables management-entitled turns to persist creator app authority, making final-effect rejection of revoked or foreign authority material.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof for a revoked combined management-and-creator update and a forbidden scheduled app account, showing rejection before persistence or app I/O.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-13T01:50:58.793Z sha 0644941 :: needs real behavior proof before merge. :: none

Reviewed October 12, 2026, 10:02 PM ET / October 13, 2026, 02:02 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor Author

Landing with a pinned admin merge on head 7a01f5a2fb28. The only red, checks-node-changed-compact-small-7, is src/cron/isolated-agent/run.manual-tool-authority.test.ts. It fails the same way on current origin/main without this PR: 4/4 fail with "operator source identity changed … Profile authority store changed". On the PR head alone it passes 4/4 locally. The red is inherited from main's recent profile-authority changes (suspect #170470), not from this change.

@steipete
steipete merged commit 4513fcb into main Oct 13, 2026
129 of 134 checks passed
@steipete
steipete deleted the upd/upd-l1584 branch October 13, 2026 02:10
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…llow (openclaw#170498)

An owner cron.update that replaced toolsAllow went through the management grant, which dropped creator-authority capture: the update reported success but the tool never appeared at run time. Exact-owner (session + account) updates now capture fresh authority like cron.add; if capture is unavailable for the owner the update refuses with a recreate hint. Non-owner manager edits keep the documented behavior (authority cleared, next run reports reauthorization). Fixes openclaw#170298.
Kimiyu-186 added a commit that referenced this pull request Oct 15, 2026
Backport #170498 to the October branch. Explicit toolsAllow updates by the original session/account recapture scheduled Codex app authority while preserving separate management and creator grants and locked validation.

Add owner, revocation, legacy persistence, and scheduled runtime coverage, including opt-in real native app-read proof from the persisted envelope with foreign-connection and revoked-policy rejection.

Focused production regressions: 322 passed; follow-up Gateway 14 and runtime 6 passed; native capture, SQLite reopen, and scheduled GitHub read passed. Current hosted dependency audit remains red for unchanged baseline advisories, tracked separately in #172664; fail-fast cancellations are not passing coverage. No deployment or tenant activation.

Upstream repair: 4513fcb.
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 gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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.

[Bug]: Native app access remains unavailable after successful automation updates

1 participant