Skip to content

CL-6463: Settle the code-review template's GitHub connect card on out-of-band credentials - #207

Merged
TheGreatAxios merged 3 commits into
mainfrom
cl-6463-cross-surface
Aug 21, 2026
Merged

TheGreatAxios merged 3 commits into
mainfrom
cl-6463-cross-surface

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

The owner's symptom: connecting GitHub on the Plugins page showed connected there, but the in-room GitHub connect card never advanced.

Root cause (confirmed by path trace, not re-diagnosed here): settleConnectedService (packages/chat/src/connect-pending.ts) — the one function every connector-completion route (POST /connections/:connectorId/complete, OAuth callback, MCP preset) calls through the hub's onConnected hook — only ever cleared the generic connections/pending key. The code-review template's own GitHub card registers under a second, template-owned key, template/pendingConnections (@corbits/workflow-catalog), which settleConnectedService never touched. A second gap compounded it: the client-side fold meant to read that key off a live chat.settings event (applyConnectGithubSettingsEvent, connect-github-stream.ts) had zero call sites outside its own test — nothing in production ever wired it in.

Fix

Picked option (a): unified both keys into the one settleConnectedService mechanism rather than standing up a second settle path — "a connector became connected" is one event; it should have one place that tells every room waiting on it, not two parallel key conventions.

  • packages/chat/src/connect-pending.ts: settleConnectedService now checks both connections/pending and template/pendingConnections per room, clearing whichever matched, in the same settings patch + single chat.settings publish + single resume message.
  • Deleted packages/chat-ui/src/blocks/connect-github-stream.ts (and its test) — applyConnectGithubSettingsEvent was dead code with no production caller; kept it around would have been the exact "two parallel mechanisms" problem this fix is supposed to remove. Updated the doc comments in chat-ui/workflow-catalog that described it as already wired.
  • Left PR CL-6463: Fix connect-github card never flipping to connected on its own submit #205's card-refresh-on-own-submit behavior untouched (complementary, not overlapping).

What this does and doesn't fix

  • The GitHub connect card's server-side "connected?" read (GET .../github/state) resolves off the real stored credential, never off template/pendingConnections — so this setting was never what gated the card's own connected/disconnected render. What it does gate is the room's agent resuming the parked code-review setup task, via the same resume-message mechanism connections/pending already used — that path was fully broken for GitHub before this fix (a credential connected out of band never posted the resume message into a template room at all).
  • Not verified live: neither connections/pending nor template/pendingConnections today has any live client-side subscriber — both ConnectGithubActions/ConnectServiceActions implementations in apps/web only fan an update out to a mounted card after their own actions (submit/start-reviewing/skip), never off a real chat.settings SSE push (confirmed: chat-workspace.tsx's stream switch has no chat.settings case at all). So a card sitting mounted in a room while a credential is connected on a different tab/page will still only pick up the new state on its next remount, not instantly. That live-push gap is real and pre-existing for both connect flows, not something this PR introduces or fixes — flagging it rather than silently leaving it unverified.
  • No live/manual proof this run — a peer reviewer should verify against a running stack before merging.

Test plan

  • New test in packages/chat/test/connect-pending.test.ts seeds a room with template/pendingConnections: ["github"] (no connections/pending at all) and asserts settleConnectedService clears it, publishes chat.settings, and posts the resume message — confirmed failing against pre-fix code, passing after.
  • bun test clean in packages/chat (127 pass), packages/chat-ui (649 pass), packages/workflow-catalog (87 pass).
  • tsc --noEmit clean in all three touched packages.
  • bun run lint clean from repo root (0 errors; pre-existing warnings unrelated to this change).
  • Live/manual verification against a running stack — not done this run (memory-constrained sandbox; another lane holds the live slot).

DO NOT MERGE — needs a peer review pass, including the live-proof gap called out above.

…room

Proves a credential completed outside the connect-github card's own
submit (e.g. the Plugins page) settles a room whose card registered
under the code-review template's own `template/pendingConnections`
key — fails against today's settleConnectedService, which only ever
looks at `connections/pending`.
CL-6463: a credential connected anywhere other than the in-room GitHub
card's own submit (the Plugins page, another tab) never reached that
card, because settleConnectedService only ever cleared the generic
connect-service key (connections/pending) — the code-review template's
GitHub card registers under a second, template-owned key
(template/pendingConnections) that this settle path never touched.

Rather than stand up a second settle function for that one key, this
folds it into the same settleConnectedService call: a connector
becoming connected is one event, and every room waiting on it settles
through one mechanism, not two parallel key conventions.
CL-6463: applyConnectGithubSettingsEvent (connect-github-stream.ts) had
zero call sites outside its own test — createChatConnectGithubActions
(the only ConnectGithubActions implementation) never wired it in;
subscribeConnectState only ever fans out after its own actions run.
With settleConnectedService now the one place that settles a
connector for every waiting room (previous commit), this fold has no
role left to wire it into, so it's dead code rather than a second
mechanism worth keeping alive. Updates the doc comments across
chat-ui/workflow-catalog that described it as already wired.
@TheGreatAxios
TheGreatAxios merged commit c057207 into main Aug 21, 2026
0 of 2 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-6463-cross-surface branch August 25, 2026 15:29
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.

1 participant