• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 23589745915
65%

Build:
DEFAULT BRANCH: main
Ran 26 Mar 2026 10:38AM UTC
Jobs 1
Files 584
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

26 Mar 2026 10:33AM UTC coverage: 65.282% (-0.01%) from 65.294%
23589745915

push

github

web-flow
Wire server discovery protocol into thv serve (#4319)

* Wire server discovery protocol into thv serve

The discovery package (pkg/server/discovery/) was already implemented
and tested but had zero imports in the codebase. This wires it into
the serve command so clients (CLI, Studio) can auto-discover a running
server without hardcoded ports or environment variables.

On startup, thv serve now generates a cryptographic nonce, writes a
discovery file to $XDG_STATE_HOME/toolhive/server/server.json with
the actual listen URL (supporting port 0 and Unix sockets), and
returns the nonce via the X-Toolhive-Nonce health check header. On
shutdown the file is removed.

The skills client now tries discovery before falling back to the
TOOLHIVE_API_URL env var or the default localhost:8080, with loopback
and socket-path validation on discovered URLs.

Additional fixes: SIGTERM handling in the serve command, a 30-second
shutdown timeout (was unbounded), symlink rejection on the discovery
file read path, directory permission tightening after MkdirAll, and
constant-time nonce comparison.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>

* Address review feedback on server discovery

- Wrap writeDiscoveryFile check-then-write in WithFileLock to prevent
  TOCTOU race when two servers start simultaneously
- Log FindProcess errors at Debug level instead of silently discarding
- Consolidate ListenURL tests into a table-driven test
- Rename healtcheck_test.go to healthcheck_test.go (fix typo)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>

* Create discovery directory before acquiring lock file

The discovery lock file is created in the same directory as
server.json, but the directory may not exist on a fresh system.
MkdirAll was called inside the lock callback (via WriteServerInfo),
but the lock acquisition itself needs th... (continued)

155 of 299 new or added lines in 14 files covered. (51.84%)

15 existing lines in 6 files now uncovered.

52009 of 79668 relevant lines covered (65.28%)

65.08 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
20.83
0.0% cmd/thv/app/skill_build.go
1
15.91
0.0% cmd/thv/app/skill_info.go
1
37.5
0.0% cmd/thv/app/skill_install.go
1
15.79
0.0% cmd/thv/app/skill_list.go
1
23.08
0.0% cmd/thv/app/skill_push.go
1
45.45
0.0% cmd/thv/app/skill_uninstall.go
1
13.51
0.0% cmd/thv/app/skill_validate.go
2
62.5
8.65% pkg/api/v1/healthcheck.go
3
12.5
0.0% cmd/thv/app/skill_helpers.go
8
90.59
pkg/server/discovery/health.go
19
48.65
pkg/server/discovery/discover.go
20
82.18
-9.09% pkg/skills/client/client.go
24
60.0
pkg/server/discovery/discovery.go
61
13.84
-0.1% pkg/api/server.go

Uncovered Existing Lines

Lines Coverage ∆ File
1
12.5
0.0% cmd/thv/app/skill_helpers.go
1
82.18
-9.09% pkg/skills/client/client.go
2
71.43
-1.68% pkg/vmcp/k8s/manager.go
2
51.71
-0.19% pkg/workloads/manager.go
3
71.85
-1.11% pkg/ignore/processor.go
6
76.15
-5.5% pkg/secrets/keyring/keyctl_linux.go
Jobs
ID Job ID Ran Files Coverage
1 23589745915.1 26 Mar 2026 10:38AM UTC 584
65.28
GitHub Action Run
Source Files on build 23589745915
  • Tree
  • List 584
  • Changed 19
  • Source Changed 11
  • Coverage Changed 12
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #23589745915
  • 6b0ff322 on github
  • Prev Build on main (#23589427612)
  • Next Build on main (#23590683587)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc