feat: auto-detect runtime mode on kild open#377
Merged
Conversation
Owner
Author
PR Review SummaryCritical Issues (0 found)None. Important Issues (1 found — fixed)
Type Design (6.75/10)
Resolution: Extracted nested Test Coverage Gaps (2 critical — fixed)
Documentation Updates
Strengths
VerdictREADY TO MERGE — all issues addressed, all tests pass. |
When a daemon-created kild is stopped and reopened with `kild open`, it now automatically reopens in daemon mode without requiring the `--daemon` flag. - Add `runtime_mode: Option<RuntimeMode>` to Session struct (persists across stop/start via `#[serde(default)]`) - Set runtime_mode during `create_session` based on resolved mode - Change `open_session` to accept `Option<RuntimeMode>` where `None` triggers auto-detection: explicit flag > session stored mode > config > Terminal default - Add `resolve_explicit_runtime_mode` CLI helper that returns `None` when no flags passed (vs `resolve_runtime_mode` which always resolves) - UI actions pass `None` for auto-detect instead of hardcoded Terminal Closes #297
Document auto-detection behavior where kild open now uses the session's stored runtime_mode by default, only using config or flags when explicit overrides are provided. Resolution chain: --daemon/--no-daemon flag > session's stored mode > config > Terminal default
Extract the nested unwrap_or_else cascade into resolve_effective_runtime_mode() which returns (RuntimeMode, source) for clearer logging. The source now distinguishes "config" from "default" instead of lumping both as "default". Add unit tests for all 4 resolution branches (explicit, session, config, default) and a persistence test verifying runtime_mode survives stop + reload.
Clarify doc comment on Command::OpenKild.runtime_mode to distinguish CLI-level semantics (no flag passed) from Session-level semantics (legacy session). Add runtime_mode: None variants to store contract test and both serialization round-trip tests.
48970fe to
fc1efe4
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.
Summary
kild openwithout requiring--daemonruntime_modeon Session struct, persists across stop/start--daemon/--no-daemonflag > session's stored mode > config > Terminal defaultkild open --allrespects per-session mode independentlyTest plan
cargo fmt --checkpassescargo clippy --all -- -D warningspassescargo test --allpassescargo build --allpasseskild create foo --daemon→kild stop foo→kild open fooreopens in daemonkild open foo --no-daemonoverrides stored daemon modeCloses #297