Skip to content

fix(tasks): retain live blocked task flows during maintenance - #117606

Merged
steipete merged 1 commit into
mainfrom
codex/qa410-taskflow-live-blocked-retention
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa410-taskflow-live-blocked-retention

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The shipped v2026.7.2-beta.6 TaskFlow maintenance owner classifies every blocked flow as terminal, even when a managed controller intentionally persists endedAt: null while waiting for approval or another external event. After seven days, preview reports that live flow as prunable and applying maintenance permanently deletes its durable row from the shared SQLite database; cancel-requested blocked flows also fail to reconcile.

Why This Change Was Made

Fix the classification at its existing maintenance owner: blocked is terminal only when the flow actually has an end timestamp. The single production-line replacement preserves the existing seven-day retention behavior for genuinely ended managed and mirrored blocked flows, while keeping waiting/approval state, audit visibility, and cancellation reconciliation coherent. Production LOC delta: zero.

User Impact

Long-lived approval gates and resumable external workflows survive task maintenance and Gateway restarts instead of silently disappearing. Operators can still prune completed blocked flows, observe stale live blocks, and cancel blocked managed work once its child tasks have settled. No configuration, schema, migration, plugin API, or cron behavior changes.

Evidence

  • Immutable head: 4584e47e3960418b1d254b628afb36a2c64c074c; tree: 26ed08571444268c0cced3600b203e867f26c1e9; direct parent: c263c273c75008ed3d3e0788ffc8373726802ce4.
  • Exact changed files: src/tasks/task-flow-registry.maintenance.ts and src/tasks/task-flow-registry.maintenance.test.ts.
  • Shipped provenance: the identical producer, maintenance predicate, and audit behavior are present in release tag v2026.7.2-beta.6.
  • Regression-first real SQLite proof: 4 failed / 6 passed before the fix, including physical deletion of the persisted live blocked flow.
  • Fixed owner suite: 10 passed, covering maintenance preview and apply, resumable blocked-flow retention, ended managed/mirrored blocked-flow pruning, stale audit visibility, and blocked cancellation.
  • Maintenance, audit, and registry sibling suites: 28 passed across three files.
  • Configured type-aware oxlint and targeted oxfmt --check: clean.
  • Five fresh independent hostile source reviews: clean.
  • Genuine native formal autoreview: codex, model gpt-5.6-sol, reasoning high, --max-priority P3; TruffleHog clean; exit 0; no accepted or actionable findings.

@steipete
steipete marked this pull request as ready for review August 1, 2026 19:53
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 3:58 PM ET / 19:58 UTC.

ClawSweeper review

What this changes

This PR prevents TaskFlow maintenance from pruning blocked flows that are still live because they have no endedAt timestamp.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for normal owner review and landing: current main still has the faulty predicate, while the branch changes the maintenance owner consistently with the live-flow producer and cancellation path. The protected maintainer label means this review should not auto-close or auto-dispatch it.

Priority: P1
Reviewed head: 4584e47e3960418b1d254b628afb36a2c64c074c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with strong regression coverage and credible SQLite proof; only normal protected-label review and pending checks remain.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body documents regression-first before/after isolated SQLite behavior, including physical deletion before the fix and retention afterward, and the GitHub real-behavior-proof check succeeded.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body documents regression-first before/after isolated SQLite behavior, including physical deletion before the fix and retention afterward, and the GitHub real-behavior-proof check succeeded.
Evidence reviewed 7 items Live-state producer: setFlowWaiting deliberately writes status: "blocked" and clears endedAt, establishing that blocked flows with no end timestamp are resumable live state rather than terminal records.
Maintenance-owner repair: The branch changes the sole terminal predicate used by both pruning and cancel-request reconciliation so blocked records are terminal only when endedAt is present.
Sibling lifecycle contract: The shared task lifecycle status helper already treats only succeeded, failed, cancelled, and lost as terminal; it excludes blocked, matching the proposed maintenance behavior.
Findings None None.
Security None None.

How this fits together

TaskFlow records are durable shared-SQLite state for managed and task-mirrored work. Registry maintenance reconciles cancellation state and removes old terminal records, while the audit surface reports stale live flows for operators to inspect.

flowchart TD
  A[Managed controller] --> B[Durable TaskFlow record]
  B --> C[Blocked flow state]
  C --> D{Has end timestamp?}
  D -->|No: still live| E[Retain record and show stale audit]
  D -->|Yes: terminal| F[Seven-day maintenance retention]
  F --> G[Prune completed record]
  E --> H[Resume or cancel reconciliation]
Loading

Decision needed

Question Recommendation
Should the TaskFlow owner land this focused durable-state retention fix after the remaining required checks complete? Land after checks: Merge the existing owner-boundary fix once the in-progress required checks are green.

Why: The patch is source-consistent and has concrete before/after SQLite evidence, but the protected maintainer label requires an explicit human landing decision.

Before merge

  • Resolve merge risk (P1) - Required GitHub checks are still running on the reviewed head; land only after the required checks complete successfully.
  • Complete next step (P2) - This protected maintainer-labeled PR has a coherent repair and real-behavior evidence; it needs normal owner review and completion of the current check set rather than an automated replacement or repair lane.
Agent review details

Security

None.

PR surface

Source 0, Tests +110. Total +110 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 110 0 +110
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 111 1 +110

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Merge the narrowly scoped maintenance-owner correction once normal maintainer review and the remaining required checks confirm the current head.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Merge the narrowly scoped maintenance-owner correction once normal maintainer review and the remaining required checks confirm the current head.

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

Yes, source-reproducible with high confidence: setFlowWaiting creates blocked records with no end timestamp, and current maintenance treats every blocked record as terminal after seven days. The PR supplies focused before/after SQLite coverage, though this read-only review did not run the suite locally.

Is this the best way to solve the issue?

Yes. Changing the terminal classification at the maintenance owner is the narrowest coherent fix because both pruning and cancellation reconciliation already flow through that predicate, while ended blocked records keep their existing retention behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 182be0f7c176.

Labels

Label changes:

  • add P1: Current maintenance can silently delete live durable TaskFlow state after the retention window, affecting approval-gated and resumable workflows.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body documents regression-first before/after isolated SQLite behavior, including physical deletion before the fix and retention afterward, and the GitHub real-behavior-proof check succeeded.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body documents regression-first before/after isolated SQLite behavior, including physical deletion before the fix and retention afterward, and the GitHub real-behavior-proof check succeeded.

Label justifications:

  • P1: Current maintenance can silently delete live durable TaskFlow state after the retention window, affecting approval-gated and resumable workflows.
  • 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. Sufficient (terminal): The PR body documents regression-first before/after isolated SQLite behavior, including physical deletion before the fix and retention afterward, and the GitHub real-behavior-proof check succeeded.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body documents regression-first before/after isolated SQLite behavior, including physical deletion before the fix and retention afterward, and the GitHub real-behavior-proof check succeeded.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: The feature-history commit added the registry, audit, maintenance, and maintenance tests together; the same person authored this repair after the lifecycle inconsistency was identified. (role: introduced the TaskFlow maintenance surface and authored the focused repair; confidence: high; commits: 7ab05df415a4, 4584e47e3960; files: src/tasks/task-flow-registry.ts, src/tasks/task-flow-registry.maintenance.ts, src/tasks/task-flow-registry.audit.ts)

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.

@steipete
steipete merged commit 17eafa7 into main Aug 1, 2026
177 of 194 checks passed
@steipete
steipete deleted the codex/qa410-taskflow-live-blocked-retention branch August 1, 2026 20:10
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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