Skip to content

fix(sensor): do not report deleted Codex rollouts as stat failures - #212

Open
rudycelekli wants to merge 1 commit into
uber:mainfrom
rudycelekli:fix/sensor-codex-missing-catalog-rollout
Open

rudycelekli wants to merge 1 commit into
uber:mainfrom
rudycelekli:fix/sensor-codex-missing-catalog-rollout

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 19, 2026 •

Copy link
Copy Markdown

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Related issue: N/A (found by reading the code; reproduced on main at 6b33dff)

What changed?
Catch FileNotFoundError first and skip the candidate silently (same treatment the parser already gives a missing optional catalog, and Cline/Gemini give missing optional files). PermissionError and other stat failures still count.

Why?
Codex's state catalog (~/.codex/state_5.sqlite, threads.rollout_path) keeps rows after the rollout file is deleted. CodexParser._add_rollout_candidate (Sensor/adr_sensor/parsers/codex_parser.py:149) stats each catalog path and counts FileNotFoundError as file_stat_error, a non-expected diagnostic code, so diagnostics.health_record marks the codex parse stage "partial" (and writes it to error.log) on every run. On this machine 432 of 1721 catalog rows point at deleted files: a real run printed {'file_stat_error': 432, 'file_age_skipped': 694}.

How did you test it?

  • Reproduction: new test tests/test_parser_diagnostics.py::test_codex_catalog_row_for_deleted_rollout_is_not_a_stat_failure (catalog row -> nonexistent .jsonl; expects no candidates and no diagnostics). main: FAILED ({'file_stat_error': 1}); branch: passed. Existing test_stat_failure_is_not_reported_as_age_filtering (PermissionError -> file_stat_error) still passes. Real data: CodexParser(max_age_days=7).parse_all() diagnostics main {'file_stat_error': 432, 'file_age_skipped': 694} -> branch {'file_age_skipped': 694}, same 546 sessions.
  • Test suite: Sensor .venv/bin/python -m pytest tests/ -q (py3.14) 609 passed.
  • Not tested: nothing further. Python 3.9.6 (system python, temp venv): test_parsers/test_parser_diagnostics/test_dsh_parser/test_gemini_parser 245 passed.

Potential risks
The change only affects the input described above; other paths go through the same code as before, and the component's existing tests pass.

Codex state catalogs (state_*.sqlite) keep thread rows after their rollout
file is deleted. Each such row was counted as file_stat_error, so a normal
Codex install reported its parse health as "partial" on every run. A
missing catalog target is now skipped like other missing optional inputs;
permission and other stat failures are still reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants