Repository navigation
fix(agents): retry ready context-engine turns behind old admissions - #190165
Conversation
Select ready session heads before applying the existing bounded retry limit. Preserve same-session FIFO and mirror selection in the memory actor. Co-authored-by: Leon-SK668 <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesSelect ready session heads before applying the context-engine retry limit, preserving FIFO ordering within each session. Example: Sixteen orphaned-admission sessions precede retry-ready when accepted-turn finishes.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a confirmed backlog-starvation bug still present on main, and the reviewed diff introduces no definite correctness or security defect. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherAccepted transcript turns enter the context-engine outbox; database workers or memory actors select eligible sessions, and the existing drainer invokes the engine's idempotent commit and acknowledges successful rows. flowchart TD
A[Accepted transcript turn] --> B[Outbox store]
B --> C[Database worker]
B --> D[Memory actor]
C --> E[Ready FIFO session heads]
D --> E
E --> F[Bounded retry drain]
F --> G[Engine commit and acknowledgment]
Technical reviewBest possible solution: Land the focused eligibility repair through the existing outbox owners while keeping historical admission retirement in the broader issue. Do we have a high-confidence way to reproduce the issue? Source establishes the 16-session starvation path, production reports corroborate it, and the PR reports a failing-base/passing-head finalizer regression; this read-only review executed no target code. Is this the best way to solve the issue? The smallest complete repair selects eligible FIFO heads at the existing database and memory owners, preserving retry accounting, acknowledgment, owner isolation, and historical rows without adding recovery machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3db01a06ea00. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -1, Tests +30, Other +2. Total +31 across 6 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 1, 2026, 3:17 AM ET / 08:17 UTC. |
|
Merged via squash.
|
…penclaw#190165) Select ready session heads before applying the existing bounded retry limit. Preserve same-session FIFO and mirror selection in the memory actor. Co-authored-by: Leon-SK668 <[email protected]>
Remove dead exports left by openclaw#190019, openclaw#189350, and openclaw#190165. Preserve existing auth and repository restoration coverage through the production entry points. Production LOC is unchanged; no runtime behavior or Knip exemptions change.
…190165) Select ready session heads before applying the existing bounded retry limit. Preserve same-session FIFO and mirror selection in the memory actor. Keep the now owner-local pending-turn type private. (cherry picked from commit b68d571) Owner-local type cleanup from 726a4da. Co-authored-by: Leon-SK668 <[email protected]> Co-authored-by: RomneyDa <[email protected]>
Supersedes #172102, thanks @Leon-SK668.
Related: #135628
What Problem This Solves
Fixes ready context-engine turns remaining queued when 16 older unresolved admissions from other sessions fill the bounded retry list.
User Impact
A successful independent turn can retry the ready backlog through the existing finalizer wake path. Same-session FIFO and engine/plugin isolation remain intact. Historical admissions are retained; retiring them remains separate work.
Why This Change Was Made
Select each session's oldest non-blocked row before filtering for readiness and applying the retry limit, in both the database worker and memory actor. No new timer, queue, configuration, schema, or dependency is needed. Work still relies on existing turn/recovery wake paths.
The two single-use worker selection helpers are folded into the existing command dispatcher, and the SQL-filtered, unreachable blocked-row branch is removed. Production delta: +38/-39, net -1. Regression tests add 30 lines; their dedicated test-line allocation covers starvation and non-ready FIFO heads.
Evidence
3e253689582b00fa7b2e7b0f7f11a3ffd3add1f5: the real finalizer commits only the current session, skipping the ready backlog behind 16 admissions. The worker negative control reads two non-ready heads; the memory selector also exposes non-ready work.pnpm test src/agents/harness/context-engine-turn-attempt.test.ts src/agents/harness/context-engine-turn-outbox.test.ts src/config/sessions/session-actor-memory-side-effects.test.ts --maxWorkers=1.openclaw/ci-gateis successful.scoped-clean, no actionable findings.