Skip to content

feat(cli): let a supervising process bound qq serve by its stdin - #313

Closed
Facilier wants to merge 1 commit into
mainfrom
feat/serve-stdin-lifetime-and-shared-login
Closed

Facilier wants to merge 1 commit into
mainfrom
feat/serve-stdin-lifetime-and-shared-login

Conversation

@Facilier

@Facilier Facilier commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

One small engine change that lets another process on the same host supervise a qq serve it started. It is a prerequisite for the desktop app (stacked PR, proposed in ADR-0065) and stands on its own.

Changes

  • qq serve --exit-on-stdin-close (feat(cli)): the server also shuts down cleanly when standard input reaches end-of-file or fails, alongside Ctrl-C. A supervisor that starts the server with a piped stdin bounds its lifetime by holding the pipe; when the supervisor exits, even abnormally, the OS closes the pipe and the server settles its runtime and removes its discovery record. Stdin is read on a dedicated thread (console stdin has no portable async reader). Without the flag, behavior is unchanged. Documented in docs/guide/cli.md.

Earlier revisions also moved the built-in login table into qq-auth. Main's provider table (#368/#373/#376, ADR-0064) made that unnecessary: the desktop now reads qq_config::builtin_providers() directly, so that commit was dropped when this branch was rebased onto main.

Compatibility

No protocol, descriptor, store-schema, or configuration change. No new dependencies; the root Cargo.lock is untouched.

Verification

Rebased onto main at 9f97be2f.

  • cargo fmt --all -- --check; cargo clippy -p qq --all-targets reports nothing in the changed files.
  • cargo test --bin qq on Windows 11: 276 passed. The 10 failures are Windows-environment issues already on main (CRLF checkouts in docs_truth, verbatim temp paths in runtime tests), not this change; Linux CI is unaffected.
  • qq serve --exit-on-stdin-close exercised by the desktop app: closing the app stops its server.

🤖 Generated with Claude Code

@Facilier
Facilier requested a review from lg2m October 19, 2026 20:01
Facilier added a commit that referenced this pull request Oct 20, 2026
Brings in main via #313's branch and adapts the desktop app:
- ADR renumbered 0062 -> 0064: main accepted a different ADR-0062 (full
  LTO, #315) and ADR-0063 while this PR was open. The file, its index row,
  the root ledger reservation (next free 0065) and the desktop references
  move to 0064; a ledger entry records the renumbering.
- The desktop core handles main's new StateEffect::CheckInterruptionChanged
  like the TUI: a warning while an interrupted goal completion check holds
  the workspace, and a notice when it is acknowledged. Test snapshots gain
  main's new `goal` and `check_interruption` fields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`qq serve --exit-on-stdin-close` also shuts the server down cleanly when
standard input reaches end-of-file or fails, alongside Ctrl-C. A process
that starts the server with a piped stdin (a desktop app, an editor
extension, a test harness) then bounds its lifetime by holding the pipe:
when the supervisor exits, even abnormally, the OS closes the pipe and
the server settles its runtime and removes its discovery record instead
of lingering. Stdin is read on a dedicated thread because console stdin
has no portable async reader. Without the flag, behavior is unchanged.

Documented in docs/guide/cli.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Facilier
Facilier force-pushed the feat/serve-stdin-lifetime-and-shared-login branch from fb55aab to 91c46cf Compare October 20, 2026 20:37
@Facilier Facilier changed the title feat(cli,auth): supervised serve lifetime and a shared login table feat(cli): let a supervising process bound qq serve by its stdin Oct 20, 2026
@Facilier

Facilier commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

Included in #314.

@Facilier Facilier closed this Nov 3, 2026
@Facilier
Facilier deleted the feat/serve-stdin-lifetime-and-shared-login branch November 3, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant