Skip to content

fix(sensor): bound CodexParser to a recent-session window - #51

Closed
lghupan wants to merge 1 commit into
mainfrom
fix/codex-max-age-days
Closed

fix(sensor): bound CodexParser to a recent-session window#51
lghupan wants to merge 1 commit into
mainfrom
fix/codex-max-age-days

Conversation

@lghupan

@lghupan lghupan commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

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

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

Related issue: N/A; follow-up to PR 34

What changed?

CodexParser now accepts max_age_days, defaults to a 14-day session window, and filters JSONL files by modification time before parsing them. AgentObserver forwards its configured age to Codex, matching the behavior of the other bounded parsers.

Tests cover the default window, old-file exclusion before parsing, recently modified resumed sessions, larger history windows, and observer forwarding.

Why?

Codex was the only JSONL-backed parser that ignored the observer age setting. Every scan reparsed the complete Codex history, causing processing cost to grow over time and making the configured collection window ineffective.

Modification time preserves sessions that were created earlier but resumed within the requested window.

How did you test it?

  • Focused Codex and observer tests: 25 passed
  • Full Sensor suite with a clean isolated home: 128 passed on Python 3.12
  • Ruff lint for the changed implementation and parser tests: passed
  • Git whitespace validation: passed

Potential risks

Low. Sessions with activity outside the configured window are intentionally excluded. Recently resumed sessions remain included because filtering uses file modification time, and the existing large history value continues to include older files.

@lghupan lghupan closed this Aug 22, 2026
@lghupan
lghupan deleted the fix/codex-max-age-days branch August 22, 2026 07:18
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.

1 participant