Skip to content

Fix Claude task recovery for worktree paths#228

Merged
DeadWaveWave merged 2 commits intomainfrom
fix/resume-claude-agent
May 6, 2026
Merged

Fix Claude task recovery for worktree paths#228
DeadWaveWave merged 2 commits intomainfrom
fix/resume-claude-agent

Conversation

@DeadWaveWave
Copy link
Copy Markdown
Owner

?? Change Scope

  • Small Change: Fast feedback, localized UI/logic, low-risk.
  • Large Change: New feature, cross-boundary logic, runtime-risk (persistence, IPC, lifecycle, recovery).

?? What Does This PR Do?

Fixes Claude Code task-agent recovery for installed Windows builds when the task runs inside .opencove/worktrees/... paths.

Claude Code encodes project directories by replacing every non-alphanumeric character with -. OpenCove only replaced :, \, and /, so paths containing .opencove were searched as -.opencove-... while Claude wrote session JSONL files under --opencove-.... The installed app then failed to detect the Claude session id, persisted resumeSessionId=null, and could not restore the task-launched Claude session after restart.

This PR updates the shared Claude project path encoder, preserves both legacy encodings as compatibility fallbacks, and updates the Claude test stub so E2E exercises the same path shape as real Claude Code.


??? Large Change Spec (Required if "Large Change" is checked)

1. Context & Business Logic

Task-launched Claude agents must persist a verified resumeSessionId after launch so restart recovery can rebuild the task-agent-session relationship. The bug only appeared for installed app paths using hidden worktree folders because Claude's actual project directory encoding differed from OpenCove's locator.

2. State Ownership & Invariants

  • Durable owner: the agent node owns resumeSessionId / resumeSessionIdVerified; task history is only a recoverable record/projection.
  • Runtime observation: Claude JSONL discovery may upgrade a pending binding to verified, but null discovery must not clear a verified binding.
  • Invariants:
    • Claude project directory lookup matches Claude Code's non-alphanumeric encoding.
    • Legacy dot-preserving encodings remain readable for existing test/user data.
    • Task-launched Claude sessions in .opencove/worktrees/... persist and restore the same verified binding after restart.

3. Verification Plan & Regression Layer

  • Unit: Windows Claude project path tests cover drive-letter paths, hidden .opencove worktree paths, legacy encodings, locator, file resolver, and session catalog.
  • E2E: Windows task Claude recovery now runs from a generated .opencove/worktrees/... directory and verifies restart recovery plus terminal geometry.
  • Full gate: pnpm pre-commit passed.

? Delivery & Compliance Checklist

  • My code passes the ultimate gatekeeper: pnpm pre-commit is completely green.
  • I have signed the CLA if required (see CLA.md).
  • I have included new tests to lock down the behavior (or explicitly stated why it's untestable).
  • I have strictly adhered to the DEVELOPMENT.md architectural boundaries.
  • I have attached a screenshot or screen recording (if this touches the UI). N/A: no visual UI change.
  • I have updated the documentation accordingly (if adding a feature or changing a contract). N/A: bug fix, tests document the recovery invariant.

?? Screenshots / Visual Evidence

N/A: this is a recovery/path-discovery fix with no visual UI change. The Windows task Claude recovery E2E passed.

@DeadWaveWave DeadWaveWave force-pushed the fix/resume-claude-agent branch from f27acfc to b83ce0b Compare May 6, 2026 04:57
@DeadWaveWave DeadWaveWave merged commit 1450c91 into main May 6, 2026
6 of 8 checks passed
@DeadWaveWave DeadWaveWave deleted the fix/resume-claude-agent branch May 6, 2026 05:27
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