Skip to content

bug(workspace): every multi-agent room goes dead after ~6h — room participants are missing from the session-JSONL reaper keep-set #2610

Closed

Description

@dolho

Summary

Every multi-agent room breaks after ~6 hours. The JSONL reaper's keep-set unions agent sessions and portal sessions but never room participants, so each room participant's Claude session file is an orphan by construction and is deleted on the next sweep. The next mention of any agent in that room fails with:

<agent> could not respond: Execution failed with no output (exit code 1):
No conversation found with session ID: facad8e8-0f01-42a9-adef-1734c310bbeb

Observed on the dev instance: a 3-agent room from the previous day, every participant failing on its first mention with a different session id. A 1-agent Workspace chat from the same day works fine — its id is in the keep-set.

This is the ent#358 class on a third surface. session_cleanup_service.py's own header already states the rule: omitting a keep-set half "deletes live session files an hour after they are written and every thread goes cold with no error anywhere".

Root cause

Rooms store a resumable Claude handle per (agent, room):

  • src/backend/db/schema.py:641 — enterprise_room_participants.cached_session_id, commented "Per-(agent, room) Claude session for --resume continuity"
  • src/backend/shared_sessions/service.py:967 — passed to execute_task(resume_session_id=cached)

The reaper builds its keep-set from exactly two sources:

  • src/backend/services/session_cleanup_service.py:209 — db.list_active_claude_session_ids (agent_sessions)
  • src/backend/services/session_cleanup_service.py:226 — portal_db.list_active_claude_session_ids (enterprise_portal_sessions)

Rooms are never consulted. Only three list_active_claude_session_ids accessors exist in the tree (database.py, db/sessions.py, client_portal/db.py) — there is none for shared_sessions, and grepping the reaper for room returns nothing.

Timing matches exactly (session_cleanup_service.py:94-95): 6h sweep interval, 1h age guard. Any room idle overnight loses every participant's file.

Impact

Multi-agent rooms have no durable continuity at all. Each participant's memory of the room survives at most one sweep interval. Single-agent Workspace chats are unaffected.

Two defects, one report

1. Root — rooms absent from the keep-set.
Add list_active_claude_session_ids(agent_name) to shared_sessions/db.py over enterprise_room_participants.cached_session_id WHERE left_at IS NULL, and union it into the keep-set beside the portal half. It must inherit the portal half's fail-closed rule: a read error aborts the sweep rather than reaping against a partial set — otherwise the fix reintroduces the bug on the error path.

2. Symptom — rooms have no inline cold retry.
services/session_turn_service.py::run_resumable_turn retries once cold when Claude reports the JSONL missing, so the other two surfaces recover invisibly. The room path (shared_sessions/service.py, the status in ("failed","cancelled") branch) only clears the handle and posts a failure line, so the first wake after any reap is always user-visible. Worth fixing regardless of (1), since a handle can also die from a container recreate or a manual reset.

Fixing (1) stops the recurrence; (2) makes the class survivable.

Reproduce

  1. Create a room with 2+ agents, exchange messages so each participant gets a cached_session_id.
  2. Wait for one reaper sweep (≤6h; the files need to be >1h old).
  3. Mention any agent in the room → No conversation found with session ID: ….

Faster: delete the participant's JSONL from the container and mention the agent.

docker exec trinity-postgres psql -U trinity -d trinity -c \
 "SELECT identity, cached_session_id FROM enterprise_room_participants WHERE room_id='<room>';"
docker exec agent-<name> ls /home/developer/.claude/projects/-home-developer/<uuid>.jsonl

Workaround

Re-mention the agent. The failure branch clears the dead handle, so the second mention runs cold and answers — at the cost of that agent's prior room context (it receives only ROOM_COLD_CONTEXT_MESSAGES recent messages).

Activity

  1. added
    priority-p1
    type-bug
    theme-reliability
    status-in-progress
    on Sep 8, 2026
  2. self-assigned this
    on Sep 8, 2026
  3. added
    status-in-dev
    and removed
    status-in-progress
    on Sep 8, 2026
  4. removed
    status-in-dev
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p1theme-reliabilitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions