Skip to content

fix(cron): wait for busy conversations before scheduled checks - #197774

Merged
vincentkoc merged 1 commit into
mainfrom
fix/system-event-backfill-followup-20261112
Nov 12, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/system-event-backfill-followup-20261112

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes: a scheduled check targeting a busy conversation can start before that conversation finishes when the job has no captured operator source.

User Impact

User impact: session:<key> jobs wait for the target conversation before starting, regardless of how they were created. This changes queue ordering; it does not grant system-started turns automation management authority.

Why This Change Was Made

The scheduler used the presence of an operator source to decide whether a session: job waits. The target session itself owns that ordering decision. The same queue path now handles jobs with and without captured operator sources.

Evidence

  • Added regression coverage for a source-less one-shot targeting a busy conversation, plus the existing condition-watcher case with and without captured operator source.
  • git diff --check passed; formatting passed with the pinned oxfmt 0.74.0.
  • Independent local review found no actionable P0–P2 finding.
  • Focused Testbox execution was refused before command start because the managed sparse checkout omits tracked paths. Full-tree exact-head CI passed, including the changed-node regression and cron test typecheck shard.
  • A live backfill one-shot on a personal Gateway failed with a generic session-event error. Its exact cause is not retained in the available run history, so this PR does not claim to explain that incident.

Production delta: 2 added, 3 removed lines. Test delta: 75 added, 25 removed lines. No config, schema, protocol, or permission change.

Review follow-up

ClawSweeper reviewed baa105a00fe6 with no findings or required pre-merge work. Its optional rank-up move asks for a real Gateway demonstration. I am leaving that as follow-up: Testbox refused this sparse checkout before execution, and the retained live incident record has only a generic error. The in-process regression and exact-head CI cover the queue ordering change without claiming the old incident is explained.

@clawsweeper

clawsweeper Bot commented Nov 12, 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.

@vincentkoc vincentkoc self-assigned this Nov 12, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Nov 12, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 12, 2026 14:30
@vincentkoc
vincentkoc force-pushed the fix/system-event-backfill-followup-20261112 branch from 1605ce2 to 23f1adf Compare November 12, 2026 14:38
@vincentkoc
vincentkoc force-pushed the fix/system-event-backfill-followup-20261112 branch from 23f1adf to baa105a Compare November 12, 2026 14:45
@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 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Makes scheduled jobs targeting an existing conversation wait until it is idle even without a captured operator source.

Example: A source-less one-shot targets session:agent:main:busy-conversation while that conversation has an active turn.

  • Before: The scheduler can evaluate or launch the job before the active turn finishes.
  • After: The job stays queued until the conversation becomes idle.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and has green exact-head CI, but required real behavior proof is absent.
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: A scheduled check can run against a conversation before its active turn finishes when the job lacks an operator source.
Reason: The maintainer-authored direction consistently applies the existing conversation-ordering contract without adding configuration, storage, or another scheduler.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a source-confirmed scheduling gap with a focused change, and no introduced correctness defect was found.

Priority: P2
Reviewed head: baa105a00fe636ea80769272beaebb24ffb0d689

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Show a source-less scheduled job waiting behind a real Gateway conversation and completing afterward while an unrelated check proceeds; red-on-base regression execution is also not supplied.
Agent review details

How this fits together

The Gateway scheduler submits due jobs to the existing durable cron queue; session readiness controls admission before condition evaluation and session-event execution.

flowchart TD
  A[Due cron job] --> B[Session target resolver]
  B --> C[Conversation readiness]
  C --> D[Durable cron queue]
  D --> E[Condition evaluation]
  D --> F[Session event execution]
  E --> F
Loading

Technical review

Best possible solution:

Keep the shared target-based ordering change within the existing queue and launch owners.

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

Current-main source directly shows source-less jobs bypassing both conversation-aware queue admission and launch waiting; this read-only review ran no target code.

Is this the best way to solve the issue?

Removing the operator-source prerequisite is the smallest complete repair: session targeting determines ordering, while existing execution owners retain authority checks.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Operator-source prerequisite for continuation waiting changes intended behavior with a stated reason (718bd3d: Waiting and reading the current stored job supported authenticated operator continuations across edits and restarts.)
  • Shared conversation-aware queue admission changes intended behavior with a stated reason (db964b7: Park timed continuations without consuming run or condition-check capacity, sharing the existing launch-time continuation distinction.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Daniel: Raw commit db964b7 adds src/cron/session-target.ts:36 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: db964b78f69c; files: src/cron/session-target.ts)

PR surface

Source -1, Tests +50, Docs +1. Total +50 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 3 -1
Tests 1 75 25 +50
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 78 28 +50

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: The defect affects scheduling order for source-less jobs targeting an active conversation, with a limited and identifiable scope.
  • 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: The defect affects scheduling order for source-less jobs targeting an active conversation, with a limited and identifiable scope.
  • 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.

Rank-up moves

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

  • Supply the Gateway behavior evidence described in the proof assessment.

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 12, 2026, 10:00 AM ET / 15:00 UTC.

@vincentkoc
vincentkoc merged commit de6dc62 into main Nov 12, 2026
143 of 144 checks passed
@vincentkoc
vincentkoc deleted the fix/system-event-backfill-followup-20261112 branch November 12, 2026 15:03
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation 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