Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Oct 27, 2025

Problem

SSH runtime agents encounter ENOENT errors when calling todo_write:

Error: ENOENT: no such file or directory, open '/root/.cmux-tmp/b29673ad/todos.json'

The root cause was that the todo tool was using Node's fs module directly, which only works on the local filesystem. For SSH runtimes, file operations must go through the runtime abstraction.

Solution

Refactored todo tool to use runtime abstraction for all file operations:

  • readTodos/writeTodos now use readFileString/writeFileString helpers from @/utils/runtime/helpers
  • Directory creation uses runtime.exec('mkdir -p') instead of fs.mkdir()
  • Test helpers updated to accept Runtime parameter
  • All tests updated to use createRuntime({ type: 'local' })

Testing

  • Added test case that verifies directory creation when path doesn't exist
  • All 14 existing tests pass with runtime abstraction
  • Tests verify both local runtime behavior and proper isolation

Generated with cmux

Ensure temp directory exists before writing todos.json. Previously,
writeTodos() assumed the directory already existed, but SSH runtime
initialization could fail to create it, resulting in ENOENT errors.

Added fs.mkdir() with recursive: true to create the directory if needed.
Replace direct fs operations with runtime abstraction to support SSH
runtimes. Key changes:

- readTodos/writeTodos now use readFileString/writeFileString helpers
- Directory creation uses runtime.exec('mkdir -p') instead of fs.mkdir
- Test helpers updated to accept Runtime parameter
- All tests updated to use createRuntime() for local testing

This enables todo persistence to work correctly on both local and SSH
runtimes.
@ammario ammario merged commit 141f03b into main Oct 27, 2025
13 checks passed
@ammario ammario deleted the rt-todos branch October 27, 2025 14:46
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