Operating System: Linux (but affects all OS)
Run Mode: Electron (Desktop App) / Web (all modes affected)
App Version: Current development version
Bug Description:
When Automaker crashes (out of memory, disk full, process kill) during feature execution in Auto Mode, the feature.json file gets corrupted or truncated to 0 bytes. This causes:
- Features to disappear from the Kanban board (JSON.parse fails silently)
- Loss of all task progress (
tasksCompleted counter reset)
- No automatic recovery mechanism to restore progress
The root cause is that feature.json uses non-atomic direct writes (secureFs.writeFile()) instead of the atomic write pattern (temp file + rename) that's already used for settings/credentials elsewhere in the codebase.
Steps to Reproduce:
- Start a feature in Auto Mode with multiple tasks
- Let it progress through several tasks (e.g., 8/12 completed)
- Simulate a crash:
kill -9 the Automaker server process, OR fill up disk during execution
- The feature immediately disappears from the Kanban board
- Check
.automaker/features/{featureId}/feature.json - it's 0 bytes (empty)
Expected Behavior:
feature.json should be written atomically (using temp file + rename) to prevent corruption
- If
feature.json is corrupted, system should auto-recover from backup
- Task progress (
tasksCompleted) should be preserved across crashes
- Features should remain visible on Kanban board even after crashes
Actual Behavior:
feature.json gets truncated to 0 bytes
- Features disappear from Kanban board (hidden due to JSON parse failure)
- All task progress is lost
- Manual intervention required to reconstruct
feature.json
Relevant Logs:
```
-
When feature.json is 0 bytes:
-
No error logged, feature is simply skipped in getAll()
-
Console shows feature count is lower than expected:
-
"Loaded 15 features" (should be 16)
-
File system shows:
$ ls -la .automaker/features/file-upload-system/
-rw-r--r--. 1 seon seon 0 Jan 16 07:54 feature.json # EMPTY!
-rw-r--r--. 1 seon seon 15000 Jan 16 07:14 agent-output.md # Intact
```
Additional Context:
Affected Code Locations:
apps/server/src/services/feature-loader.ts - create(), update() methods
apps/server/src/services/auto-mode-service.ts - updateFeatureStatus(), updateFeaturePlanSpec()
apps/server/src/routes/app-spec/parse-and-create-features.ts - direct write
Existing Pattern to Follow:
The codebase already implements atomic writes for settings/credentials using temp file + rename pattern in apps/server/src/services/settings-service.ts. We should apply this same pattern to feature.json writes.
Proposed Solution:
- Create shared atomic write utility in
libs/utils/src/atomic-writer.ts
- Add backup rotation (keep last 3 versions as
.bak1, .bak2, .bak3)
- Add automatic recovery (detect corrupted JSON and restore from backup)
- Replace all
feature.json writes with atomic writes
Impact:
- High: Affects any Auto Mode feature execution that crashes
- Recurring: Happens multiple times per week during heavy usage
- Data loss: Loses valuable task progress and API conversation history
Checklist:
Operating System: Linux (but affects all OS)
Run Mode: Electron (Desktop App) / Web (all modes affected)
App Version: Current development version
Bug Description:
When Automaker crashes (out of memory, disk full, process kill) during feature execution in Auto Mode, the
feature.jsonfile gets corrupted or truncated to 0 bytes. This causes:tasksCompletedcounter reset)The root cause is that
feature.jsonuses non-atomic direct writes (secureFs.writeFile()) instead of the atomic write pattern (temp file + rename) that's already used for settings/credentials elsewhere in the codebase.Steps to Reproduce:
kill -9the Automaker server process, OR fill up disk during execution.automaker/features/{featureId}/feature.json- it's 0 bytes (empty)Expected Behavior:
feature.jsonshould be written atomically (using temp file + rename) to prevent corruptionfeature.jsonis corrupted, system should auto-recover from backuptasksCompleted) should be preserved across crashesActual Behavior:
feature.jsongets truncated to 0 bytesfeature.jsonRelevant Logs:
```
When feature.json is 0 bytes:
No error logged, feature is simply skipped in getAll()
Console shows feature count is lower than expected:
"Loaded 15 features" (should be 16)
File system shows:
$ ls -la .automaker/features/file-upload-system/
-rw-r--r--. 1 seon seon 0 Jan 16 07:54 feature.json # EMPTY!
-rw-r--r--. 1 seon seon 15000 Jan 16 07:14 agent-output.md # Intact
```
Additional Context:
Affected Code Locations:
apps/server/src/services/feature-loader.ts-create(),update()methodsapps/server/src/services/auto-mode-service.ts-updateFeatureStatus(),updateFeaturePlanSpec()apps/server/src/routes/app-spec/parse-and-create-features.ts- direct writeExisting Pattern to Follow:
The codebase already implements atomic writes for settings/credentials using temp file + rename pattern in
apps/server/src/services/settings-service.ts. We should apply this same pattern tofeature.jsonwrites.Proposed Solution:
libs/utils/src/atomic-writer.ts.bak1,.bak2,.bak3)feature.jsonwrites with atomic writesImpact:
Checklist: