Skip to content

fix(session): handle missing and historical logs on deletion - #586

Open
wangxiaocuo wants to merge 2 commits into
dataelement:mainfrom
wangxiaocuo:codex/fix-permanent-session-delete
Open

wangxiaocuo wants to merge 2 commits into
dataelement:mainfrom
wangxiaocuo:codex/fix-permanent-session-delete

Conversation

@wangxiaocuo

@wangxiaocuo wangxiaocuo commented Sep 28, 2026 •

Copy link
Copy Markdown

Fixes #584

Problem

When a session's JSONL log has already been removed but its Workspace entry remains, the permanent-delete RPC calls readSessionState first and fails with session/not-found. The stale sidebar entry cannot be cleared. The JSONL deletion path also removes only the selected current generation, leaving older generation files behind.

Changes

  • Resolve a session from its attached/live header or sessionPersistence.stat, without reading the full event log. Clear stale Workspace metadata and emit removal even when the durable log is absent; return { deleted: false } for that case.
  • Keep subagent and busy-agent guards. Report storage errors, and do not delete an unreadable artifact when no valid header can be identified.
  • Delete every recognized JSONL generation for the selected session while holding its write claim and directory lease. Other sessions and Workspace files remain untouched.
  • Cover Host command behavior, real JSONL persistence, retry after a storage failure, and Harness RPC deletion, including repeated deletion.

Patch scope

This updates the existing patch-package patches for @deepseek-ai/dsh-api-session-controller@0.2.0-rc.2 and @deepseek-ai/dsh-session-persistence-jsonl@0.2.0-rc.2. The required delete behavior is inside Harness and has no public extension point; it serves Desktop's existing session/delete RPC. No UI slot or plugin contract changes. These patch changes can be removed when the upstream Harness packages provide equivalent behavior.

Verification

  • npm ci (all patches reapplied from a clean install)
  • npm test (182 files, 1,619 tests, including a real macOS Harness subprocess)
  • npm run typecheck
  • npm run build
  • git diff --check

Windows and the reporter's actual Profile/installed-app UI have not been tested.

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