Skip to content

Refuse to treat an unreadable memory or secrets file as empty - #430

Merged
Fei2411 merged 2 commits into
devfrom
fix/409-unreadable-stores
Oct 22, 2026
Merged

Fei2411 merged 2 commits into
devfrom
fix/409-unreadable-stores

Conversation

@Fei2411

@Fei2411 Fei2411 commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Issue

Fixes #409

Bug: a memory file (or secrets.json) that exists but cannot be read was read back as empty, so the next write replaced it and every entry or key in it was lost.

What changed / 改了什么

  • Memory: a read error other than "file not found" is an error (memory/unreadable); remember, forget and recall report it and write nothing. The prompt section does not fail the turn: it says the memory could not be read, and a render with a read failure is not saved as the snapshot.
  • Secrets: a read error blocks writes until the file reads again; a file that is not JSON is first copied to secrets.json.broken-<time>, like a broken state.json.

Changelog

An unreadable memory or secrets file is no longer overwritten by the next change.

How I checked it / 怎么验证的

  • npm test (in ds-bot/): 841 pass, 0 fail, 1 platform skip; new cases for a file that cannot be read and for broken JSON
  • node scripts/build-client.mjs --check
  • npm run lint: 0 errors
  • Smoke test: same result as dev
  • Screenshot: no interface change

Checklist / 检查

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

A memory file or secrets.json that exists but cannot be read used to
read back as empty (ENOENT and real errors alike), so the next write
would replace it and lose every entry or key in it.

Memory: readText and topicNames throw memory/unreadable on non-ENOENT
errors, and remember/forget/recall surface that error to the model. The
prompt section must not throw, so it reads on its own: an unreadable
memory shows '(this memory could not be read: <code>)' and a failed
topic listing is omitted; a render with a read failure is neither frozen
nor written as the snapshot, so the next render tries again.

Secrets: a non-ENOENT read error sets a blocked reason instead of
emptying the store; while blocked, loadSecrets reads the file again each
time (a busy file may only fail briefly), persist() refuses to write
before touching the file, and the deferred noteUsed save is skipped. A
file that is not JSON is copied to secrets.json.broken-<time> first,
like a broken state.json, and the store goes on empty; when the backup
itself fails the store stays blocked.

Fixes #409
@chatgpt-codex-connector

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 🔄 Running since 2026-10-22T08:48:43.220696Z 5d2e556 PR opened
ℹ️ 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.

@Fei2411
Fei2411 merged commit c8b3846 into dev Oct 22, 2026
11 checks passed
@Fei2411
Fei2411 deleted the fix/409-unreadable-stores branch October 22, 2026 09:07
bigbearcool pushed a commit to bigbearcool/DeepSeek-Bot that referenced this pull request Oct 22, 2026
Bring in upstream Fei2411#430–Fei2411#440 (unreadable stores, secret card read-only,
group relay pause, activity row, editable secret purpose, app search
selector, web-search docs, small-viewport/touch/viewport-unit fixes).
Resolve activity-row host lookup by using upstream findHost().
bigbearcool pushed a commit to bigbearcool/DeepSeek-Bot that referenced this pull request Oct 22, 2026
bigbearcool pushed a commit to bigbearcool/DeepSeek-Bot that referenced this pull request Oct 22, 2026
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