fix(runner-state): isolate runner state behind OPENSWARM_RUNNER_* env, off real ~/.claude (INT-2543)#272
Merged
Conversation
…_RUNNER_* env, off the real ~/.claude (INT-2543)
runnerState's TASK/REJECTION/PIPELINE_HISTORY/DECOMPOSITION paths were hardcoded to
~/.claude/openswarm-*.json with no override, so every AutonomousRunner integration
test wrote the LIVE daemon's state (observed: ISSUE-1 accrued 184 phantom failures)
and the tests were flaky against that shared real state.
Each path now honors an OPENSWARM_RUNNER_* env override (unset → the exact legacy
path, backward compatible). The names are deliberately DISTINCT from the canonical
task store's OPENSWARM_TASK_STATE_FILE (src/taskState/store.ts): the two stores have
different schemas, so sharing one env var would let runnerState.saveTaskState()
silently overwrite the canonical {version,tasks,…} file (reviewer-caught).
The runner integration tests (infraError, cancel) now stub all four RUNNER_* vars
under their tempDir; loadFreshModule clears them so paths derive purely from tempHome
regardless of the ambient shell env. Coverage: all four overrides redirect their
const; appendPipelineHistory writes ONLY to the overridden file; setting the canonical
var alone does NOT move the runner path.
Verified: tsc + oxlint clean, full suite 148 files / 1764 passed; openswarm review APPROVE
(2 REVISE rounds first — canonical-var collision, then pipeline-history coverage).
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
runnerState'sTASK_STATE_FILE/REJECTION_STATE_FILE/PIPELINE_HISTORY_FILE/DECOMPOSITION_STATE_FILEwere hardcoded to~/.claude/openswarm-*.jsonwith no override, so everyAutonomousRunnerintegration test wrote the live daemon's state files (observed:ISSUE-1accrued 184 phantom failures) and those tests were flaky against the shared real state.Fix
Each path now honors an
OPENSWARM_RUNNER_*env override (unset → the exact legacy path, backward compatible). The names are deliberately distinct from the canonical task store'sOPENSWARM_TASK_STATE_FILE(src/taskState/store.ts) — the two stores have different schemas, so sharing one env var would letrunnerState.saveTaskState()silently overwrite the canonical{version,tasks,…}file (reviewer-caught collision).Tests
RUNNER_*vars under theirtempDirloadFreshModuleclears them so paths derive purely fromtempHome, independent of the ambient shell envappendPipelineHistorywrites only to the overridden file; setting the canonical var alone does not move the runner pathtsc + oxlint clean, full suite 148 files / 1764 passed / 1 skipped,
openswarm reviewAPPROVE (2 REVISE rounds first).Context
OpenSwarm test-hygiene defect found during the
/goaldaemon-fixing session. Prevents future runner tests from polluting the live daemon's state. Related: INT-2545 (base-ref), INT-2548 (ENOSPC crash), INT-2521 (⑦ pure-helper — this was the root cause behind that flakiness).🤖 Generated with Claude Code