Conversation
Contributor
Collaborator
|
Shipped in v0.51.680 (Release YJ, just deployed) — thanks @rodboev! Addresses #3894. The session-index rebuild finally-block now requires the finishing worker to still be the registered owner thread before clearing the bookkeeping globals, so a late older worker can't clobber a newer rebuild's state. Gate: Codex SAFE (under-lock, no TOCTOU, no stuck-owner leak), full suite 10693. Verified on prod. |
franksong2702
pushed a commit
to franksong2702/hermes-webui-fork
that referenced
this pull request
Jun 26, 2026
This was referenced Jun 26, 2026
Collaborator
|
Shipped in v0.51.680 (explicit session-index rebuild thread ownership) — the fix is live on master and deployed to prod. Thanks @rodboev for the contribution. Closing as shipped (the release landed via a stage/release branch so this PR object didn't auto-close). Please reopen if you still see the issue after upgrading + a hard refresh. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
#3894is a bookkeeping hardening follow-up, not a user-visible bug report. The safest change is the one the issue already points at: make cleanup depend on explicit ownership, not just a matching target tuple.api/models.pyalready records both the current owner thread and the current target. The missing guard is simply that the worker finishing never checks whether it is still the registered owner before clearing those globals.What Changed
api/models.py: captures the current worker thread in_rebuild_session_index_background(...)and clears the rebuild globals only when the finishing worker is still the registered owner for the matching target tuple.tests/test_session_index.py: adds a deterministic same-target handoff regression that proves an older worker no longer clears a newer owner's globals.Why It Matters
This closes a subtle ownership window in the background rebuild bookkeeping without changing scheduling or user-visible behavior. The code becomes explicit about who is allowed to clear the shared globals, which makes future thread-hand-off work safer.
Verification
Full-suite CI context, not a required local check unless requested:
pytest tests/ -v --timeout=60.Upstream
Closes #3894.
Follow-up to #3884, which introduced the target-pinned rebuild ownership this PR hardens.
Model Used
GPT 5.5 via Codex CLI