Issue Summary
A webchat session was deleted by archiveSessionTranscripts(reason: "deleted") while it still had active tool execution in progress. The deletion occurred at 2026-03-22 19:00:26.270Z (UTC).
Environment
- Platform: WSL2 (Ubuntu 24.04)
- OPENAEON version: main branch (commit: fd7bac3)
- Session compaction mode:
safeguard
- Node: v24.14.0
Timeline (UTC)
| Time |
Event |
| 2026-03-22 17:58:26 |
Session created and begins processing |
| 2026-03-22 19:00:02 |
Session still active — tool execution begins |
| 2026-03-22 19:00:26 |
abort failed: reason=no_active_run |
| 2026-03-22 19:00:26.270 |
Session file deleted via archiveSessionTranscripts(reason: "deleted") |
Evidence
Gateway Logs
// 19:00:02 - Session actively executing tool
{"subsystem":"agent/embedded","1":"embedded run tool start: tool=exec"}
// 19:00:26 - abort returns "no_active_run" (contradiction!)
{"subsystem":"diagnostic","1":"abort failed: sessionId=... reason=no_active_run"}
// 19:00:26.270 - Session file renamed to .deleted.*
Session File Deletion
-rw------- 1 feike feike 524288 Mar 23 01:38
cdf2cf1a-736e-433c-9e3e-2ed9ef66cdd6.jsonl.deleted.2026-03-22T19-00-26.270Z
Root Cause Hypothesis
The session deletion appears to be triggered by compaction, but:
- Compaction mode is
safeguard — should NOT auto-delete sessions
- The session was in
active=true state
- No
sessions.delete RPC call was logged
- Session file was renamed to
.deleted.* by archiveSessionTranscripts()
Possible cause: A race condition where:
- Session compaction runs and decides to reset/archive the session
- The session simultaneously receives new work (tool execution)
- Compaction deletes the session file while work is in progress
abort fails because compaction already removed the session state
Expected Behavior
- Active sessions should NOT be deleted or archived
archiveSessionTranscripts should verify entry.active === false before deletion
- Compaction in
safeguard mode should preserve active sessions
Suggested Fixes
- Add active-check before archive: Verify
entry.active === false before calling archiveSessionTranscripts
- Add session lock: Prevent compaction from removing sessions with recent activity (e.g., last 5 minutes)
- Fix abort race condition: Investigate why
abort returns no_active_run when session is clearly processing
- Log the trigger: Add logging for who called
archiveSessionTranscripts with reason: "deleted"
Issue Summary
A webchat session was deleted by
archiveSessionTranscripts(reason: "deleted")while it still had active tool execution in progress. The deletion occurred at 2026-03-22 19:00:26.270Z (UTC).Environment
safeguardTimeline (UTC)
abort failed: reason=no_active_runarchiveSessionTranscripts(reason: "deleted")Evidence
Gateway Logs
Session File Deletion
Root Cause Hypothesis
The session deletion appears to be triggered by compaction, but:
safeguard— should NOT auto-delete sessionsactive=truestatesessions.deleteRPC call was logged.deleted.*byarchiveSessionTranscripts()Possible cause: A race condition where:
abortfails because compaction already removed the session stateExpected Behavior
archiveSessionTranscriptsshould verifyentry.active === falsebefore deletionsafeguardmode should preserve active sessionsSuggested Fixes
entry.active === falsebefore callingarchiveSessionTranscriptsabortreturnsno_active_runwhen session is clearly processingarchiveSessionTranscriptswithreason: "deleted"