Skip to content

Terminal: one folder check for terminal_tabs on desktop and server (#526) - #562

Open
MopigamesYT wants to merge 1 commit into
devfrom
fix/526-terminal-cwd-check
Open

MopigamesYT wants to merge 1 commit into
devfrom
fix/526-terminal-cwd-check

Conversation

@MopigamesYT

Copy link
Copy Markdown
Member

Closes #526

What changed

  • agent.TerminalDir gives the folder terminal_tabs opens a terminal in:
    • the workspace when no cwd is given;
    • on an SSH machine, MachinePath, which resolves links there, so one can't lead outside the project;
    • on this computer, WorkspacePath.
  • The headless server and the desktop both call it. The desktop used to only join the path and compare its prefix, so it accepted a link in the project that pointed outside it, while the server refused it.
  • On the desktop, the folder is now resolved before the UI callback, because on a machine it is looked up over SFTP. A chat whose SSH machine was removed gets a clear error instead of a terminal that fails to open.

Screenshots

Nothing visible: no screenshots.

Checked here: go test ./internal/agent ./internal/server ./internal/ui, go build ./..., go vet, gofmt. TestTerminalDirOnAMachine uses a fake machine backed by local folders and covers a link out of the project, .., a folder inside it, and no cwd. Not run here: a real SSH machine. There is no desktop-level test of the tool itself.

Assisted-by: Claude Opus 5.5 medium

🤖 Generated with Claude Code

)

On an SSH machine the server resolved a terminal's cwd with MachinePath
(links followed over SFTP), while the desktop only joined the path and
compared its prefix: a link in the project that led outside it was
refused on one and accepted on the other. agent.TerminalDir now does it
for both. The desktop resolves the folder before its UI callback, since
it is looked up on the machine.

Tests: TestTerminalDirOnAMachine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

2 participants