Skip to content

feat(agent-manager): add incremental conversation tailing - #163

Open
codeaholicguy wants to merge 2 commits into
mainfrom
feature-console-incremental-tailing
Open

feat(agent-manager): add incremental conversation tailing#163
codeaholicguy wants to merge 2 commits into
mainfrom
feature-console-incremental-tailing

Conversation

@codeaholicguy

Copy link
Copy Markdown
Owner

Summary

  • add one asynchronous conversation-tail API with bounded caching and deterministic read diagnostics
  • incrementally tail Codex JSONL by file identity and byte offset, including partial records, truncation, rotation, parse errors, LRU eviction, and mirrored-message deduplication
  • use SQL LIMIT for OpenCode, worker-thread JSON parsing for Gemini, and stale-result rejection in useAgentConversation
  • retain the 20-message preview, unchanged-source caching, and polling fallback

Benchmark

82.7 MiB Codex fixture, 86,682,730 bytes and 11,747 records:

  • legacy full parse median: 300.5 ms across five runs; prior measured hotspot: 336.6 ms
  • incremental initial load: 241.4 ms
  • one appended 130-byte record: 0.246 ms
  • unchanged refresh: 0.029 ms

Run with:

npm run benchmark:conversation-tail --workspace packages/agent-manager -- <session.jsonl>

Validation

  • agent-manager: 27 files, 526 tests passed sequentially
  • CLI after rebase onto current main: 81 files, 970 tests passed
  • focused conversation-tail tests: 5 files, 104 tests passed
  • agent-manager and CLI lint/typecheck passed; CLI retains five pre-existing warnings outside touched files
  • six-project monorepo build passed
  • feature-doc lint and diff check passed
  • regression proof confirmed the same-size rewrite test fails without reset detection and passes with it restored

Adapter support

Optimized now:

  • Codex: reusable incremental JSONL cache
  • OpenCode: displayable-row SQL query with LIMIT
  • Gemini: off-thread monolithic JSON read/parse

Compatibility fallback:

  • Claude, Copilot, Grok, and Pi preserve current conversation semantics and unchanged-file caching through the shared async manager API; changed files still receive a deferred full parse

Follow-up: migrate those four JSONL adapters to the reusable reducer/cache with parity tests. No second UI or adapter architecture is required.

Risks

  • Codex mirror-key state grows for the lifetime of each cached session; session count is bounded by the 50-entry LRU
  • the four compatibility adapters still do full changed-file parses until their reducer follow-ups land
  • the unrelated print-agent integration requires a longer allowance on heavily loaded hosts because process inspection can exceed its default 5-second timeout

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