feat(minimald): track terminal meta, send in ListSessions RPC - #421
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughThe PR introduces ChangesSession Terminal Attribute Tracking
Sequence Diagram(s)sequenceDiagram
participant Client as RPC Client
participant RpcHandler as serve_list_sessions
participant SessionsMgr as SessionsManager
participant SessionHandle
participant HostActor as HostActor
participant VT100 as VT100Parser
VT100->>VT100: OSC Title event
VT100->>HostActor: SetTitleCallback
HostActor->>HostActor: update attrs.title, attrs.stdout_last
Client->>RpcHandler: ListSessions()
RpcHandler->>SessionsMgr: List request
SessionsMgr->>SessionHandle: get_attrs()
SessionHandle->>HostActor: GetHostAttrs (oneshot)
HostActor->>SessionHandle: Some(HostAttrs)
SessionHandle->>SessionsMgr: Option<HostAttrs>
SessionsMgr->>RpcHandler: Vec<SessionInfo> with attrs
RpcHandler->>RpcHandler: map HostAttrs → RunningSessionAttrs
RpcHandler->>Client: ListSessionsResponse
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
ea8e71f to
2f12145
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/minimald-rpc/src/lib.rs`:
- Around line 115-121: The RunningSessionAttrs struct is missing fields to track
bell attributes (audible and visual bell events), which prevents the
ListSessions wire contract from carrying complete bell metadata despite the
host-side tracking this information. Add bell-related fields to the
RunningSessionAttrs struct following the same pattern as the existing
last_stdout and last_stdin fields, using Option<chrono::DateTime<Utc>> to
capture the last occurrence of audible and visual bell events so the complete
bell metadata can be transmitted through the wire protocol.
In `@crates/minimald/src/session_host.rs`:
- Around line 442-447: The get_attrs method panics when the host actor has
exited due to the recv.await.expect call on a closed channel, which causes actor
tasks to crash instead of gracefully handling the closed host. Change the return
type of get_attrs from HostAttrs to Option<HostAttrs>, and replace the
recv.await.expect call with error handling that returns None when the receiver
channel is closed (i.e., when the host task has already exited). This allows
callers like SessionMessage::GetHostAttrs to handle the None case gracefully
without panicking.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2ed6f18c-0154-422b-9da2-3a16d14c328c
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
Cargo.tomlcrates/minimald-rpc/Cargo.tomlcrates/minimald-rpc/src/lib.rscrates/minimald/Cargo.tomlcrates/minimald/src/rpc.rscrates/minimald/src/session.rscrates/minimald/src/session_host.rscrates/minimald/src/sessions.rs
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/minimald/src/rpc.rs`:
- Around line 92-104: The visual_bell and audible_bell match expressions use
unsafe .unwrap() calls on the timestamp field (a.visual_bell.1 and
a.audible_bell.1) when the count is non-zero, which will panic if the invariant
is violated. Replace both matches with defensive tuple destructuring patterns:
match (a.visual_bell.0, a.visual_bell.1) and match (a.audible_bell.0,
a.audible_bell.1), then handle each case explicitly including the
(non_zero_count, None) case by logging a warning and returning None instead of
unwrapping.
- Around line 99-104: The audible_bell mapping contains an unsafe unwrap on
a.audible_bell.1 that can panic if audible_bell.0 is non-zero but the timestamp
is None. In the match arm where audible_bell.0 is matched to a non-zero value,
apply the same defensive fix pattern that was used for the visual_bell case
above it. Replace the unwrap call on a.audible_bell.1 with appropriate pattern
matching or a safe alternative that handles the None case gracefully without
panicking.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: eb9e9291-ca8b-41ee-8efc-11250d58caef
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
Cargo.tomlcrates/minimald-rpc/Cargo.tomlcrates/minimald-rpc/src/lib.rscrates/minimald/Cargo.tomlcrates/minimald/src/rpc.rscrates/minimald/src/session.rscrates/minimald/src/session_host.rscrates/minimald/src/sessions.rs
✅ Files skipped from review due to trivial changes (2)
- crates/minimald-rpc/Cargo.toml
- Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (5)
- crates/minimald/Cargo.toml
- crates/minimald-rpc/src/lib.rs
- crates/minimald/src/sessions.rs
- crates/minimald/src/session.rs
- crates/minimald/src/session_host.rs
2f12145 to
2fc8e6d
Compare
2fc8e6d to
c3f1d40
Compare
Reports terminal information about a running session, which is super useful to the presentation layer.
Summary by CodeRabbit
Release Notes