Repository navigation
feat(daemon): qq daemon run --detach, status, stop and restart - #440
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffe3d22df4
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
acf891c to
8109667
Compare
8109667 to
be9b934
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be9b934550
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…losing A second foreground host waited on the running host's lock and failed; it now reports the running server. qq daemon stop returned while a host that had stopped listening still held the store; it now waits for the host lock.
be9b934 to
3dc777d
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
1 similar comment
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Stacked on #431. This is the first half of P1 task 2 (daemon lifecycle). Bare
qqis unchanged: it still embeds its server. Switching it to start or attach to the daemon comes in the next stacked PR, after the trust route lands.What changed for users
qq daemon run [--bind] [--allow-origin]: the same server asqq serve, under the daemon name.qq daemon run --detach: starts this binary as a background process and returns once the daemon serves. If a daemon is already running, it reports that one instead. The background process:/rather than the directory you started it in;daemon.login the server state directory.qq daemon status: prints the address, pid, version, protocol, server id and log path. Exits 1 when no daemon is running.qq daemon stop: asks the daemon to stop, then waits until it has closed the session store, not just until the listener is gone. When it returns,qq runcan open the store. It refuses to stop a server embedded in an interactiveqqand tells you to quit thatqqinstead.qq daemon restart: stop, then a detached start of the current binary. The store identity (server_id) is kept.qq serveandqq daemon runnow stop on SIGTERM, not only SIGINT or Ctrl-C, and settle runs the same way in every case. Before this, SIGTERM killedqq servewithout settling.qq serveand the daemon readapproval_timeout_secondsfrom global and managed configuration only, not from the directory they were started in.--approve-self-contained-read-image) are accepted bydaemon runandrestart, and passed on to the detached process.How it works
POST /v1/daemon/shutdown:202with itsServerInfo, then the host stops.ServerOptions::with_stop_routeserve it. A TUI's embedded server answers404.PROTOCOL_VERSIONis unchanged, and older servers answer404too.SessionClient::request_stopcalls the route.host.lockis held from before the runtime opens until after it closes.wait_until_releasedletsstopreturn only once the store is closed.acquire_host_locklets a new host wait for a previous one that is still closing, instead of failing on a busy store.qq serveandqq daemon runshare a single host loop in the newsrc/daemon.rs.Verification
cargo xtask checkpasses against refactor(host): move runtime composition from the binary into qq-host #431.tests/daemon_lifecycle.rsdrives the real binary in an isolated home:server_id;stoprefusing an embedded server.request_stopdecoding and the404from an embedded server.cargo xtask smoke: 11/11, includingserve-sse.Known gaps (next PR)
qqstill embeds its server, and quitting it still cancels its runs.ensure_daemonneeds the TUI's "trust for this session" answer to reach the daemon, so that comes with the trust route.