Skip to content

Read every chat with the pinned DSH before the first-run copy - #340

Merged
Fei2411 merged 4 commits into
devfrom
feat/import-read-check
Oct 19, 2026
Merged

Fei2411 merged 4 commits into
devfrom
feat/import-read-check

Conversation

@Fei2411

@Fei2411 Fei2411 commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Issue

None. This is the read check listed under the desktop app design's known limitations.

What changed / 改了什么

A newer DSH can write records that the pinned DSH must refuse while the session format version stays the same (DSH 0.2.1 added job/registered, job/settled and working-directory/change within format 4). The first-run check only looked at the format version in the file name, so such a team was copied, and a Bot whose current part was one of those chats could not load its history or send a message in the app.

Now, before the copy:

  • The app copies the team's chats into a throwaway DSH home in the data location and starts the Host once with a profile of its own, import-check (dsh-base and dsh-web-app, without ds-bot), so no Bot runs on them. It opens each chat read-only through sessionPersistence and reads it, then removes the copy.
  • A SessionFormatUnsupportedError stops the copy with the dialog that a newer format already shows: "N chats were written by a newer DeepSeek Harness than this DeepSeek Bot can read. Update DeepSeek Bot, then start it again to copy the team." with Quit and Start without the team. Quit forgets the chosen folders, so the next start asks again.
  • A damaged log does not stop the copy: the user's own DSH cannot read it either. A check that cannot run leaves the copy as before.

The design note and the app README describe it.

Changelog

Before copying a team from DeepSeek Harness, the desktop app reads each chat once and asks you to update DeepSeek Bot when a newer DeepSeek Harness wrote one.

How I checked it / 怎么验证的

  • npm test in app/: 51 pass. New: the classification with a fake store; the real check Host on two chats in format 4, one with a record that DSH does not know (only that one is reported); the copy for the check takes only the team's chats and changes nothing in the user's DSH home.
  • npm test (in ds-bot/): not changed
  • node scripts/build-client.mjs --check: not changed
  • npm run lint: not changed
  • Smoke test: not changed
  • Screenshot attached, for interface changes: the packaged app on Windows, first start on throwaway folders (user folder, source DSH home and shell data all temporary), dialogs answered by UI automation:
    • a team with an unknown required record: the dialog appears; Quit exits, leaves no check folder and no saved folders; the next start asks again; Start without the team starts a new team without the copy.
    • a readable team: no dialog, the team is copied (1 Bot, 1 Session).

Checklist / 检查

  • One issue, one subject. / 只做一件事。
  • src/client/ changed → npm run build ran and client.js is committed. (not changed)
  • No keys, tokens or personal data, also in screenshots. / 没有密钥、token 或个人信息,截图里也没有。
  • No AI tool as author or Co-authored-by. / 没有把 AI 工具写成作者或 Co-authored-by。

…copy

A newer DSH can write records that the pinned one must refuse while the
session format stays the same, so the file-name check lets such a team
through, and a Bot whose current part is one of those chats cannot work
in the app. The app now copies the team's chats into a throwaway DSH home
and opens each one read-only in a DSH without ds-bot, through
sessionPersistence. A SessionFormatUnsupportedError stops the copy with
the existing "update DeepSeek Bot first" dialog; Quit asks again at the
next start. A damaged log does not stop it, since the user's DSH cannot
read it either, and a check that cannot run leaves the copy as before.
@Fei2411

Fei2411 commented Oct 19, 2026

Copy link
Copy Markdown
Owner Author

The dialog when a chat was written by a newer DSH (Windows, Chinese system language):

import-newer-chat-dialog

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T09:27:31.524195Z 43cc6c0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b253f40959

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/src/main.mjs

// A copy of the chats in a DSH home of its own, so that nothing of the check stays in the data.
async function checkTeam(where, newCheck) {
const home = join(where.dataDir, `.import-check-${String(Date.now())}`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Track the check so quitting removes its session copy

If the user closes the window while copySessions or the check Host is still running, the before-quit handler sees the global host as undefined and permits immediate termination because this check is only stored in a local variable. The finally cleanup therefore never runs, leaving a partial or complete .import-check-* copy of every team chat in the selected data directory. Make the shutdown path wait for the check and its cleanup, as it does for the normal Host.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 43cc6c0: quitting during the check now stops the copy between Sessions or the check's Host, waits until the copy is removed, and the first start does not go on to copy the team. Checked on the packaged Windows app by closing the window 0.3 s after Copy: the app exited 0.7 s later with no .import-check-* folder and no process left.

Closing the window during the check quit at once, since only the Host
held the quit back, and left the throwaway copy of the team's chats in
the data location. Quitting now stops the copy between Sessions or the
check's Host, waits for the copy to be removed, and the first start does
not go on to copy the team.
@Fei2411

Fei2411 commented Oct 19, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 43cc6c0634

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@rahul05ranjan rahul05ranjan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design here is careful and the pieces fit together: reading the sessions through a throwaway copy under the new data location (the import-check profile without ds-bot) keeps the pinned DSH from ever touching the user's DSH home, and unreadableSessions distinguishing SessionFormatUnsupportedError from damaged logs matches the README contract — a newer DSH's record stops the copy, a corrupt one doesn't, since the user's own DSH can't read it either. Resolving checked alongside ready in host-process.mjs is a tidy extension, and checkTeam treating a failed check as "proceed unchecked" rather than a failed start is the right failure mode.

Two thoughts:

  • checkTeam copies every team session into .import-check-* inside the data location, and then the real import copies them again — on a large team that doubles first-run I/O. Not a blocker, but it's where a future progress bar or size guard will be needed.
  • If the final rm of the throwaway home fails (locked file on Windows, say), a directory with a full copy of the user's sessions stays behind in the data location. A sweep for stale .import-check-* dirs on next start would close that.

Tests cover the pure helpers well; I didn't run the app itself.

@Fei2411
Fei2411 merged commit f01c1c7 into dev Oct 19, 2026
11 checks passed
@Fei2411
Fei2411 deleted the feat/import-read-check branch October 19, 2026 09:34
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.

2 participants