Repository navigation
fix(memory): prevent session indexing starvation and retry stalled passes - #170719
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9e31f28cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25f6247442
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
The deferred-pass issue is fixed in 25f6247: the full-rebuild cooldown now explicitly requests a session queue retry, and the fake-clock regression exercises that path. Follow-up for the remaining P2: the existing full-rebuild cooldown can reach 30 minutes and outlast the bounded 1/5/15-minute retry budget. Pending transcripts remain queued, and fresh activity restarts retries, as documented. Keep the requested retry series bounded; coordinating its deadline with the longer rebuild cooldown can be handled separately. |
…sses (openclaw#170719) Preserve the oldest pending session change across turn boundaries so overdue indexing can start in the next idle gap. Retain failed work and retry after 1, 5, and 15 minutes, while preserving foreground priority and existing bounded indexing groups. Keep full-rebuild cooldown deferrals queued and request a full rebuild after an embedding-provider switch. Add fake-clock coverage and document freshness and retry limits.
What Problem This Solves
Memory indexing can remain stale indefinitely during back-to-back turns because each idle transition resets the age of pending work. A handled embedding-provider fallback failure can also leave dirty sessions without a scheduled retry.
Related: #170404.
User Impact
Pending sessions become eligible in the next idle gap once their oldest change reaches five minutes. Failed passes retry after 1, 5, and 15 minutes; after that, fresh transcript or turn activity resumes retries. Running turns keep priority, and search/shutdown still do not force a flush.
Why This Change Was Made
The existing session queue remains the single owner. Preserve its oldest-pending timestamp across turns, keep its bounded eight-session groups and foreground yielding, and retain failed targets alongside updates arriving during a pass. Handled fallback failures and full-rebuild cooldown deferrals now notify the queue explicitly instead of looking like completed work. A provider switch requests the existing full-rebuild path so retries can replace the old embedding identity before targeted writes resume.
Accepted edge cases: a turn already running at the five-minute deadline delays indexing until an idle gap; a turn starting during indexing may overlap the current bounded group. Provider failures can extend freshness beyond five minutes. The existing full-rebuild cooldown can reach 30 minutes and outlast the bounded automatic retry series; pending work remains queued and fresh activity restarts retries. Coordinating those two cooldown deadlines is a P2 follow-up. No new fencing, admission checks, SQL, schema, or SDK surface.
Evidence
Fake-clock regressions cover back-to-back turns, overdue long-running turns, thrown-failure target retention, and handled-fallback backoff/exhaustion/activity recovery. The latter drives the existing targeted-sync failure handler and the real full-rebuild cooldown path. The old long-turn test now asserts the five-minute contract instead of restarting a quiet period.
Retries intentionally schedule previously stranded background work; there is no claimed whole-workload reduction. No SQL harness, local suites, or remote lease: this is a scheduling-only follow-up. Basic changed-file formatting/lint and diff checks run locally; PR CI owns fake-clock tests, types, lint, Knip, Madge, and database ratchets. No update cell applies: no update, Doctor, migration/schema, plugin-loading, or service-lifecycle change.
Direct changed-file oxlint, oxfmt, and
git diff --checkpassed. The type-aware lint wrapper timed out preparing SDK declarations on the loaded host; CI owns type-aware validation. Two Codex autoreview rounds: scoped clean through P2. Initial CI caught a one-millisecond drift in the new retry test after the simulated busy turn; the test now measures each expected delay from the observed attempt timestamp. Final-head changed-extension tests passed in CI run 38357588765: 76 seconds for the test step, 137 seconds for its job. The final-head CI run passed completely, including production/test types, type-aware lint, source contracts, additional boundaries, and database worker/dialect ratchets. No inherited-failure exception was needed. The local single-case replay was stopped after CI passed because worker preparation/imports consumed about 15 minutes on the loaded host; no local test pass is claimed. Diff: 5 files, production +58/-19 lines; tests +89/-4; docs +8/-3.