Skip to content

fix: get the fork's CI green on master - #3

Merged
gustavosbarreto merged 4 commits into
masterfrom
fix/ci-green
Nov 4, 2026
Merged

gustavosbarreto merged 4 commits into
masterfrom
fix/ci-green

Conversation

@geovannewashington

@geovannewashington geovannewashington commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Summary

master fails four checks before any PR is applied. This PR fixes all four, one commit each.

 govulncheck
-  go1.25.10 can't install govulncheck v1.9.0, and x/crypto v0.54.0 is reachable by 3 advisories
+  go 1.26.10, x/crypto v0.58.0, the same versions shellhub/agent uses
 lint
-  lint-sync replaced .golangci.yml and dropped the fork's exclusions: 47 issues
+  wrapcheck and noctx exclusions restored, nestif scoped to server.go, lint-sync deleted
+  G115 has no blanket exclusion: client window sizes clamp, bounded ports and exit codes get a reasoned nolint
 workflows
-  charmbracelet/meta@main, PAT passed but unset, dependabot-sync failing weekly
+  meta pinned to 2031836b, PAT removed from build and coverage, dependabot-sync deleted
 windows pty
-  closeSlave is a no-op, so the drain never sees EOF and every session waits the 5s timeout
+  closeSlave closes the pseudo console; the pty reads a duplicate of the output handle until EOF

A client asking for a pty wider than 65535 columns used to get width mod 65536. A 70000-column request set 4464. Sizes now clamp to 65535.

On Windows, ConPTY's output ends only when the pseudo console closes. The drain added in 17dd395 waited for an EOF that never came, so every pty session took 5s to close. Output still unread when the timeout closed the pty was lost. The pty now reads through its own duplicate of the output handle, so the library still closes each of its handles once. Before Windows 11 24H2, ClosePseudoConsole blocks until the output is read, so the close runs in a goroutine and Close discards the rest.

Evidence

  • Before: golangci-lint v2.9 reports 47 issues. govulncheck v1.9.0 reports GO-2026-6355, GO-2026-6354 and GO-2026-6303 as reachable from handleConn. Under a 70000×70000 pty, stty size prints 4464 4464. On the Windows runner:
    --- FAIL: TestPtySessionClosesBeforeTheDrainTimeout (5.08s)
        session took 5.0199765s to close, the drain timeout is 5s
    WARN ssh: gave up waiting for the pty to drain timeout=5s   (7 times)
    
    After: golangci-lint reports 0 issues for linux, windows and darwin. govulncheck reports 0 reachable vulnerabilities. TestPtyClampsAnOversizedWindowToTheTerminalMaximum gets 65535 65535. On Windows the package passes in 4.1s, down from 29.1s, with no drain timeouts. That includes the 200 KB burst test. The Linux suite passes with -race, and the burst test passes 50 runs with -count=50. actionlint passes on the workflows.

macOS has not run here. GitHub could not acquire a macOS runner ("capacity constraints"), so those jobs need a re-run before merge.

Merge Danger

Door: two-way

The go 1.26.10 directive means a consumer needs Go 1.26.10 or newer. shellhub/agent already requires it.

Blast Radius: Windows pty sessions

On Windows, closing the pseudo console now ends processes still attached to it. On Unix, a lingering process keeps running. Release still calls meta's goreleaser with the PAT, now pinned, and only a tag can test it. Nothing reaches a device until shellhub/agent bumps the fork. Merge this before #2, which falls under the restored lint rules after a rebase.

Closes shellhub-io/team#378

v0.54.0 is reachable from handleConn by GO-2026-6355, GO-2026-6354 and
GO-2026-6303. Go 1.25 also blocked govulncheck v1.9.0 from installing in
CI. Both versions now match shellhub/agent.

Refs: shellhub-io/team#378
@coveralls

coveralls commented Nov 3, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 41707071380

Coverage decreased (-0.09%) to 72.334%

Details

  • Coverage decreased (-0.09%) from the base build.
  • Patch coverage: 8 uncovered changes across 2 files (12 of 20 lines covered, 60.0%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
pty_unix.go 15 10 66.67%
tcpip.go 3 0 0.0%
Total (4 files) 20 12 60.0%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
pty_unix.go 1 71.53%

Coverage Stats

Coverage Status
Relevant Lines: 1435
Covered Lines: 1038
Line Coverage: 72.33%
Coverage Strength: 836.65 hits per line

💛 - Coveralls

lint-sync dropped the fork's exclusions. wrapcheck and noctx are back,
since the fork passes x/crypto/ssh errors through and opens server
sockets with no request context, and nestif only for server.go's accept
backoff. G115 stays on: client window sizes clamp to 65535 instead of
wrapping, a control character above 255 is ignored, and bounded ports
and exit codes carry a reasoned nolint.

Refs: shellhub-io/team#378
Calling meta@main ran whatever charmbracelet pushed with our secrets.
The workflows now pin meta's main as of 2026-11-01. lint-sync is gone,
since it replaced our lint config, and dependabot-sync needs a PAT the
fork does not have. Only release still passes that PAT.

Refs: shellhub-io/team#378
ConPTY output ends only when the console closes, and closeSlave did
nothing on Windows, so every session waited five seconds and dropped
what was unread. closeSlave now closes the console and the pty reads a
duplicate of the output handle, so the copy reaches EOF and each handle
closes once. Before Windows 11 24H2 the close blocks until the output is
read, so it runs in a goroutine and Close discards the rest.

The drain tests ran /bin/sh, which Windows lacks. The burst test uses
PowerShell there and counts x bytes, since ConPTY adds escape sequences.

Fixes: shellhub-io/team#378
@geovannewashington
geovannewashington marked this pull request as ready for review November 3, 2026 19:59
@gustavosbarreto
gustavosbarreto merged commit 3ee2eec into master Nov 4, 2026
25 of 29 checks passed
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.

4 participants