Skip to content

fix: construct full path for workspaceLogPath instead of just filename #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2025

Conversation

blink-so[bot]
Copy link
Contributor

@blink-so blink-so bot commented Jul 16, 2025

Problem

The VS Code extension was failing to open SSH proxy log files with the error:

cannot open file:///coder-ssh-20250716-123428-qvict-90716.log. Detail: Unable to read file '/coder-ssh-20250716-123428-qvict-90716.log' (Error: Unable to resolve nonexistent file '/coder-ssh-20250716-123428-qvict-90716.log')

This occurred because workspaceLogPath was being set to just the filename instead of the full path, causing VS Code to look for the file in the wrong location.

Solution

Modified the code in src/remote.ts to properly construct the full path using path.join(logDir, logFileName) instead of just storing the filename.

Before:

this.commands.workspaceLogPath = logFiles
    .reverse()
    .find((file) => file === `${pid}.log` || file.endsWith(`-${pid}.log`));

After:

const logFileName = logFiles
    .reverse()
    .find((file) => file === `${pid}.log` || file.endsWith(`-${pid}.log`));
this.commands.workspaceLogPath = logFileName
    ? path.join(logDir, logFileName)
    : undefined;

Testing

  • ✅ TypeScript compilation passes
  • ✅ ESLint passes with no style issues
  • ✅ Verified the fix constructs proper full paths like /tmp/coder-logs/coder-ssh-20250716-123428-qvict-90716.log

This fix ensures that when users configure the coder.proxyLogDirectory setting and use the "View Logs" command, VS Code can successfully open the SSH proxy log files.

The workspaceLogPath was being set to just the log filename instead of the
full path, causing VS Code to fail when trying to open the log file with
'Unable to resolve nonexistent file' errors.

This fix ensures that path.join(logDir, logFileName) is used to construct
the complete file path, allowing the 'View Logs' command to work properly
when coder.proxyLogDirectory is configured.

Fixes the issue where log files like 'coder-ssh-20250716-123428-qvict-90716.log'
could not be opened because they were referenced by filename only.

Co-authored-by: ibetitsmike <[email protected]>
@ibetitsmike ibetitsmike requested a review from code-asher July 16, 2025 13:47
@code-asher
Copy link
Member

Good catch, seems we accidentally lost the original path.join() when switching to coder ssh.

@code-asher code-asher merged commit 8dee463 into main Jul 17, 2025
2 checks passed
@code-asher code-asher deleted the fix/workspace-log-path-full-path branch July 17, 2025 19:19
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