fix(infinity-daemon): add keeps_session_alive flag - #90
Merged
Conversation
Deploying infinity with
|
| Latest commit: |
71470ed
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f71f9962.infinity-dc7.pages.dev |
| Branch Preview URL: | https://feat-keeps-session-alive.infinity-dc7.pages.dev |
akainth015
force-pushed
the
feat/keeps_session_alive
branch
from
July 30, 2026 21:16
042335f to
71470ed
Compare
shadaj
approved these changes
Jul 30, 2026
| /// Subscribe request: (client_tx, want_replay). | ||
| pub type SubscribeRequest = (mpsc::UnboundedSender<DaemonMessage>, bool); | ||
| /// Subscribe request: (client_tx, want_replay, keeps_session_alive). | ||
| pub type SubscribeRequest = (mpsc::UnboundedSender<DaemonMessage>, bool, bool); |
Member
There was a problem hiding this comment.
Should turn this into a struct with field name.
| thread_id: &str, | ||
| msg: (InputMessage, Option<String>), | ||
| client_tx: Option<mpsc::UnboundedSender<DaemonMessage>>, | ||
| client_tx: Option<(mpsc::UnboundedSender<DaemonMessage>, bool)>, |
akainth015
force-pushed
the
feat/keeps_session_alive
branch
from
July 30, 2026 21:38
71470ed to
de6322a
Compare
…nteractive clients from blocking idle shutdown Add a `keeps_session_alive` boolean field to `ClientMessage::CreateSession` and `ClientMessage::Connect` (defaulting to `true` via serde for backward compat). Connections that set this to `false` are tracked but do not prevent the session from idling out — enabling persistent but passive client connections (e.g. bots) that should not keep sessions warm indefinitely. Key changes: * `infinity-protocol`: new `keeps_session_alive` field on `CreateSession` and `Connect`, with `#[serde(default = "default_true")]`. * `client_handler.rs`: tracks `connection_keeps_alive` per connection and threads it through `attach_client` and `send_input`. * `session/thread_worker.rs`: replaces bare `UnboundedSender` subscriber lists with a `Subscriber` struct carrying `tx` + `keeps_session_alive`. Idle-exit and has-clients checks now only consider keep-alive subscribers. * `infinity-agent-cli`: all existing call sites pass `keeps_session_alive: true` (preserving current behavior for interactive CLI clients). * `tests/keep_alive.rs`: integration tests covering non-keep-alive idle exit and keep-alive warmth. Co-authored-by: Infinity 🤖 <infinity@hydro.run>
akainth015
force-pushed
the
feat/keeps_session_alive
branch
from
July 30, 2026 23:05
de6322a to
c038739
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.
to prevent non-interactive clients from blocking idle shutdown
Add a
keeps_session_aliveboolean field toClientMessage::CreateSessionandClientMessage::Connect(defaulting totruevia serde for backward compat). Connections that set this tofalseare tracked but do not prevent the session from idling out — enabling persistent but passive client connections (e.g. bots) that should not keep sessions warm indefinitely.Key changes:
infinity-protocol: newkeeps_session_alivefield onCreateSessionandConnect, with#[serde(default = "default_true")].client_handler.rs: tracksconnection_keeps_aliveper connection and threads it throughattach_clientandsend_input.session/thread_worker.rs: replaces bareUnboundedSendersubscriber lists with aSubscriberstruct carryingtx+keeps_session_alive. Idle-exit and has-clients checks now only consider keep-alive subscribers.session/mod.rs: exposes aworker_shutdownCancellationTokenon sessions.send_inputuses a retry loop (up to 2 attempts) to handle the race where the agent loop begins winding down between the restart check and the actual send — inputs arriving mid-wind-down now transparently restart the session.infinity-agent-cli: all existing call sites passkeeps_session_alive: true(preserving current behavior for interactive CLI clients).tests/keep_alive.rs: three integration tests covering non-keep-alive idle exit, keep-alive warmth, and input-after-idle-exit restart.