Skip to content

Stop remote workloads whose proxy is still running - #7328

Merged
ChrisJBurns merged 2 commits into
mainfrom
fix-stop-auth-retrying-remote
Nov 26, 2026
Merged

ChrisJBurns merged 2 commits into
mainfrom
fix-stop-auth-retrying-remote

Conversation

@ChrisJBurns

Copy link
Copy Markdown
Collaborator

Summary

thv stop on a remote workload marks it stopped and removes its client configuration only when the workload is running or unhealthy. A remote workload's proxy also keeps running while it is starting, auth_retrying (token refresh is retrying in the background) or unauthenticated (token monitoring has stopped, but the proxy keeps serving and rejecting requests). In those states a stop killed the proxy but skipped the status and client cleanup. The workload kept its old status, and clients stayed configured against a proxy that no longer exists. The unhealthy case was fixed in #4844; this applies the same fix to the other statuses where the proxy is still running.

  • Add remoteProxyActive, which lists the statuses a remote proxy keeps running in, and use it to decide whether a stop goes through the stopping → stopped transitions and client cleanup.
  • Update the workload lifecycle doc and diagram.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

TestRemoteProxyActive pins the active and inactive statuses. The stop tests now cover starting, unhealthy, auth_retrying and unauthenticated going through stopping → stopped. Linting is left to CI because the local golangci-lint crashes on the Go 1.27 toolchain.

Does this introduce a user-facing change?

Yes.

  • Before: thv stop on a remote workload in starting, auth_retrying or unauthenticated stopped its proxy, but the workload kept that status and its client configuration.
  • After: the workload is marked stopped and its client configuration is removed, as for a running workload. thv start / thv restart then treat it like any stopped workload.

Special notes for reviewers

Container workloads are unaffected; this only changes stopRemoteWorkload. Freeing an orphaned proxy's port when the status is missing or inactive is unchanged.

🤖 Generated with Claude Code

Stopping a remote workload marked it stopped and removed its client
configuration only when it was running or unhealthy. In starting,
auth_retrying or unauthenticated its proxy is still running too, so a
stop killed the proxy but left the old status and client entries
pointing at a dead endpoint. Treat every status the proxy keeps
running in as active.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label Nov 26, 2026
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.25%. Comparing base (c038d02) to head (cbfd1db).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pkg/workloads/manager.go 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7328      +/-   ##
==========================================
- Coverage   82.27%   82.25%   -0.02%     
==========================================
  Files         935      935              
  Lines       95159    95298     +139     
==========================================
+ Hits        78288    78384      +96     
- Misses      16866    16909      +43     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

rdimitrov
rdimitrov previously approved these changes Nov 26, 2026
The exhaustive linter requires every WorkloadStatus case in the switch.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Nov 26, 2026
@ChrisJBurns
ChrisJBurns merged commit 4062c71 into main Nov 26, 2026
47 checks passed
@ChrisJBurns
ChrisJBurns deleted the fix-stop-auth-retrying-remote branch November 26, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants