You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
core: markdown writes use three different mechanisms and two of them are not atomic #1355
agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: corepackages/core: the brain CLI, indexer, hybrid search, config, taxonomy, skills.area: mcpThe stdio MCP server and its brain_* tools.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: fixSomething is broken and must behave the way it is documented.
staged write then hard link: archiver (packages/core/src/lib/archiver.ts:109);
the writeFileSafely helper (packages/core/src/lib/safe-path.ts:146).
A crash or full disk during a plain writeFileSync can truncate a user's document.
Scope
Route every write of an existing user document through one atomic writer (write to a temp file in the same directory, preserve mode, rename), extending writeFileSafely if needed.
Keep exclusive-create (flag: "wx", packages/core/src/lib/ingestion.ts:245) semantics where used.
Out of scope
Writes to brain.db, scratch files or generated caches.
Acceptance criteria
No writeFileSync to a user document path remains outside the shared writer; a lint or test enforces it.
A test simulates a failed write (for example a throwing write after the temp file is created) and proves the original file is intact, failing before the change for brain_update.
Status, 2026-10-10: implemented in #1435 (head 22b009461a26f6c1a3ed09a22fa2fc97f703a1be). The PR is not merged yet.
CI run 38007229014, attempt 1, on merge checkout df6f4a6d (head 22b00946 merged into main bae10edc): changeset, verify, runtime, pack, captures, browser (1), browser (2), layout (1), layout (2) and unit (2)–unit (4) passed, and so did contract. The new document-writes and safe-path tests passed in CI.
unit (1) (job 114078933756) failed only at tests/audit-review-artifacts.test.ts:21, where the paid-extra child exits 1. proof fails because it aggregates unit. The cause is test: keep native audit offline controls independent of a frozen detection day #1437: DETECTION_DAY is frozen to 2026-10-09 (scripts/evals/audit-capabilities/benchmark.ts:20), and review-native.ts:35 refuses the request on any later UTC day. The same test fails locally on plain mainbae10edc and on 21f146d1, so this change did not cause it.
Marked blocked on #1437. To resume once #1437 merges: update #1435 onto main, confirm every selected job passes for the new head, then squash-merge with --match-head-commit. Milestone 0.41.0 is set on both this issue and the PR. #1350 and #1397 stay blocked until this issue closes.
Re-claiming to finish #1435 now that #1437 has merged. I removed the stale Blocked by #1437 line and its status note from the body. Branch: fix/1355-atomic-markdown-writes.
Merged in #1435 as squash 20557bf54936a05f31684cbe0f8757104b30b5a3 (parent d57dc62b). The commit is on main.
PR CI: run 38015553713, attempt 1, for head d5d9d6fb passed all 15 checks: changeset, verify, runtime, pack, captures, browser 1–2, layout 1–2, unit 1–4, proof and contract. The jobs checked out 01476eec (head merged into d57dc62b), whose tree 5717f08f is the squash's tree.
Main-push CI: run 38016774457 on 20557bf5 passed every job. The separate website publish workflow failed in artifact because it cannot resolve packages/ui-kit/fixtures/library/index.ts. That failure is unrelated to this change and is tracked in ci: verify the main-push website rebuild after the fixture-source correction #1447.
agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: corepackages/core: the brain CLI, indexer, hybrid search, config, taxonomy, skills.area: mcpThe stdio MCP server and its brain_* tools.priority: p2Wanted, not scheduled. Pulled in when a milestone has room.type: fixSomething is broken and must behave the way it is documented.
Activity
schlessera commentedon Oct 9, 2026
Claiming this (claim token
w1355-a7). Branch:fix/1355-atomic-markdown-writes.schlessera commentedon Oct 10, 2026
Status, 2026-10-10: implemented in #1435 (head
22b009461a26f6c1a3ed09a22fa2fc97f703a1be). The PR is not merged yet.df6f4a6d(head22b00946merged into mainbae10edc):changeset,verify,runtime,pack,captures,browser (1),browser (2),layout (1),layout (2)andunit (2)–unit (4)passed, and so didcontract. The newdocument-writesandsafe-pathtests passed in CI.unit (1)(job 114078933756) failed only attests/audit-review-artifacts.test.ts:21, where the paid-extra child exits 1.prooffails because it aggregatesunit. The cause is test: keep native audit offline controls independent of a frozen detection day #1437:DETECTION_DAYis frozen to 2026-10-09 (scripts/evals/audit-capabilities/benchmark.ts:20), andreview-native.ts:35refuses the request on any later UTC day. The same test fails locally on plainmainbae10edcand on21f146d1, so this change did not cause it.Marked
blockedon #1437. To resume once #1437 merges: update #1435 onto main, confirm every selected job passes for the new head, then squash-merge with--match-head-commit. Milestone 0.41.0 is set on both this issue and the PR. #1350 and #1397 stay blocked until this issue closes.Releasing my claim; the PR stays open and ready.
schlessera commentedon Oct 10, 2026
Unblocked: #1437 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Oct 10, 2026
Re-claiming to finish #1435 now that #1437 has merged. I removed the stale
Blocked by #1437line and its status note from the body. Branch:fix/1355-atomic-markdown-writes.schlessera commentedon Oct 10, 2026
Merged in #1435 as squash
20557bf54936a05f31684cbe0f8757104b30b5a3(parentd57dc62b). The commit is onmain.d5d9d6fbpassed all 15 checks: changeset, verify, runtime, pack, captures, browser 1–2, layout 1–2, unit 1–4, proof and contract. The jobs checked out01476eec(head merged intod57dc62b), whose tree5717f08fis the squash's tree.20557bf5passed every job. The separate website publish workflow failed inartifactbecause it cannot resolvepackages/ui-kit/fixtures/library/index.ts. That failure is unrelated to this change and is tracked in ci: verify the main-push website rebuild after the fixture-source correction #1447.safe-path.tsso that its net size is below main's. The largest packet is now 149,749 bytes, against 149,901 on main. I added this evidence to core: account for complete payload bytes when partitioning audit review sources #1443.blocked. core: add a public module-authoring entry with the path, write and generated-region helpers #1397 staysblockedon packages: replace the env-core and frontmatter-parse copies with one shared leaf package #1396.CONTRACT: refactor(core): move MCP tool handler logic into shared ope…