Skip to content

fix(tunnelserver): preserve terminal failure status during exit #1798

Closed

Description

@skevetter

Failed CI Run

Run: https://github.com/devsy-org/devsy/actions/runs/42497793118
Job: https://github.com/devsy-org/devsy/actions/runs/42497793118/job/128783846463
Unit Tests (ubuntu-latest), main commit 2d40e32.

Failure Details

TestLifecycleTerminalSuite/TestOversizedInputFrame, pkg/agent/tunnelserver/lifecycle_terminal_test.go:776:

--- FAIL: TestLifecycleTerminalSuite (31.03s)
    --- FAIL: TestLifecycleTerminalSuite/TestOversizedInputFrame
        Error Trace: lifecycle_terminal_test.go:776
        Error: Not equal:
               expected: 0x8 (codes.ResourceExhausted)
               actual  : 0x2 (codes.Unknown)

Root Cause Summary

The owner-side input validator already returns ResourceExhausted. Static investigation found that terminalAttachment.Exit ignores an already-recorded session failure. Cancellation publishes Canceled before canceling the context, allowing Exit to attempt another send on a terminated stream. A send-side io.EOF can then escape as Unknown instead of preserving the receive-side status. The relevant source blobs are unchanged between the failed commit and current main 4165583. Native repeated tests passed 5100/5100, so the race has not been reproduced by sampling; a deterministic regression will verify the error precedence.

Acceptance Criteria

  • Preserve an established session failure when Exit is called, without another stream send.
  • Add deterministic regression coverage that fails before the fix and passes after it; retain the original oversized-frame assertion.
  • Pass go test -v -run TestLifecycleTerminalSuite/TestOversizedInputFrame ./pkg/agent/tunnelserver, race-enabled package checks, mise run cli:format, mise run cli:lint:ci, and mise run cli:test.
  • Applicable CI green on the final PR head, Greptile confidence >=4/5, successful completed CodeRabbit review, and verified signed commits.

Activity

  1. skevetter commented on Nov 8, 2026

    @skevetter
    ContributorAuthor

    Remediation submitted in PR #1799. Head: 64fabb2. Local validation and signed-commit verification completed; hosted CI and reviewer gates are pending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions