Skip to content

fix(runner-state): isolate runner state behind OPENSWARM_RUNNER_* env, off real ~/.claude (INT-2543)#272

Merged
unohee merged 1 commit into
mainfrom
fix/INT-2543-runner-state-env-isolation
Jul 6, 2026
Merged

fix(runner-state): isolate runner state behind OPENSWARM_RUNNER_* env, off real ~/.claude (INT-2543)#272
unohee merged 1 commit into
mainfrom
fix/INT-2543-runner-state-env-isolation

Conversation

@unohee

@unohee unohee commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

runnerState's TASK_STATE_FILE / REJECTION_STATE_FILE / PIPELINE_HISTORY_FILE / DECOMPOSITION_STATE_FILE were hardcoded to ~/.claude/openswarm-*.json with no override, so every AutonomousRunner integration test wrote the live daemon's state files (observed: ISSUE-1 accrued 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'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 collision).

Tests

  • Runner integration tests (infraError, cancel) stub all four RUNNER_* vars under their tempDir
  • loadFreshModule clears them so paths derive purely from tempHome, independent 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

tsc + oxlint clean, full suite 148 files / 1764 passed / 1 skipped, openswarm review APPROVE (2 REVISE rounds first).

Context

OpenSwarm test-hygiene defect found during the /goal daemon-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

…_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).
@cursor

cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

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.

@unohee unohee merged commit f720147 into main Jul 6, 2026
5 checks passed
@unohee unohee deleted the fix/INT-2543-runner-state-env-isolation branch July 6, 2026 00:58
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.

1 participant