-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
coder/coder
#21332Labels
Description
CI Run Link: https://github.com/coder/coder/actions/runs/20291357045
Commit Info: e4f87d5edc9c87b0ffcaa75e9e7129dfabf00e30 by Jake Howell (coder/coder@e4f87d5)
Failure Summary:
- Job: test-go-pg (windows-2022)
- Date: 2025-12-17 04:26 UTC
- Not a matrix cancellation artifact (run_attempt=1; other matrix jobs passed)
Error Analysis (from logs):
=== FAIL: coderd TestAgentConnectionMonitor_StartClose (0.00s)
t.go:106: 2025-12-17 04:20:56.129 [debu] agent connection monitor is closing connection reason=canceled
workspaceagentsrpc.go:314: Unexpected call to *dbmock.MockStore.UpdateWorkspaceAgentConnectionByID([...]) at C:/actions-runner/coder/coder/coderd/workspaceagentsrpc.go:314 because:
expected call at C:/actions-runner/coder/coder/coderd/workspaceagentsrpc_internal_test.go:315 doesn't match the argument at index 1.
Got: {agent=b1d71b58-a096-4d52-9dd5-27364b142b78, replica=36856b31-5ec3-4c38-9808-8b24ac768b23, disconnectedAt={2025-12-17 04:20:56.129223 +0000 UTC true}}
Want: {agent=b1d71b58-a096-4d52-9dd5-27364b142b78, replica=36856b31-5ec3-4c38-9808-8b24ac768b23, disconnectedAt={0001-01-01 00:00:00 +0000 UTC false}, disconnectedAfter={2025-12-17 04:20:56.129223 +0000 UTC true}}
controller.go:97: missing call(s) to *dbmock.MockStore.UpdateWorkspaceAgentConnectionByID(is anything, {agent=b1d71b58-a096-4d52-9dd5-27364b142b78, replica=36856b31-5ec3-4c38-9808-8b24ac768b23, disconnectedAt={0001-01-01 00:00:00 +0000 UTC false}, disconnectedAfter={2025-12-17 04:20:56.129223 +0000 UTC true}})
controller.go:97: aborting test due to missing call(s)
Root Cause Classification: E. Code Change
- Recent changes to agent connection/disconnection recording now set DisconnectedAt on close and update via updateConnectionTimes(). Test expectations still assert withDisconnectedAfter(now) rather than using disconnectedAt, causing gomock expectation mismatch on Windows runner.
- Implementation reference: coderd/workspaceagentsrpc.go around the monitor() close path sets m.disconnectedAt and calls updateConnectionTimes with DisconnectedAt populated.
Precise Assignment Analysis:
- Test file: coderd/workspaceagentsrpc_internal_test.go
- Function: TestAgentConnectionMonitor_StartClose (approx lines 300-360)
- Recent meaningful changes to this test family and component (git log):
- 71c6dc404361b950b3c8fa25fcce89c7e2366cb7 (2025-12-15) Spike Curtis — fix disconnection handling; record disconnect correctly
- f2904726a58178303938ffce2bb040beae5a4c58 (2025-09-26) Spike Curtis — wait for completion before asserting in BuildOutdated; fixes flake flake: TestAgentConnectionMonitor_PingTimeout #970
- 655a36c3921d12d197b1b7eb9ba767d0516b0005 (2025-09-16) Spike Curtis — fix PingTimeout race with mock assertions; fixes flake: TestAgentConnectionMonitor_PingTimeout #970
- b79785c86ffbd8bca1bd1867d93f03c4d36f9542 (2024-02-01) Spike Curtis — move connection monitoring to yamux layer
Given these recent targeted changes by Spike in both the tests and the agent connection monitor, and the fact that the new behavior (DisconnectedAt) originates from 71c6dc4043, assigning to Spike Curtis for triage seems most appropriate.
Data Race / Panic / OOM Evidence:
- None observed in logs for this job. This is a deterministic gomock expectation mismatch; not a race, panic, or infra issue.
Related Issues:
- Closed: flake: TestAgentConnectionMonitor_PingTimeout (flake: TestAgentConnectionMonitor_PingTimeout #970) — similar test family; earlier flake addressed by waiting for monitor completion. This new failure is a different assertion mismatch after recent disconnection handling change.
Proposed Next Steps:
- Update TestAgentConnectionMonitor_StartClose expectations to align with current behavior:
- Expect UpdateWorkspaceAgentConnectionByID to receive DisconnectedAt set when the monitor closes the connection.
- Evaluate whether withDisconnectedAfter is still appropriate or should be replaced by withDisconnectedAt in this path.
- Confirm behavior uniformly across OS runners; Windows surfaced the mismatch here.
Reproduction:
- On Windows (or in a Windows-2022 runner), run:
- make test-go-pg (or)
- go test ./coderd -run TestAgentConnectionMonitor_StartClose -v