Skip to content

fix(templates): capture cron inference authority during Add - #196383

Merged
Patrick-Erichsen merged 3 commits into
bundle-template-pluginsfrom
fix-template-cron-inference-binding
Nov 11, 2026
Merged

Patrick-Erichsen merged 3 commits into
bundle-template-pluginsfrom
fix-template-cron-inference-binding

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Create Template schedules through the shared cron adapter with native creator authority and live commit guards. Capture expected ownership before creation, retain paired-source revocation, and dispose captured authority on every outcome.

Evidence

Current layer: 4bc02b2b6cda4502756a3e4c46d42f0e42bbd75d. Full atomic candidate: db3969bece945c1bd54489c8c142071b6046d8f8. One fixture-only stability repair is carried at bottom; all seven upper patches and41commit subjects/order are unchanged. No full-main refresh.

  • Model-picker CI diagnosis and paired geometry proof: the test compared edges from different frames during the existing scale0.9→1 animation. Controlled actual-menu geometry reproduces exactCIright707.90625 while simultaneous gaps remain7.2px and8px. The ordinary local baseline passed and is not causal clearance. Move the existing trial-click stability check before both reads; preserve exact<=, long-email, both viewports, target height, keyboard/search/composition and sessions.patch assertions. All3cases pass19.50s; scoped lint/types/format/ratchets and fresh independent actual-diff review pass. Net1insertion/1deletion; no production change, new waits, timeout/tolerance changes, diagnostics or test-line growth.
  • Settings repair #197156 is merged as147d0414a3aacb4b17e38cb3e8dfde7b095493e9 with review, CI, postmerge CI/Workflow Sanity and native closeout complete. Its six stale assertions reproduce on main; corrected three-file suite passes29/29(45.92s), preserving pending admin request/recurrence/approval/navigation checks. It is already retained in this stack.
  • Actual stable11.3 existing-Claw upgrade proof preserves target agent configuration, four workspace files, consent digests and native cold-Gateway effective inventory agents_list only. Canonical schema22→39/row renames and old-authoring guidance are verified. Executed package4deeed is qualified for this tip: only four E2E files and one production comment differ, so Template/runtime behavior inputs are unchanged. Empty package/MCP/cron-reference tables and unrelated default heartbeat cleanup are explicitly qualified. The completed249b723 hosted review accepted this proof with Findings NONE/Before merge NONE.
  • Retained unchanged-input proof: real-Gateway lifecycle/channel7/7, Home route/dock26/26, guest onboarding plus real-Gateway Home7/7, Template schema/planning18/18, sidebar grouping21/21. Inspected guest setup before/after. These are contract-input qualifications, not whole-current-head CI.
  • Previous actual ready CI: all seven upper suites succeeded; bottom failed only the model-picker timing assertion above. All attempts finish before head replacement. Draft/passive SKIPPED suites remain excluded from product proof. Fresh exact-head CI/security and native admission must qualify this candidate. Root owns repairs; autofix is retired.

Landing and rollout

Land all eight layers atomically through the tip after exact-head gates permit. Preserve historical template-contract-194b7bea exactly. Seven unchanged upper patches retain their qualified reviews; bottom receives fresh review after final publication.

ClawHub #4502, Competitor Watch #22 and Activity #197058 are merged. Consumer release, manual backend cutover, new registry publication and live Gateway changes remain separate.

@clawsweeper

clawsweeper Bot commented Nov 10, 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 gateway Gateway runtime size: M labels Nov 10, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Template Add captures the scheduler’s existing inference and creator authority before creating jobs and preserves expected ownership during reconciliation.

Example: Paired operator A adds a Template containing a disabled daily automation, and operator B later runs it.

  • Before: Template Add omits the native inference binding and paired creator source.
  • After: The job retains A’s captured authority; supplied Gateway proof records two provider requests and one tool write before revocation, then rejects another run without additional effects.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused shared-owner repair with applicable packaged-entry-point, persistence and final-effect revocation evidence; current-head stack qualification remains separate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Supplied packaged CLI/Gateway results exercise owner-bound Template scheduling and cold readback; the companion real-Gateway scenario exercises creator A through controller B, records two provider requests and one plugin write, then proves native revocation prevents additional effects. Relevant production and companion proof blobs match the accessible historical proof revision. Adjacent UI screenshots were not counted as authority proof.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Template-created automations omit the account and creator authority already required by ordinary scheduled execution.
Reason: The change restores an existing scheduler contract through shared owners, with maintainer direction supplied by the host facts and no new public configuration or API.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs a current Template scheduling gap, and review found no actionable introduced defect.

Priority: P2
Reviewed head: af31422c99c55cfec51ff983ebb6ed03917cff81

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway Template Add converts reviewed Template declarations into ordinary scheduler jobs; existing account and operator authority owners supply private metadata that the scheduler persists and restores before execution.

flowchart TD
  A[Authenticated Template Add] --> B[Template cron adapter]
  B --> C[Native creator and inference capture]
  C --> D[Guarded scheduler commit]
  D --> E[Existing SQLite job store]
  E --> F[Creator authority restoration]
  F --> G[Provider and tool execution]
Loading

Technical review

Best possible solution:

Use the native scheduler’s existing capture, persistence and revocation owners, retaining operation-local expected ownership for safe reconciliation.

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

Current-main source exposes the missing capture path, and supplied before/after Gateway evidence identifies absent paired-source persistence; no target code was executed during this review.

