Skip to content

🤖 refactor: centralize workspace project runtime recreation#3142

Open
ammar-agent wants to merge 1 commit intomainfrom
refactor-ssh-runtime-path-hints
Open

🤖 refactor: centralize workspace project runtime recreation#3142
ammar-agent wants to merge 1 commit intomainfrom
refactor-ssh-runtime-path-hints

Conversation

@ammar-agent
Copy link
Copy Markdown
Collaborator

Summary

This follow-up to #3125 centralizes how existing workspace runtimes are recreated after the SSH runtime simplification. It keeps persisted workspace paths and SSH sibling-path hints behind shared helpers instead of re-encoding the same rules in AI startup, executeBash, file completions, and workspace lifecycle flows.

Background

#3125 intentionally simplified the SSH runtime stack, but it left a handful of service callsites manually reconstructing createRuntime(... workspacePath: getWorkspacePathHintForProject(...)). Those copies all had to remember the same persisted-path rules, which made the affected code harder to read and easier to drift.

Implementation

  • narrow getWorkspacePathHintForProject() to the path-related fields it actually needs
  • add createRuntimeForWorkspaceProject() and resolveWorkspacePathForProject() in workspaceProjectRepos.ts
  • reuse those helpers in AIService, multi-project WorkspaceService flows, and getWorkspaceProjectRepos()
  • switch a few single-project existing-workspace recreations in WorkspaceService to createRuntimeForWorkspace() so persisted checkout roots still come from one helper path
  • extend workspaceProjectRepos.test.ts with coverage for single-project persisted roots and canonical sibling-path fallback

Validation

  • bun test src/node/services/workspaceProjectRepos.test.ts
  • bun test src/node/services/workspaceService.test.ts -t 'preserves the current SSH workspace path and derives sibling legacy paths for multi-project completions when the persisted root matches that layout|aggregates multi-project completions using project-prefixed paths|executeBash workspace path resolution'
  • bun test src/node/services/aiService.test.ts -t 'uses the persisted workspace root as cwd for multi-project ssh startup'
  • make static-check

Risks

Low. This is a path-resolution cleanup around already-shipped behavior, so the main regression risk is choosing the wrong checkout root for existing workspaces. The helper-focused tests and the targeted AI/workspace service regressions cover the persisted-root and sibling-path cases that motivated the refactor.


Generated with mux • Model: openai:gpt-5.4 • Thinking: xhigh • Cost: $277.91

@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab794ee19a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent ammar-agent force-pushed the refactor-ssh-runtime-path-hints branch from ab794ee to 989f30d Compare April 6, 2026 22:08
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed the single-project eager runtime construction feedback and added a regression test.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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