Skip to content

Conversation

@gbasin
Copy link
Owner

@gbasin gbasin commented Jan 29, 2026

Summary

  • Replace mtime-based change detection with file size tracking to avoid false activity updates from backup tools/filesystem syncs that touch log files without modifying content
  • Add last_known_log_size column to track file sizes in the database
  • Add is_codex_exec column as an optimization to skip matching for codex-exec sessions
  • Extract timestamps from log entries for accurate activity tracking instead of relying on mtime

Changes

Core Implementation

  • logPoller.ts: Use file size comparison instead of mtime to detect actual log growth
  • logPollData.ts: Include file size in log entry snapshots
  • logMatchGate.ts: Gate re-matching on size changes rather than mtime
  • logMatcher.ts: Add extractLastEntryTimestamp() to parse timestamps from log entries
  • db.ts: Add schema migrations for last_known_log_size and is_codex_exec columns

Improvements

  • logMatchWorkerClient.ts: Refactor worker init error handling to use proper rejection pattern with typed WorkerInitError class
  • App.tsx: Auto-add project to filters when session is selected (if filters are active)

Test plan

  • All 375 tests passing
  • Lint and typecheck passing
  • Added comprehensive tests for extractLastEntryTimestamp function
  • Manual testing with backup tools that modify mtime without changing content

🤖 Generated with Claude Code

gbasin and others added 4 commits January 29, 2026 16:00
Use file size comparison instead of mtime alone to detect log changes.
This prevents false activity updates when backups/syncs modify mtime
without actual content changes.

- Add lastKnownLogSize column to track file sizes
- Add isCodexExec column for codex exec session tracking
- Extract timestamps from log entries for accurate activity times
- Update tests for new database schema

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix lastKnownLogSize null handling: always initialize on first observation
  even when entry.size is 0, preventing DB field from staying null forever
- Defer orphan rematch until after first poll completes to avoid worker
  contention on startup
- Clear readyPromise in timeout handler for consistent state management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add comprehensive tests for extractLastEntryTimestamp function
- Document NULL semantics for last_known_log_size in schema
- Refactor LogMatchWorkerClient to use proper rejection pattern
  instead of confusing initFailed flag
- Add disposed check during worker restart to prevent race condition

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Worker enrichment gating now uses size instead of mtime
- Empty log cache uses size instead of mtime
- Backfill isCodexExec for existing codex sessions
- Remove unused lastEntryTimestamp field from LogEntrySnapshot
- Trim lines in extractLastEntryTimestamp to reduce parse failures

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gbasin gbasin merged commit 4eba120 into master Jan 30, 2026
2 checks passed
@gbasin gbasin deleted the feat/log-size-tracking branch January 30, 2026 14:19
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