Repository navigation
fix(context-engine): ignore terminal blocked outbox rows - #126593
Patrick-Erichsen merged 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 7:15 AM ET / 11:15 UTC. ClawSweeper reviewWhat this changesThe PR excludes explicitly blocked context-engine outbox rows from pending-work selection while retaining them for diagnostics. Merge readinessKeep open: current main still counts terminal blocked outbox rows as pending, and this PR applies the narrow owner-boundary repair with strong regression and real-Gateway evidence. No correctness finding was identified; rebase onto current main and rerun exact-head validation before merge. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherThe context-engine outbox persists turn-advancement work for an agent session. Before a new turn runs, the harness recovers and drains pending rows; the result decides whether the session starts normally or degrades. flowchart LR
A[Agent turn admission] --> B[Context-engine outbox]
B --> C[Recovery and pending selection]
C --> D{Persisted row state}
D -->|blocked| E[Retained audit record]
D -->|ready or retryable| F[Commit advancement]
F --> G[Normal or degraded turn start]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +78. Total +87 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use the single state-based outbox selection rule, preserving blocked records as audit evidence while allowing ready work to progress and retryable failures to retain ordering. Do we have a high-confidence way to reproduce the issue? Yes—current main source shows blocked rows reach all pending selectors, and the focused branch regressions cover the resulting pre-turn degradation boundary. Is this the best way to solve the issue? Yes—the outbox owns row state and pending selection, so filtering only explicit terminal rows avoids a downstream workaround while preserving retryable ordering. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 755dad74d1fc. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Keep terminal blocked records available as audit evidence while excluding them from pending advancement selection.\n\nRefs openclaw#126591
483e556 to
235fa95
Compare
|
@clawsweeper re-review The draft is rebased onto current main and the PR body now includes redacted real-Gateway evidence from supported before/after SQLite snapshots plus the inspected Kysely 0.29.4 type/runtime contract. The head also uses null-safe |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Patrick-Erichsen
left a comment
There was a problem hiding this comment.
LGTM. The terminal-state predicate is at the correct outbox owner boundary and is applied consistently to all three pending selectors. Coverage preserves blocked audit rows, later ready progress, missing-state fail-closed behavior, and retryable same-session ordering.
|
Maintainer landing note: I reviewed the latest ClawSweeper rank-up move. I am not forcing a manual rebase solely for behind-main drift: the repo-native |
|
Merged via squash.
|
…6593) Keep terminal blocked records available as audit evidence while excluding them from pending advancement selection.\n\nRefs openclaw#126591 Co-authored-by: astra-openclaw <[email protected]>
Closes #126591
What Problem This Solves
Fixes an issue where users whose context engine records one unrecoverable turn advancement would have later turns repeatedly degraded because the terminal outbox row was still counted as pending work.
Why This Change Was Made
Blocked outbox payloads are terminal audit evidence, not retryable advancement work. This change excludes only rows whose persisted state is explicitly
blockedfrom all pending/drain selection points while leaving those records stored and inspectable. Retryable failed rows keep their existing ordering behavior, and missing/unknown states remain pending (fail closed).User Impact
One unrecoverable context-engine advancement no longer forces later turns to degrade or prevents later ready advancement from committing. Operators retain the terminal record for diagnostics.
Evidence
Real setup, after fix
Verified on a running OpenClaw 2026.8.1 main-based installation at
8e0d1bce85d3, withlossless-claw1.0.0-beta.4 loaded as the active context engine. The installed build contains the same three-selector blocked-row exclusion exercised by this PR. The proof turn used the real Gateway and provider, did not use tools, and was not delivered to a channel.Two supported
openclaw backup sqlite create --agent mainsnapshots bracketed a turn targeted at a session with a retained blocked row. Identifiers below are one-way SHA-3 prefixes; no transcript or credential content is included.The retained audit row is unchanged before/after. Lossless
commitTurnran, the proof turn ended normally, and no ready/failed row survived the commit. The bounded Gateway/Lossless trace contained no legacy selection ordegradeBeforeStartevent.Kysely/SQLite contract
The repository pins Kysely 0.29.4. In that exact version,
sql<T>returnsRawBuilder<T>,whereaccepts an expression ofSqlBool, andSqlBoolincludes boolean/SQLite 0/1.An isolated Node 24 +
node:sqliteexecution using OpenClaw's real synchronous Kysely adapter compiled and ran the exact predicate:{ "kyselyVersion": "0.29.4", "compiledSql": "select \"advancement_key\" from \"context_engine_turn_outbox\" where json_extract(context_engine_turn_outbox.payload_json, '$.state') IS NOT 'blocked' order by \"advancement_key\"", "parameters": [], "selectedAdvancementKeys": ["later-ready"] }The expression is static (no user-controlled interpolation), TypeScript accepted it under NodeNext, and
IS NOTis intentional: it excludes only an explicitblockedstate, while a missing state remains pending.Regression and repository checks
node scripts/check-changed.mjs -- <three changed paths>: passed, including formatting, type checks, lint, dead-code, dependency, plugin-boundary, import-cycle, and schema guards.git diff --check: passed.This PR is AI-assisted. The diagnosis, runtime proof, code, and tests were manually reviewed, and the contributor understands the change.