Skip to content

fix: keep automation reads working across detached gateway calls - #198742

Merged
RomneyDa merged 1 commit into
mainfrom
fix/cron-installation-context
Nov 14, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/cron-installation-context

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes cron reads failing after detached Gateway work loses the service installation context, including recovery in an open automation editor.

User Impact

Automation reads and scheduled work retain the Gateway installation they belong to. No configuration changes or migration are required.

Why This Change Was Made

Retain only service installation facts across lazy cron construction, cron operations and lifecycle calls, and detached scheduled work. Existing request-authority stripping and shared-state worker policy checks remain unchanged. The catalog recovery fixture now holds subsequent events in sequence instead of creating a protocol-gap reconnect.

Evidence

  • Both affected main-based Gateway suites pass: 18/18 tests.
  • Targeted type-aware lint and production plus affected-test TypeScript scopes pass.
  • The release-candidate reproduction passes through the real Gateway, including catalog retention and recovery; failing baselines are preserved.
  • Main-based clean build passes. The same real-Gateway catalog retention/recovery test passes (8.486 seconds; no unhandled errors).
  • The build reports nonfatal UI bundle-size warnings; raw output is retained. No bundle budgets were changed.

No visual design, release version, or performance-waiver change is included.

Preserve service installation facts across lazy cron construction, operations, lifecycle calls, and detached scheduled runs without retaining request authority. Keep catalog test notifications in sequence to avoid an artificial reconnect.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 14, 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 app: web-ui App: web-ui gateway Gateway runtime size: S labels Nov 14, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review November 14, 2026 07:55
@RomneyDa
RomneyDa enabled auto-merge (squash) November 14, 2026 08:01
@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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserve Gateway installation facts across lazy cron operations and detached scheduled work, and keep catalog-test events ordered.

Example: A Gateway initialized with installation root /fixture/service receives a detached cron.status request.

  • Before: The request loses installation facts and can encounter a shared-state worker policy mismatch.
  • After: The request uses its originating Gateway's installation facts.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and source-consistent; required real-behavior evidence remains uninspectable.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Automation reads and scheduled work can fail after detached Gateway calls lose installation facts.
Reason: This restores an existing automation contract using established owners, and the maintainer-authored PR supplies direction without adding options or changing persisted formats.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a context-loss bug still present on main; no introduced correctness defect was found.

Priority: P2
Reviewed head: 50a136d297300d379348908863448fe8a0e2d7fd

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply an inspectable trace of detached cron reads and automation-editor recovery with installation-aware worker policy active, including the claimed failing baseline and fixed result.
Agent review details

How this fits together

The Gateway's lazy cron facade and scheduled-run wrapper connect detached requests and timers to cron services and SQLite workers, which enforce database admission and schema policy.

flowchart TD
  A[Gateway startup] --> B[Installation facts]
  B --> C[Lazy cron facade]
  B --> D[Scheduled run wrapper]
  E[Detached requests and timers] --> C
  E --> D
  C --> F[Cron service]
  D --> F
  F --> G[SQLite worker owner]
Loading

Technical review

Best possible solution:

Keep installation-fact propagation in the existing cron and scheduled-run owners while preserving worker policy and request-authority checks.

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

Source establishes that detached work drops installation context, cron reads recapture that context, and active worker reuse rejects mismatched policy; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch fixes propagation at the existing ownership boundaries, reuses the installation context API, and preserves the worker's refusal policy rather than suppressing its error.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Selective scheduled-run context keeps the original intent (43d85e5: Carry reusable reader resources across detached callbacks without retaining request authority.)
  • Cron lifecycle ownership keeps the original intent (14c1305: Keep lifecycle and watcher settlement in the canonical cron owner rather than duplicating protocols in its lazy adapter.)
  • Scheduled plugin-registry resolution keeps the original intent (3e16525: Resolve the owning Gateway's live registry for detached scheduled preparation while preserving isolation and generation checks.)
  • Catalog notification fixture keeps the original intent (6e23cf0: Exercise post-publication recovery while accepting best-effort descriptive metadata during concurrent catalog churn.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 43d85e5 adds src/gateway/scheduled-run-gateway-context.ts:56 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 43d85e5f9ac3; files: src/gateway/scheduled-run-gateway-context.ts)
  • Dallin Romney: Raw commit b98c11a adds src/gateway/server-cron-lazy.ts:45 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: b98c11a46ee4; files: src/gateway/server-cron-lazy.ts)
  • Marvinthebored: Raw commit 9feb1db adds src/gateway/scheduled-run-gateway-context.ts:30 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 9feb1db00d62; files: src/gateway/scheduled-run-gateway-context.ts)

PR surface

Source +32, Tests +54. Total +86 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 59 27 +32
Tests 3 58 4 +54
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 117 31 +86

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:

  • add P2: Context loss can break automation reads and scheduled work when installation-aware worker policy is active, with no evidence establishing an urgent widespread outage.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Context loss can break automation reads and scheduled work when installation-aware worker policy is active, with no evidence establishing an urgent widespread outage.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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.

Reviewed November 14, 2026, 3:12 AM ET / 08:12 UTC.

@RomneyDa
RomneyDa merged commit 35ca716 into main Nov 14, 2026
217 checks passed
@RomneyDa
RomneyDa deleted the fix/cron-installation-context branch November 14, 2026 08:20
RomneyDa added a commit that referenced this pull request Nov 14, 2026
Backport 35ca716 (#198742). Preserve only service installation facts for lazy cron construction, operations, lifecycle and detached scheduling. Retain request-authority isolation and ordered catalog notifications.

Proof: original real-Gateway catalog recovery passes on candidate and main; 18 focused tests, seven lifecycle consumer tests, targeted lint/typechecks and clean builds pass. Upstream exact-head CI 43573353703 completed successfully. Other release qualification failures remain open.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
@RomneyDa

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
…nclaw#198742)

Preserve service installation facts across lazy cron construction, operations, lifecycle calls, and detached scheduled runs without retaining request authority. Keep catalog test notifications in sequence to avoid an artificial reconnect.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S 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