Is this the best way to solve the issue?

The patch is a focused repair: it connects Template Add to existing authority owners, preserves authored job inputs, and handles captured ownership without introducing a competing scheduler or persistent store.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main still lacks capture: At fetched main, createTemplateCronGateway forwards normalized declarations directly to cron.add without capturing inference or creator authority; this PR supplies the existing captureCronCreatorSession owner. (src/templates/cron-gateway.ts:38, 869bbccf8fb8)
  • Capture lifetime and commit checks: The adapter composes requester, inference-selection and operator-source checks into the scheduler commit guard, records expected profile ownership before creation, and disposes captured resources in finally. (src/templates/cron-gateway.ts:43, af31422c99c5)
  • Ownership-aware recovery: Lost-reply reconciliation requires ownership captured before creation; subsequent matching includes that ownership rather than adopting it from a mutable job read. (src/templates/cron.ts:335, af31422c99c5)
  • Final-effect authority proof: The supplied proof in fix(templates): resolve bundled plugin runtime owners #196389 exercises authenticated Gateway Add and forced execution: two real loopback provider requests and one plugin write while authorized, followed by native device revocation and refusal with unchanged effect counts. The inspected test restores creator A while controller B requests execution. (src/gateway/server-templates-add-authority.e2e.test.ts:611, f946e7780061)
  • Historical proof remains applicable: GitHub blob identities match between the documented cd346bcb164ab69c6eca9639aedf0c0528334cb2 proof revision and the reviewed stack for cron-gateway.ts, cron-input-validation.ts, templates-add.ts, and the companion authority E2E file. (src/templates/cron-gateway.ts, cd346bcb164a)
  • Packaged entry point and existing-state preservation: fix(templates): use Gateway-owned Add from the CLI #196431 (comment) records actual packaged CLI-to-Gateway installation and cold readback of a disabled owner-bound job; this PR also records snapshot-backed update preservation of configuration, workspace files and an existing paused job.

Likely related people:

  • Patrick Erichsen: Raw commit caa978c adds src/templates/cron-gateway.ts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: caa978caae7a; files: src/templates/cron-gateway.ts)

PR surface

Source +64, Tests +540, Other +5. Total +609 across 11 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 5 79 15 +64
Tests 3 541 1 +540
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 5 0 +5
Total 11 625 16 +609

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a focused repair to experimental Template automation creation and retained creator authority.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 (6 earlier review cycles)
  • reviewed 2026-11-10T02:22:18.455Z sha f70d8c2 :: needs real behavior proof before merge. :: [P2] Account for captured human ownership in Template job matching
  • reviewed 2026-11-10T03:21:57.127Z sha 579a90d132b9fb4b86bdd1d07ee643372b9226cc :: needs real behavior proof before merge. :: [P2] Preserve lost-reply reconciliation for the CLI adapter
  • reviewed 2026-11-10T04:24:37.463Z sha f04dfe739c3681b6ebb829ccae21268ebf8765e1 :: needs real behavior proof before merge. :: [P2] Preserve lost-reply reconciliation for the CLI adapter
  • reviewed 2026-11-10T06:21:37.369Z sha cce9bc2 :: needs changes before merge. :: [P2] Preserve lost-reply reconciliation for the CLI adapter
  • reviewed 2026-11-10T06:27:20.225Z sha cce9bc2 :: needs changes before merge. :: [P2] Preserve lost-reply reconciliation for the CLI adapter
  • reviewed 2026-11-11T02:50:05.531Z sha 87e975b :: needs maintainer review before merge. :: none

Reviewed November 10, 2026, 11:00 PM ET / November 11, 2026, 04:00 UTC (Revision 7).

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 10, 2026
@Patrick-Erichsen
Patrick-Erichsen force-pushed the fix-template-cron-inference-binding branch from 579a90d to f04dfe7 Compare November 10, 2026 04:14
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 10, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Nov 10, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Nov 10, 2026
@Patrick-Erichsen
Patrick-Erichsen force-pushed the fix-template-cron-inference-binding branch from cce9bc2 to 165d101 Compare November 10, 2026 18:44
@Patrick-Erichsen
Patrick-Erichsen force-pushed the fix-template-cron-inference-binding branch from 165d101 to beea32d Compare November 10, 2026 19:17
@Patrick-Erichsen
Patrick-Erichsen force-pushed the fix-template-cron-inference-binding branch from beea32d to 30ffd2b Compare November 10, 2026 19:47
@Patrick-Erichsen
Patrick-Erichsen marked this pull request as draft November 11, 2026 00:51
@Patrick-Erichsen
Patrick-Erichsen force-pushed the fix-template-cron-inference-binding branch 2 times, most recently from f2b93ba to 87e975b Compare November 11, 2026 02:14
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@Patrick-Erichsen

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Capture the native profile owner before scheduler creation in the internal Add receipt, compare that expected ownership during matching, and require captured evidence for lost-reply reconciliation. Keep authored automation inputs unchanged.

Cover authenticated enabled and paused heartbeat scratch, lost replies, owned and unowned transfers, unchanged and transferred rollback, foreign personal account denial, and retained source revocation.
Request independent source capture only from authenticated Gateway Template Add. Reuse native cron capture, currentness and disposal; keep ordinary cron and no-client embedded behavior unchanged.

Extend the existing native source regression to paired devices and supply real admitted-client facts in direct fixtures. Allocate exactly 63 net test lines without changing the shared ceiling scalar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant