fix(auth): negotiate RPC v2 before interactive login

Merged
KA
3mo ago
+13-1

Follow-up to #3. The utility RPC fix covered \

  • get_available_models\nbut the dedicated interactive login flow still called waitReady() -> login without negotiating RPC v2 first. This aligns login with every other production RpcProcess startup path:\n\n\n waitReady()\n negotiateProtocol()\n login\n\n\nFixes the latent 1 MiB transport-limit edge case for unusually large OAuth/UI frames and adds a regression test (lib/api-contract.test.mjs) that asserts waitReady -> negotiateProtocol -> login ordering.\n\nVerified: npm test (337 passed, 4 skipped), tsc --noEmit, eslint.

Summary by cubic

Interactive login now negotiates RPC v2 before sending the login command, aligning it with other RpcProcess startup paths. Previously it called waitReady() then login, which could hit the 1 MiB transport limit on large OAuth/UI frames; now it does waitReady → negotiateProtocol → login.

  • app/api/auth/login/[provider]/route.ts: capture the result of waitReady and call negotiateProtocol before sending the login command.
  • lib/api-contract.test.mjs: add a regression test that asserts the waitReady → negotiateProtocol → login ordering.
  • No config or migration changes; behavior of other startup paths is unchanged.