Skip to content

fix(agent-manager): treat ephemeral session markers as authoritative - #507

Open
Mugunth007 wants to merge 1 commit into
codeaholicguy:mainfrom
Mugunth007:fix/ephemeral-sessions-authoritative-500
Open

Mugunth007 wants to merge 1 commit into
codeaholicguy:mainfrom
Mugunth007:fix/ephemeral-sessions-authoritative-500

Conversation

@Mugunth007

Copy link
Copy Markdown

Fixes #500.

Summary

  • Treat "ephemeral" tracker entries in Pi (~/.pi/agent/sessions.json) and hook mapping entries in Codex (~/.codex/ai-devkit/sessions.json) as authoritative instead of falling through to stale AgentRegistry rows or legacy session scanning.
  • Preserve AgentRegistry.mergeEntry / session_map::trusted_existing behavior for regular session paths while separating ephemeral PIDs into a distinct ephemeral list in PiSessionTracker / CodexSessionMapping (TS) and SessionTracker / SessionMapping (Rust devkit-harness).
  • Map ephemeral processes directly to process-only agents (sessionId: "pid-<pid>", sessionFilePath: undefined/None), skipping Stages 2 and 3 in both TS adapters and Rust detect().
  • Add unit and adapter regression tests across TS (PiSessionTracker.test.ts, PiAdapter.test.ts, CodexSessionMapping.test.ts, CodexAdapter.test.ts) and Rust (pi::tests::ephemeral_tracker_entry_skips_stale_registry_and_session_scan, codex::tests::ephemeral_mapping_entry_skips_stale_registry_and_session_scan).

Verification

  • vitest (packages/agent-manager): 94 test files passed (1 skipped, pre-existing), 1423 tests passed (12 skipped) including tests/harnesses/pi and tests/harnesses/codex.
  • npm run lint (nx run-many -t lint via WSL Linux): 0 errors.
  • npx oxfmt --check on all 8 modified TypeScript files: passed.
  • npx tsc --noEmit (packages/agent-manager): passed.
  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace (devkit-core: 44 + 10 + 4 passed; devkit-harness: 84 + 4 passed; devkitd: 56 + 9 passed): all passed.

This branch has not been deployed

No deployments
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.

fix(session-resolution): 'ephemeral' sessions.json entry not authoritative — live pid regresses to dead pre-restart session

1 participant