flue close: end sessions from the CLI - #106
Merged
Merged
Conversation
karngyan
force-pushed
the
holder-6-close
branch
from
August 19, 2026 05:52
3e36d14 to
a1fb18b
Compare
karngyan
force-pushed
the
holder-6-close
branch
from
August 19, 2026 08:58
a1fb18b to
b512c4d
Compare
karngyan
force-pushed
the
holder-6-close
branch
from
August 19, 2026 09:04
b512c4d to
cf7bbce
Compare
karngyan
force-pushed
the
holder-6-close
branch
from
August 19, 2026 09:54
cf7bbce to
51981f5
Compare
karngyan
force-pushed
the
holder-6-close
branch
from
August 19, 2026 09:58
51981f5 to
c011203
Compare
karngyan
force-pushed
the
holder-6-close
branch
from
August 19, 2026 10:12
c011203 to
e126dfb
Compare
Holder-backed sessions outlive the daemon, so stopping it stopped being a way to end them. flue close is the deliberate verb: --all retires every session on the local daemon, ids retire the named ones, and unknown ids are reported by name without failing the rest. The semantics live on the registry (CloseAll, CloseByID), mirroring Reap: victims leave the map under r.mu, are closed outside it, and their meta files go with them. The daemon translates POST /api/sessions/close — behind withAuth, named in methodPolicy — into those calls, and the CLI owns argv, output, and exit codes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
karngyan
force-pushed
the
holder-6-close
branch
from
August 19, 2026 10:14
e126dfb to
f183f99
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR6 of the holder-sessions stack (#100–#104).
Why
Holder sessions no longer die with the daemon — that is the whole point of the stack — but it leaves a gap: there is no deliberate way to end them.
flue restart, killing the daemon, even a reboot of the daemon process all leave every shell running. For dev loops and cleanup, "end it all now" needs a verb of its own.The endpoint
POST /api/sessions/close, behindwithAuthand named inmethodPolicy's postable list, with the handler narrowing back to POST-only the wayhandleEnroldoes. The body is{"all":true}or{"ids":["…"]}; both set is an all-close (the wider instruction subsumes the narrower), neither is a 400. The reply is{"closed":N,"missing":[…]}— an unknown id lands inmissingrather than failing the batch.The semantics live on the registry:
CloseAll()andCloseByID(id)mirrorReap's choreography — victims leave the map underr.mu, are closed only after it is released, and each closed session's meta file is deleted so names and tags do not linger. The handler only translates HTTP into those calls.The CLI
flue close --all— closes every session, running and exited, no retention window.flue close <id>...— closes the named ones; each unknown id is reported by name on stderr, the rest are closed anyway, exit 1.flue close— usage error listing both forms, exit 2.daemon not running; nothing to close, exit 0.Output is the enable-style
✓ closed N sessions, singular when N is 1. Daemon discovery goes throughourDaemon()(runtime record + PID ownership + probe), and the request mirrorsfetchSessions: token in a header, status checked before decoding, body bounded.Tests
internal/session:TestCloseAllRetiresEverySession,TestCloseByIDRetiresOnlyTheNamedSession,TestCloseByIDUnknownIsNotFound.internal/daemon:TestSessionsCloseAllClosesEverything,TestSessionsCloseByIDClosesTheNamedOneAndReportsTheRest,TestSessionsCloseWithBothFieldsMeansAll,TestSessionsCloseWithNeitherFieldIsRefused,TestSessionsCloseRequiresAuth,TestSessionsCloseRefusesGET.cmd/flue:TestRunCloseAllClosesEverySession,TestRunCloseByIDClosesOnlyTheNamedOne,TestRunCloseReportsUnknownIDs,TestRunCloseWithNoArgumentsIsAUsageError,TestRunCloseSaysDaemonNotRunning,TestUsageMentionsClose— against a realdaemon.Serverover httptest, the way the enable/update tests fake one.go test ./...green,gofmtclean on every touched file.🤖 Generated with Claude Code