Skip to content

fix(agent): report most-recent session id and status from getAgentStatus#60

Open
devYRPauli wants to merge 1 commit into
EveryInc:mainfrom
devYRPauli:fix/agent-status-session-id
Open

fix(agent): report most-recent session id and status from getAgentStatus#60
devYRPauli wants to merge 1 commit into
EveryInc:mainfrom
devYRPauli:fix/agent-status-session-id

Conversation

@devYRPauli

Copy link
Copy Markdown

Problem

getAgentStatus() returned only a running/offline flag and never populated AgentStatusInfo.sessionId, even though sessionId is a declared field on the type and getAgentStatus is exposed as window.getAgentStatus. Callers could not tell which session the status referred to, and a completed session reported offline rather than completed.

Fix

Report the most-recently-active session (by lastActivity): return its id as sessionId, its startTime as startedAt, and a mapped status (active states -> running; completed/cancelled/error preserved; interrupted -> error). With no sessions it still returns offline.

Test

src/tests/agent-status.test.ts now passes (prefers the most-recent completed session, and the most-recent running session).

getAgentStatus collapsed all sessions into a running/offline flag and never
populated AgentStatusInfo.sessionId, despite sessionId being a declared field on
the type and the function being exposed as window.getAgentStatus. Report the
most-recently-active session's id and a mapped status (active states -> running,
completed/cancelled/error preserved) so callers can tell which session the
status refers to. No sessions still yields offline.
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