agentd: optimize persistent session tailing for watch/status

t-804·WorkTask·
·
·
Created3 days ago·Updated3 days ago·pipeline runs →

Dependencies

Description

Edit

Optimize persistent watch/status tailing for large session files.

Problem: Some paths still read large portions of session logs; this scales poorly for long-lived agents.

Scope:

  • Use seek-from-end tail reads for persistent watch startup and status reconciliation.
  • Reuse a shared tail-reader utility for watch/logs/status paths.
  • Add tests for truncated/partial-line handling.

Acceptance:

  • No full-file reads on hot paths for persistent watch/status.
  • Correct output across partial-line/truncated-tail edge cases.

Git Commits

f9c95bb1perf(agentd): use shared tail reader for persistent watch and status
Coder Agent3 days ago3 files

Timeline (4)

🔄[human]Open → InProgress3 days ago
💬[human]3 days ago

Implemented shared tail-reader utility and removed full-file reads from persistent watch/status hot paths. Added Omni/Agentd/SessionLog.hs with tail/incremental JSONL helpers, switched persistent watch startup/follow to tail+offset reads, switched top activity session reads to bounded tail reads, and reused shared helpers in daemon follow paths. Added tests for trailing partial-line splitting and leading partial-line truncation handling. Verified with typecheck.sh Omni/Agentd/SessionLog.hs Omni/Agentd/Daemon.hs Omni/Agentd.hs, lint Omni/Agentd/SessionLog.hs Omni/Agentd/Daemon.hs Omni/Agentd.hs, bild --test Omni/Agentd/Daemon.hs, bild --test Omni/Agentd.hs. Commit: f9c95bb1

🔄[human]InProgress → Review3 days ago