{"record":{"id":"c1b89c6b8e8d57d7","repo":"chenhg5/cc-connect","slug":"agent-process-exited-during-compress","errorCode":null,"errorMessage":"agent process exited during compress","messagePattern":"agent process exited during compress","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":10546,"sourceCode":"\n\tfor {\n\t\tvar event Event\n\t\tvar ok bool\n\n\t\tselect {\n\t\tcase <-stopCh:\n\t\t\treturn\n\t\tcase event, ok = <-events:\n\t\t\tif !ok {\n\t\t\t\te.cleanupInteractiveState(sessionKey, state)\n\t\t\t\tif !auto {\n\t\t\t\t\tif len(textParts) > 0 {\n\t\t\t\t\t\te.send(p, replyCtx, strings.Join(textParts, \"\"))\n\t\t\t\t\t} else {\n\t\t\t\t\t\te.reply(p, replyCtx, e.i18n.T(MsgCompressDone))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\te.notifyDroppedQueuedMessages(state, fmt.Errorf(\"agent process exited during compress\"))\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-idleCh:\n\t\t\tif !auto {\n\t\t\t\te.send(p, replyCtx, fmt.Sprintf(e.i18n.T(MsgError), \"compress timed out\"))\n\t\t\t}\n\t\t\te.cleanupInteractiveState(sessionKey, state)\n\t\t\te.notifyDroppedQueuedMessages(state, fmt.Errorf(\"compress timed out\"))\n\t\t\treturn\n\t\tcase <-e.ctx.Done():\n\t\t\treturn\n\t\t}\n\n\t\tif state.isStopped() {\n\t\t\treturn\n\t\t}\n\n\t\tif idleTimer != nil {","sourceCodeStart":10528,"sourceCodeEnd":10564,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L10528-L10564","documentation":"During a /compress operation the engine watches the agent's event stream; if the events channel closes (agent process died mid-compress) the engine notifies that queued messages were dropped with this reason, sends any text already collected, and aborts the compress. It distinguishes \"compress crashed\" from \"compress timed out\".","triggerScenarios":"Agent process exits while a compress loop is in its event-watching select — the channelClosed branch of the compress event loop — with queued messages waiting; typically an agent crash/OOM during the (context-heavy) compression request.","commonSituations":"Context is huge when compressing (the compression prompt pushes the agent over memory limits); agent CLI crash on long conversations; host OOM-kill during compress.","solutions":["Restart a session and retry /compress; the partial text already streamed was delivered before the abort","Check agent logs at the crash point; compression of very large contexts can OOM the agent","Reduce conversation size (start /new) if compresses repeatedly kill the agent","Raise memory limits if the agent is being OOM-killed during compress"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if err := exec.Command(agentBin, \"--version\").Run(); err != nil { return err }; if memAvailable() < minAgentMemBytes { return fmt.Errorf(\"insufficient memory for compress\") }","typeGuard":null,"tryCatchPattern":"On the dropped-message notification containing \"agent process exited during compress\", wait for the session to restart and retry /compress once before escalating.","preventionTips":["Keep conversations under a size where compress fits comfortably in memory","Raise agent memory limits if compresses coincide with OOM kills","Run /compress on an otherwise idle session","Keep the agent CLI updated to a version without known crash bugs on long contexts"],"tags":["go","compress","process-crash","session-lifecycle"],"backgroundTag":"process-exited-unexpectedly","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}