Skip to content

Fix agent terminal profile recovery#110

Open
DeadWaveWave wants to merge 8 commits intomainfrom
fix/agent-terminal
Open

Fix agent terminal profile recovery#110
DeadWaveWave wants to merge 8 commits intomainfrom
fix/agent-terminal

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?

Aligns agent launches and recovery with terminal profile semantics so agent windows on Windows inherit the same shell/runtime behavior as terminals. This fixes three user-facing regressions: agent sessions failing to inherit environment/runtime on some devices, recovery relaunches silently losing execution context, and wheel input in raw TUI agent windows not being covered by a regression test.


🏗️ Large Change Spec (Required if "Large Change" is checked)

1. Context & Business Logic

  • Agent launch/relaunch/resume should use the selected terminal profile as the single source of truth for runtime selection, matching terminal behavior.
  • Recovery fallback must preserve the agent execution directory instead of silently jumping back to workspace root.
  • Windows-specific terminal profile wrapping needs to be explicit for WSL, Git Bash, and PowerShell so env injection and cwd semantics stay stable.

2. State Ownership & Invariants

  • Main-process terminal profile resolution owns runtime selection and command wrapping.
  • Persisted agent node state owns durable profileId, runtimeKind, executionDirectory, and resumeSessionId metadata used during hydration.
  • Invariants:
    1. Agent resume/relaunch uses the same terminal profile semantics as terminal nodes when a profile is present.
    2. Recovery fallback never downgrades cwd from agent.executionDirectory to workspace root.
    3. When recovery falls back to a plain PTY, the preserved profileId is still forwarded so the shell environment stays consistent.

3. Verification Plan & Regression Layer

  • Unit: terminal profile resolver command wrapping and control-surface launch metadata.
  • Integration: app-state hydration preserves profile/runtime metadata and recovery fallback cwd/profile behavior.
  • E2E: Windows terminal wheel interaction in raw-TUI flows, plus full pnpm pre-commit coverage.

✅ Delivery & Compliance Checklist

  • My code passes the ultimate gatekeeper: pnpm pre-commit is completely green.
  • 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).
  • I have updated the documentation accordingly (if adding a feature or changing a contract).

📸 Screenshots / Visual Evidence

  • No static screenshot attached. This change is primarily runtime/recovery behavior; coverage is provided by the new Windows E2E and recovery integration tests.

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