Repository navigation
fix(claimant): shape-guard session time fields in poll.py (#6868) - #8692
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis 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: 5eaf16662f
ℹ️ 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".
| timing = _session_timing(s) | ||
| if timing is None: | ||
| return None |
There was a problem hiding this comment.
Check terminal markers before requiring readable timestamps
When a root outside active_ids has a terminal marker but a malformed timestamp—for example, time={"idle": 123, "updated": "bad"}—this now returns unknown before checking the marker. Previously, that root was correctly excluded without inspecting its timestamp. summarize_cap() consequently reports cap_room=None, preventing all claimant launches; because finished roots remain in the session list indefinitely, one such record can persistently block the fleet. Keep active-set membership authoritative, but check available terminal markers before requiring readable activity timestamps.
Useful? React with 👍 / 👎.
Closes #6868.
What
poll.pytrusted the shape of each session'stimeobject and itsupdated/createdstamps: a non-objecttimeraised AttributeError and a non-numeric stamp raised TypeError out ofis_active_root,is_stuck_bound,_stuck_entry, andsummarize_cap— one malformed session entry crashed the whole poll, somain()printed no JSON and the claimant discovered no candidates for any queue.Fix
_session_timing()helper inpm-stack/opencode-claimant/poll.py: returns(idle, updated_ms), orNonewhen timing is unreadable (time present but not an object, or a present updated/created value that is not a number — bool included). Absent time/stamps keep the pinned timeless behaviour (updated 0)._active_root_state()is tri-state;count_active_roots()returnsNonewhen any root's activity is unknown instead of silently counting it inactive and manufacturing cap room;summarize_cap()propagates(live, None, None); bothget_active_root_session_count()wrappers (poll.py and claimant.py) map None to the existing -1 unknown sentinel.is_stuck_bound()never classifies on unreadable timing;_stuck_entry()reportssession_updated: Nonefor malformed timing instead of raising or echoing a wrong-shaped value.active_idscounts active regardless of stored markers, malformed time included.Tests (oracle: the module's documented unknown-propagation contract + the pinned timeless-entry case)
TestWrongShapeTimein test_poll.py (8 tests): time as string/int/bool/list and updated/created as string/list/object/bool across the active-root, cap-count, stuck-bound, and stuck-entry paths; mixed good+bad lists.python3 -m unittest test_poll— 65 tests OK (existing suite included).python3 -m unittest test_claimant— 23 tests OK.git diff --check— clean.Queue: task 11105 (repo-health-code-pilot), lane any-a.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.