thv: Stop on a Foreground Process Removes the Workload
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 300
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 184
Description
Bug description
Running thv stop on a workload started by thv run --foreground causes the workload to be removed from thv list --all results.
This is perceived as a bug, because stop is effectively acting as rm.
Steps to reproduce
thv run --foreground --name fetch-foreground fetch- In another shell:
thv stop fetch-foreground - Observe
thv list --alldoes not containfetch-foreground
Expected behavior
There are multiple acceptable behaviors:
thv stopcannot be run on foreground workloadsthv stopdoes not remove the state for the foreground workload, but stops it. In other words,thv list --allcontainsfetch-foregroundand it is in astoppedstatus.
Actual behavior
thv stop behaves like thv rm when executed against foreground workloads.
Environment (if relevant)
- OS/version: Mac Version 15.4.1
- ToolHive version: v0.6.11-42-g2b6a4a76
Additional context
This PR contains significant prior art: https://github.com/stacklok/toolhive/pull/2927#pullrequestreview-3553421250
The problem is the --foreground process acts as the owner of the workload and will always remove the workload when it exits. This can be seen in the logs below:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the lifecycle with thv run --foreground --name fetch-foreground fetch, then run thv stop fetch-foreground and inspect thv list --all. Read the prior art in PR #2927 and trace how the foreground owner handles exit. Done means stop either rejects foreground workloads or leaves them listed with a stopped status.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100