Skip to content

feat(state): multi-session pipeline state isolation#2

Merged
d-wwei merged 1 commit into
masterfrom
feat/multi-session-state-isolation
Apr 14, 2026
Merged

feat(state): multi-session pipeline state isolation#2
d-wwei merged 1 commit into
masterfrom
feat/multi-session-state-isolation

Conversation

@d-wwei

@d-wwei d-wwei commented Apr 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Per-session state caching prevents concurrent sessions from corrupting each other's pipeline stage
  • rebuildAndCache("state") dual-writes per-session + global cache; loadState() prefers per-session
  • currentSessionId() no longer reads cross-session state.json; session IDs sanitized for path safety
  • taskCreate() derives maxId from event log (not stale cache); duplicate IDs conflict-annotated
  • Stale per-session cache cleanup in apex init (7-day TTL)

Test plan

  • 11 new tests in session-isolation.test.ts — all pass
  • Full regression: 298 tests pass
  • Verify two concurrent sessions with different APEX_SESSION_ID see isolated stages
  • Verify apex status reads per-session cache (stage.ts fix)

Artifacts

  • Spec: docs/specs/multi-session-state-isolation.md
  • Requirements: docs/brainstorms/session-isolation-requirements.md
  • Plan: docs/plans/session-isolation-plan.md
  • Execution log: docs/execution/session-isolation-log.md
  • Review: docs/reviews/session-isolation-review.md

🤖 Generated with Claude Code

Per-session state caching prevents concurrent sessions from corrupting
each other's pipeline stage. rebuildAndCache dual-writes per-session +
global cache, loadState prefers per-session, currentSessionId no longer
reads cross-session state.json, task ID derives maxId from event log,
duplicate IDs are conflict-annotated instead of silently dropped.

- Sanitize session IDs in filenames (path traversal prevention)
- Fix stage.ts loadState bypass for apex status / MCP status
- Stale per-session cache cleanup in apex init (7-day TTL)
- 11 new tests in session-isolation.test.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@d-wwei d-wwei merged commit 7618cd0 into master Apr 14, 2026
1 check passed
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