Agent pane: relay selected session auth preflight

Closed
TE
8d ago
+237-8

The composer cannot preflight sign-in evidence through the native pane relay because _acpmux/session/auth is not allowed. This narrow carrier lets the complementary web consumer #26643 query the daemon without treating a transport error as an auth state.

Leo: "we also want to be having that modal picker situation, like be able to surface, say, like, Oh, you gotta re-authenticate. You gotta log in again on the modal picker before the user even sends a prompt."

The relay accepts exactly one of sessionId or target { harness, host?, routeId? }, plus an optional real JSON boolean refresh. Extra and duplicate/aliased keys, malformed nested targets and both/neither identity forms are refused. Session-form queries stay in the pane's session scope. Target hosts must be present in the native daemon peer snapshot; a remote wire binds only its native route's machine. Unknown hosts or an unavailable snapshot fail closed. Connection-generation checks prevent an old open callback from installing its peer set on a replacement connection.

The daemon's typed reply and sessionAuth capability pass through unchanged, including null host/route values, evidence source/time and person-initiated login instructions. This PR never executes a login command, changes an auth state, adds a transport-to-auth fallback or broadens a method group.

Daemon dependencies are merged separately:

  • #26658: 988565e335cd9757675c369ed17fdb4813ece269
  • #26699: 5b6ffb3bad9cc89724d165874a3195fd7067a3eb
  • #26700: 3df910676575996070884251b947b4a1274e1809
  • #26845: 1f723c64fe2a70709ac21b88f10f4bc8bfdf0823

The consumer must gate on the exact sessionAuth feature. Feature absence means unknown and no auth RPC. refresh: true requests only the daemon's documented non-keychain auth check.

Validation at 9b9c2d707b684a32dbe2d739bbfcecbe98e31c00:

  • Seven-file source/test diff, +237/-7; git diff --check passes.
  • Static source assertions pass; 35 embedded JSON literals decode.
  • Six native test methods are authored for exact session/target schema, duplicate/aliased keys, read-only request policy, native peer membership, full auth reply/initialize-feature preservation, and pane session isolation. All six are UNEXECUTED.
  • Primary static source review ACK is recorded for this exact head. Independent review and native verification remain separate outstanding gates.
  • No UI change or capture; no Swift parsing, native tests, compile, build or CI dispatch was run.

No capture: no UI change; this PR changes only native relay/validation code with no rendered surface.

Agent session: agent session


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Allows the composer to preflight sign-in evidence through the native pane relay by permitting _acpmux/session/auth frames without executing logins or changing auth state.

  • The relay accepts exactly one identity form: a sessionId or a target { harness, host?, routeId? }, plus an optional real JSON boolean refresh.
  • Duplicate/aliased keys, malformed nested targets, and both-or-neither identity forms are refused.
  • Session-form queries stay scoped to the pane; target hosts must appear in the native daemon peer snapshot or the request fails closed.
  • The daemon's typed auth reply and sessionAuth capability pass through unchanged.
  • After the base merge, the duplicate params binding in sessionRefusal and the test #expect(Comment:) call were fixed so the target compiles.