fix: return active instead of idle when JSONL entry is null

When readLastJsonlEntry returns null (empty file or read error), getActivityState
now returns "active" instead of "idle" as a conservative fallback. This makes it
consistent with:
- Other fallback cases in the same function (no workspace path, no session file)
- Other agent plugins (Codex, OpenCode, Aider) which return "active" on detection failure
- The stated intent in PR discussion to assume active when process is running

Fixes bugbot comment: https://github.com/ComposioHQ/agent-orchestrator/pull/45#discussion_r2810110669

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Prateek 2026-02-16 05:09:50 +05:30
parent 0a71b56c89
commit e9a68fe603
1 changed files with 4 additions and 1 deletions

View File

@ -551,7 +551,10 @@ function createClaudeCodeAgent(): Agent {
}
const entry = await readLastJsonlEntry(sessionFile);
if (!entry) return "idle";
if (!entry) {
// Empty file or read error, but process is running - assume active
return "active";
}
// Check staleness - no activity in 30 seconds means idle
const ageMs = Date.now() - entry.modifiedAt.getTime();