Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[storage] Every persist rewrites and fsyncs each unchanged thread.json in the Workspace

Open Beginner friendly
#224 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
77/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start with writeThreads in apps/nanocore/src/storage/workspace-file-records.ts and compare its behavior with writeOwnedDescriptiveJson, which already skips unchanged turn.json files. Add a test that persists a change to one Thread and verifies other thread.json files are not replaced. Done means unchanged files are skipped while record bytes and loading behavior stay the same; measure write counts for a Workspace with many Threads.

Written by the indexing model from the issue text.

Description

Problem

Each persist call in FsStore writes every thread.json file in the Workspace again, even when the Thread did not change. writeThreads in apps/nanocore/src/storage/workspace-file-records.ts calls writeJsonAtomic for each Thread without a comparison, while the Turn writer writeOwnedDescriptiveJson already skips an unchanged turn.json. writeJsonAtomic uses writeFileAtomic, so each write also does a file fsync and a parent directory fsync. About 21 store operations call persist, so the cost of every Workspace mutation grows with the number of Threads in that Workspace.

Suggested fix

Skip a thread.json write when the new bytes are identical to the bytes on disk, in the same way as writeOwnedDescriptiveJson does for turn.json. Add a test that persists a change to one Thread and checks that the other Threads' thread.json files are not replaced. This does not change record bytes or the loader. It does not fix any crash window: the RC4 directory publication fix covers the Turn creation window, and createTurn still changes the Thread preview. Measure the write count on a Workspace with many Threads before and after the change.

Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
6h 31m
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lingkaix/openkit

All issues in lingkaix/openkit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.