feat(sessions): plumbing for create session changes - #600
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 (13)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughThe CreateSession RPC contract now uses SessionConfig plus WireContribution, and responses are tagged as Ready or Pending. The session manager, SSH RPC path, client callers, examples, tests, and documentation were updated to use the new shapes. ChangesCreateSession RPC refactor
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/sessions.rs`:
- Around line 271-277: The CreateSessionMsg handling in sessions.rs is
discarding contribution unconditionally, which lets non-empty phase-1 data be
silently ignored while still returning Ready. Update the CreateSessionMsg /
session creation flow to validate contribution before persisting the session: if
contribution is not the default/empty value, return InvalidInput instead of
proceeding, and only allow it to pass once the Phase 2 path in the session
creation logic is ready to consume it.
🪄 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: ef2d7e82-16e5-40ef-9584-85947f4e10ab
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (13)
crates/minimal2/src/main.rscrates/minimald-rpc/Cargo.tomlcrates/minimald-rpc/src/lib.rscrates/minimald/src/exec.rscrates/minimald/src/rpc.rscrates/minimald/src/session.rscrates/minimald/src/sessions.rscrates/minimald/src/sftp.rscrates/minimald/src/test_harness.rscrates/minvmd/examples/exec.rscrates/minvmd/tests/minimald_session_e2e.rscrates/sessions/docs/COMPOSITION.mdcrates/sessions/src/lib.rs
79e68ad to
8dd0d66
Compare
Plumbing for the unified
CreateSessionflow. The wire shape nowcarries both the out-of-band session config and the client's Phase 1
contribution; the existing empty-contribution fast path is preserved
for internal callers (sftp, exec, session-recovery).
SessionConfig { name, project_path, network, policy, attrs }in
minimald-rpc.usernamedeliberately omitted — sourced fromthe SSH connection context on the daemon side.
CreateSessionRequestbecomes{ config, contribution };contributionis#[serde(default)]so internal callers don'tneed to know about it.
CreateSessionResponsebecomes an enumReady { id } | Pending { id, response }. OnlyReadyis reachable today;Pendingiswire-defined so adding Phase 2 routing later isn't a wire change.
ManagerMessage::CreateSessionto carryconfig + username + contribution + responder. Empty-contribution
path assembles a
Record, validates policy, persistsActive,returns
Ready { id }— byte-equivalent to the old behavior.ssh_usernamefrom the connection lock and threadsit to
serve_create_session.create_session_req,unwrap_ready) centralized intest_harness.SessionStatusgets a forward-compat rustdoc note about theupload-driven state-machine evolution.
Summary by CodeRabbit
New Features
ReadyvsPending), improving clarity for clients and examples.Bug Fixes
Readyis accepted (treatingPendingas an error).Documentation