Skip to content

feat(sessions): wire form types for client/daemon session creation communication - #443

Merged
evanspearman merged 1 commit into
mainfrom
evan/split02
Jun 17, 2026
Merged

feat(sessions): wire form types for client/daemon session creation communication#443
evanspearman merged 1 commit into
mainfrom
evan/split02

Conversation

@evanspearman

@evanspearman evanspearman commented Jun 17, 2026

Copy link
Copy Markdown
Member

Basically title. Having separate JSON friendly primitive types for the communication between the daemon and client seemed like the safest way to go. I have a separate SessionCreate struct mostly to guard against type-related regressions until this gets combined into CreateSession.

Summary by CodeRabbit

  • New Features
    • Added multi-round session-creation RPC flow enabling clients to interact with sessions across multiple rounds.
    • Introduced three new RPC endpoints for creating sessions, submitting verdicts on pending decisions, and aborting in-flight sessions.
    • Enhanced error handling and policy decision types for improved client-daemon communication.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 886cb99d-7188-4c44-8236-94e38ed20bc4

📥 Commits

Reviewing files that changed from the base of the PR and between b3f42b0 and 35641d7.

📒 Files selected for processing (7)
  • crates/minimald-rpc/src/lib.rs
  • crates/sessions/src/core/source.rs
  • crates/sessions/src/wire/errors.rs
  • crates/sessions/src/wire/mod.rs
  • crates/sessions/src/wire/policy.rs
  • crates/sessions/src/wire/primitives.rs
  • crates/sessions/src/wire/request.rs

📝 Walkthrough

Walkthrough

Introduces a complete wire-protocol layer for multi-round client/daemon session creation. Adds JSON-serializable primitive types, a WireError envelope, WireVarVerdict/WirePatchVerdict enums, and the full SessionCreateRequest/ContributionResponse/ContributionVerdict/Abort/SessionStep message set. Registers three new OneshotSshRpc marker structs (SessionCreate, SubmitVerdict, SessionAbort) in minimald-rpc.

Changes

Multi-round session RPC wire protocol

Layer / File(s) Summary
Wire module declaration and primitive types
crates/sessions/src/wire/mod.rs, crates/sessions/src/wire/primitives.rs, crates/sessions/src/core/source.rs
Declares errors, policy, primitives, and request submodules with design-goal docs, then defines all foundational serde-tagged wire primitives: WireSource, WireResolvedVar, WireVarSpec, WireResolvedPatch, WireSessionVar, WireSessionPatch, WireHookScript, WireLifecycleHook, WireProvenancedHook, WirePackageRef, PendingId, WirePendingVar, and WirePendingPatch, with serde round-trip tests.
Wire error envelope
crates/sessions/src/wire/errors.rs
Adds WireError as a serde-tagged enum covering invalid contributions, unsupported protocol versions, unknown session IDs, and an internal catch-all. Adds From<ResolveError> collapsing all local errors to WireError::Internal, tested for round-trip serialization, Display formatting, and the conversion.
Wire policy verdict types
crates/sessions/src/wire/policy.rs
Adds WireVarVerdict and WirePatchVerdict serde-tagged enums for client-to-daemon per-item decisions with Approved/Denied/Ignored variants keyed by PendingId, including serde round-trip tests.
Session RPC request/response messages
crates/sessions/src/wire/request.rs
Defines the full client/daemon RPC message set: SessionCreateRequest, ResolvedContribution, ContributionResponse, ContributionVerdict, Abort/AbortReason, and SessionStep as the top-level response envelope wrapping a round or protocol fault. Includes comprehensive serde round-trip and kind-tag tests.
RPC marker structs
crates/minimald-rpc/src/lib.rs
Registers SessionCreate, SubmitVerdict, and SessionAbort as OneshotSshRpc implementations in the public RPC contract, binding each to a subsystem name under RPC_SUBSYSTEM_PREFIX with sessions::wire::request types and Errorable response wrappers.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant minimald-rpc
  participant Daemon

  rect rgba(70, 130, 180, 0.5)
    note over Client,Daemon: Session open
    Client->>minimald-rpc: SessionCreate (SessionCreateRequest)
    minimald-rpc->>Daemon: forward via OneshotSshRpc
    Daemon-->>Client: Errorable<SessionStep::Round(ContributionResponse)>
  end

  rect rgba(60, 179, 113, 0.5)
    note over Client,Daemon: Verdict rounds
    loop until ContributionResponse.complete == true
      Client->>minimald-rpc: SubmitVerdict (ContributionVerdict)
      minimald-rpc->>Daemon: forward via OneshotSshRpc
      Daemon-->>Client: Errorable<SessionStep::Round> or SessionStep::Fault(WireError)
    end
  end

  rect rgba(205, 92, 92, 0.5)
    note over Client,Daemon: Abort (optional)
    Client->>minimald-rpc: SessionAbort (Abort + AbortReason)
    minimald-rpc->>Daemon: forward via OneshotSshRpc
    Daemon-->>Client: Errorable<()>
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • gominimal/minimal#420: Established the OneshotSshRpc contract and RPC_SUBSYSTEM_PREFIX in crates/minimald-rpc/src/lib.rs that the three new RPC marker structs (SessionCreate, SubmitVerdict, SessionAbort) directly implement.

Suggested reviewers

  • 0chroma
  • norrietaylor

Poem

🐇 Hoppity-hop through the wire we go,
Primitives, verdicts, and errors in tow.
SessionCreate starts the round-trip dance,
SubmitVerdict gives each pending var a chance.
SessionAbort if the warren runs dry—
A JSON-tagged protocol waving goodbye! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the primary change: introducing wire form types for client/daemon session creation communication, which is reflected across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants