bug(runtime): fd-pinned writes report success after a short write
@seekskyworld is already working on this.
Since Sep 16, 2026.
Assessment
This issue has not been assessed yet.
Description
What happened
The fd-pinned filesystem writer ignores FileHandle.write()'s bytesWritten result. A successful short write therefore silently truncates the requested content while the filesystem worker reports ok: true and the full requested byte count.
On current main, a real 4,096-byte Write with a 1,024-byte process file-size limit returned success and bytes: 4096, but the file contained only 1,024 bytes. No filesystem mocks were used in this reproduction.
Expected: continue writing the remaining bytes through the same descriptor. If a subsequent write fails or makes no progress, report the existing outcome_unknown result so the caller knows it must re-read the file.
How to reproduce
Build the repository, then run this POSIX-only probe from its root (Python supplies the process resource limit; Node runs the production writer):
import os, resource, signal, subprocess, tempfile
script = """
import { open, stat } from 'node:fs/promises';
import { writeThroughHandle } from './packages/runtime/dist/file-stable-write.js';
const file = process.argv[1];
const handle = await open(file, 'w+');
try {
await writeThroughHandle(handle, 'x'.repeat(4096));
console.log('write reported success');
} finally {
await handle.close();
}
console.log('actual bytes:', (await stat(file)).size);
"""
def limit_file_size():
signal.signal(signal.SIGXFSZ, signal.SIG_IGN)
resource.setrlimit(resource.RLIMIT_FSIZE, (1024, 1024))
with tempfile.TemporaryDirectory() as directory:
subprocess.run(
['node', '--input-type=module', '-e', script, os.path.join(directory, 'file.txt')],
preexec_fn=limit_file_size, check=True,
)
Actual output: write reported success, actual bytes: 1024.
A separate probe through executeFilesystemWorkerRequest confirms the same false-success response in the production Write operation, rather than only in the helper.
Environment
- Maka commit:
27add3049 - macOS arm64
- Node 24.18.1; helper also reproduced on Node 26.4.0
- Surface: Runtime filesystem worker (shared fd-pinned Write/Edit/ApplyPatch/FormatJson helper)
Logs, screenshots, or additional context
packages/runtime/src/file-stable-write.ts:166 truncates the descriptor, performs one string write, and discards its result. File identity verification after the write cannot detect an incomplete payload on the same inode.
The fix must preserve explicit byte positions after a prior readFile, UTF-8 boundaries across short writes, and the existing path-identity protections. Searching existing issues/PRs found no matching short-write fix. Open PR #4542 touches an unrelated comment in this file.
Automated report: OpenAI Codex reproduced and documented this issue as part of the contributor's requested audit.
- Dominant language
- TypeScript
- Stars
- 5.6k
- Forks
- 518
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 684
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maka
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
-
Desktop: task refresh fails with opaque persistence_failed; the real transcript error is discarded Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·