Skip to content

Upgrade gohawk to v0.5.0 and close pipes when setPipes fails - #159

Merged
ernestrc merged 2 commits into
unstablebuild:mainfrom
kojah:upgrade-gohawk-v0.5.0
Sep 30, 2026
Merged

ernestrc merged 2 commits into
unstablebuild:mainfrom
kojah:upgrade-gohawk-v0.5.0

Conversation

@kojah

@kojah kojah commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #122. Upgrades gohawk to v0.5.0 (from v0.3.5) in the pre-commit hook and lint workflow, and fixes a pipe leak in setPipes that the upgrade would report.

Changes:

  • Close pipes when os.Pipe fails in setPipes. When the second or third call fails, earlier pipes are now closed before returning the error.
  • Add regression test that exercises both failure cases and verifies earlier pipes are closed.
  • Remove exitpolicy from the disabled analyzers (removed in gohawk v0.5.0, which rejects unknown analyzer names).

Testing:

  • go test -race ./internal/workspace/workspacessh/
  • gohawk v0.5.0: 0 findings with this change; 4 pipe-leak findings without (213 of 218 packages analyzed; GUI packages skipped due to missing X11 headers)

@codecov-commenter

codecov-commenter commented Sep 28, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/workspace/workspacessh/scheme.go 95.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

kojah and others added 2 commits September 30, 2026 13:40
gohawk v0.5.0 tracks both ends of os.Pipe and reports that setPipes
leaks the pipes it already opened when a later os.Pipe call fails. Close
them before returning the error. v0.5.0 also removed the exitpolicy
analyzer and rejects its name, so drop it from the disabled list.

Signed-off-by: James Ko <[email protected]>
connectScheme released the remote and its six pipe fds only when the remote exited
before serving. A failed preflight, NewSession, StartCommand or grpc.Dial returned
without closing them, so every maintainConnection retry leaked an SSH connection,
and a failed dial left the stderr reader blocked. Release both from one deferred
cleanup until the monitor goroutine takes ownership.

gohawk v0.5.0 retires seven analyzers: borrowedstorage, channelsafety, evalorder,
exitpolicy, inlineerror, oncepolicy and syncmapatomicity, so -enable-all now runs
five instead of up to eleven. Pin the pre-commit hook to the v0.5.0 commit because
tags can move.

Signed-off-by: ernestrc <[email protected]>
Co-Authored-By: Rune Agent (claude/claude-opus-5-5) <[email protected]>
@ernestrc
ernestrc force-pushed the upgrade-gohawk-v0.5.0 branch from eabcc2a to cc68ac4 Compare September 30, 2026 11:43
@ernestrc
ernestrc enabled auto-merge (rebase) September 30, 2026 12:03
@ernestrc
ernestrc merged commit cc34d79 into unstablebuild:main Sep 30, 2026
8 checks passed
@kojah
kojah deleted the upgrade-gohawk-v0.5.0 branch September 30, 2026 12:47
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.

3 participants