Skip to content

fleet gh: keep cache-serve alive — serve() joins the accept thread (code#10742) - #10826

Merged
dezren39 merged 1 commit into
mainfrom
queue/17509-10742-gh-cache-daemon
Nov 16, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/17509-10742-gh-cache-daemon

Conversation

@dezren39

@dezren39 dezren39 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

What

fleet gh cache-serve could never stay up. gh_cache::serve() delegated to serve_on(), which spawns the accept loop on a background thread and returns immediately; serve() then fell through to its "listener failed; exiting" path and the process died — bound, printed the failure line, exited, before answering a single request.

Found live 2026-11-16 while verifying the #10742 acceptance proof (task 17509): built the merged binary from main, ran fleet gh cache-serve --bind 127.0.0.1:4802, and cache-status stayed DOWN with exactly that bind-then-die log. The loopback test exercises serve_on directly, so the defect shipped green in #10815.

Fix

  • serve_on now returns the accept thread's JoinHandle alongside the cache.
  • serve() joins the accept thread: it returns (via the failure exit) only when the accept loop actually breaks.

Tests (oracle: the daemon entry point, not just serve_on)

  • New serve_entry_point_stays_up_and_caches: spawns the real serve() on a free port, drives it with real TCP clients — first call mints once, second is served from the daemon cache (mint count stays 1), and serve() is still running while its listener is healthy.
  • cargo test -p fleet --bin fleet: 50 tests — all gh_cache tests pass (7/7); one unrelated flake (gh::tests::write_not_repeated_on_unknown_failure, ETXTBSY on its fake-gh script under load) passes on solo re-run.
  • cargo test -p fleet-config --lib untouched by this change.

Live proof (laptop, binary built from this branch)

  • cache-status before daemon: DOWN (connection refused) on both configured addresses.
  • Daemon up, fresh: entries=0 hits=0 misses=0.
  • Three repeat fleet gh api user calls through the daemon: entries=1 hits=2 misses=1 — one mint, repeats served from cache, no re-mint.
  • Daemon stopped: DOWN again — nothing persists (memory-only, per the fleet gh: credential/token caching daemon for sandbox and laptop #10742 proposal).

Refs #10742 (already closed by #10815; this is the defect that made its daemon leg unusable, found by its self-closing checker task 17509).


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…stead of falling through to its failure exit (code#10742)
@dezren39
dezren39 requested a review from a team as a code owner November 16, 2026 16:19
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T16:19:49.997334Z
We couldn’t complete this review. Comment @codex review to try again.
137f353 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bae820ef-6d3c-47e1-80c9-61b83f92a447
Commits

Reviewing files that changed from the base of the PR and between 95ef2ba and 137f353.

Files selected for processing: 1

  • pkgs/fleet/crates/fleet/src/gh_cache.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 merged commit 0fe413c into main Nov 16, 2026
1 check passed
@dezren39
dezren39 deleted the queue/17509-10742-gh-cache-daemon branch November 16, 2026 16:21
@dezren39 dezren39 added the audit:complete PR fully implemented spawning issue label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit:complete PR fully implemented spawning issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant