Repository navigation
Include SSH logs in workspace diagnostics - #372
Merged
Merged
Conversation
Currently, workspace log collection includes only the generated support bundle and omits local CLI SSH logs needed to investigate connection failures. This commit adds an SSH log collector that reads the directory resolved by the CLI manager and copies matching session and rotated logs into workspace diagnostics. The collector applies a three-day cutoff and retains the last 50 MiB per file to limit archive size. The remote environment supplies its known SSH process ID so the collector includes the active log regardless of age without repeating process discovery. The support bundle collector now continues SSH log collection after bundle failures, and the diagnostic collectors include the matching session ID in warnings when available. The README documents the included files and fixed limits, while regression tests cover directory resolution, log selection, truncation, cancellation, and failure handling. - resolves https://linear.app/codercom/issue/JET-34
fioan89
requested review from
EhabY,
aqandrew,
code-asher,
jeremyruppel and
matifali
October 15, 2026 21:17
code-asher
approved these changes
Oct 16, 2026
| internal fun supportsKeyringStorage(os: OS?): Boolean = os == OS.MAC || os == OS.WINDOWS | ||
|
|
||
| /** Resolves the log directory used by `coder ssh`, including its XDG state directory default. */ | ||
| internal fun getSshLogDirectory( |
Member
There was a problem hiding this comment.
What if we set --log-dir on the proxy command? That would remove the need to sniff out what dir the cli would use, and it could be nice to keep the Jetbrains connection logs in a separate dir.
And while the cli probably will not change the default location, it would protect us against such a change.
And maybe best of all, it would work for older clis that still do not log by default (although this could also be a downside because it would predate the cleanup as well...).
Collaborator
Author
There was a problem hiding this comment.
Asher if you are ok with this, I'll explore in a separate PR this approach.
matifali
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, workspace log collection includes only the generated support bundle and omits local CLI SSH logs needed to investigate connection failures.
This commit adds an SSH log collector that reads the directory resolved by the CLI manager and copies matching session and rotated logs into workspace diagnostics. The collector applies a three-day cutoff and retains the last 50 MiB per file to limit archive size. The remote environment supplies its known SSH process ID so the collector includes the active log regardless of age without repeating process discovery.
The support bundle collector now continues SSH log collection after bundle failures, and the diagnostic collectors include the matching session ID in warnings when available. The README documents the included files and fixed limits, while regression tests cover directory resolution, log selection, truncation, cancellation, and failure handling.