Skip to content

feat(ui): GitHub PR management panel for github-linked virtualmcps - #3138

Merged
tlgimenes merged 113 commits into
mainfrom
tlgimenes/github-pr-panel
Apr 23, 2026
Merged

tlgimenes merged 113 commits into
mainfrom
tlgimenes/github-pr-panel

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

What is this contribution about?

Adds a GitHub PR management panel to the thread UI for virtualmcps linked to a GitHub repo. When a vm has metadata.githubRepo set, the Instructions tab is replaced with a Git tab that shows a branch picker in the header and renders the appropriate state for the selected branch: empty / create-PR CTA / open PR with squash-merge & rebase actions / merged or closed summary. All actions are dispatched as natural-language messages to the agent (via message-templates.ts), which then executes them through its GitHub tools or the BASH + git CLI for history-rewriting ops.

To support branch-scoped daemons, threads now carry a nullable branch column (migration 068) wired through threads storage, thread create/update tool schemas, the decopilot stream endpoint, and VM_START — which records a per-branch daemon in a new vmMap metadata structure on the virtualmcp.

Screenshots/Demonstration

UI changes — screenshots to follow in review.

How to Test

  1. Run bun run dev and open a thread attached to a virtualmcp that has metadata.githubRepo configured.
  2. Use the branch picker in the virtualmcp header to pick or create a branch; confirm the Git tab replaces Instructions and shows the correct state (no-PR / open / merged).
  3. Push commits on a branch, click Create PR, then verify open-state actions (Squash & merge, Rebase on main, Close PR) dispatch the expected agent prompts.

Migration Notes

Requires running Kysely migrations: bun run --cwd=apps/mesh migrate (adds nullable branch column to threads).

Review Checklist

  • PR title is clear and descriptive
  • Changes are tested and working
  • Documentation is updated (if needed)
  • No breaking changes

Summary by cubic

Adds a Git tab with a PR panel and branch‑scoped VMs for GitHub‑linked virtualmcps. Threads pin to a branch; VMs are keyed by vmMap[userId][branch], auto‑start when missing, and the header shows a single next action (e.g., Save changes, Submit for review, Publish).

  • New Features

    • Branch picker: choose from your vmMap branches and repo branches, stores ?branch=, persists across task switches and new threads, defaults to deco/<adj>-<noun>; the branch is saved on first message; GitHub‑linked threads open on the Git tab (coercing ?main=instructions).
    • Branch‑scoped VMs: per‑user/per‑branch entries live in vmMap[userId][branch] with { vmId, previewUrl }; VM_START accepts/generates a branch, records the entry, and auto‑starts on thread open when missing; Env/Preview resolve from vmMap; a shared SSE provider streams branch-status snapshots with headSha; API/stream accept branch; VM_DELETE targets a specific branch.
    • PR panel: Description, Changes, and Checks sub‑tabs; per‑check Re‑run; the thread header shows a single next‑action — Save changes, Submit for review, Reopen, Sync with {base}, Fix tests, Mark ready, Address feedback — or a Publish split‑button with a Review option. Reads use the unified pull_request_read tool. Merged PRs are terminal until the branch advances; then “Submit for review” returns. A repo‑environment prompt is injected so the agent explores the repo with filesystem/shell tools and uses GitHub MCP tools for PR ops.
  • Migration

    • Run Kysely migrations to add nullable branch to threads: bun run --cwd=apps/mesh migrate.

Written for commit 6383287. Summary will update on new commits.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions

github-actions Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Release Options

Suggested: Minor (2.272.0) — based on feat: prefix

React with an emoji to override the release type:

Reaction Type Next Version
👍 Prerelease 2.271.1-alpha.1
🎉 Patch 2.271.1
❤️ Minor 2.272.0
🚀 Major 3.0.0

Current version: 2.271.0

Note: If multiple reactions exist, the smallest bump wins. If no reactions, the suggested bump is used (default: patch).

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 issues found across 34 files

You’re at about 92% of the monthly review limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/mesh/src/tools/vm/start.ts">

<violation number="1" location="apps/mesh/src/tools/vm/start.ts:242">
P1: When `branch` is provided but no vmMap entry exists, the code still reuses `activeVms[userId]`, which can attach the thread to a VM from a different branch.</violation>
</file>

<file name="apps/mesh/src/tools/vm/daemon.ts">

<violation number="1" location="apps/mesh/src/tools/vm/daemon.ts:267">
P0: Validate/sanitize `injectedBranch` before using it in `execSync` command strings to prevent shell command injection.</violation>

<violation number="2" location="apps/mesh/src/tools/vm/daemon.ts:271">
P1: The new remote-branch detection is unreliable after `--single-branch` clone and can create a local branch from the wrong commit instead of checking out the intended remote branch.</violation>
</file>

<file name="apps/mesh/src/web/components/thread/github/message-templates.ts">

<violation number="1" location="apps/mesh/src/web/components/thread/github/message-templates.ts:38">
P2: Require `prNumber` in PR-action template parameter types; current `Pick` keeps it optional and can generate `PR #undefined` prompts.</violation>

<violation number="2" location="apps/mesh/src/web/components/thread/github/message-templates.ts:58">
P1: Quote or escape branch/base values in shell command instructions; unquoted interpolation can let special-character branch names alter executed commands.</violation>
</file>

<file name="apps/mesh/src/web/views/virtual-mcp/header-info.tsx">

<violation number="1" location="apps/mesh/src/web/views/virtual-mcp/header-info.tsx:20">
P2: Validate `metadata.githubRepo` against current VM connections before rendering `BranchPicker`; using raw metadata here can expose a stale/removed GitHub connection and break branch/PR actions.</violation>
</file>

<file name="apps/mesh/src/web/layouts/main-panel-tabs/use-main-panel-tabs.ts">

<violation number="1" location="apps/mesh/src/web/layouts/main-panel-tabs/use-main-panel-tabs.ts:146">
P2: GitHub-linked VMs can still resolve to `instructions`, but that tab was removed from the header, so the panel and tab bar get out of sync.</violation>
</file>

<file name="apps/mesh/src/web/layouts/shell-layout.tsx">

<violation number="1" location="apps/mesh/src/web/layouts/shell-layout.tsx:131">
P1: Don't copy `branch`/`main` into every task navigation. This helper is also used when selecting an existing task, so it leaks the previous thread's Git branch and active tab into the new thread.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread apps/mesh/src/tools/vm/daemon.ts Resolved
Comment thread apps/mesh/src/tools/vm/start.ts Resolved
Comment thread apps/mesh/src/tools/vm/daemon.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 issues found across 15 files (changes from recent commits).

You’re at about 94% of the monthly review limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/mesh/src/web/components/thread/github/decode-html-entities.ts">

<violation number="1" location="apps/mesh/src/web/components/thread/github/decode-html-entities.ts:24">
P2: Validate numeric entity code points before calling `String.fromCodePoint` to avoid runtime `RangeError` on malformed/out-of-range entities.</violation>
</file>

<file name="apps/mesh/src/web/components/thread/github/panel-state.ts">

<violation number="1" location="apps/mesh/src/web/components/thread/github/panel-state.ts:25">
P2: Don't treat missing PR data as `no-pr`; the async query can still be loading or errored, so this misrenders the GitHub panel until the request resolves.</violation>
</file>

<file name="apps/mesh/src/web/components/thread/github/header-actions.tsx">

<violation number="1" location="apps/mesh/src/web/components/thread/github/header-actions.tsx:42">
P2: `usePrByBranch` can be enabled with empty GitHub connection/repo params, causing invalid PR fetch attempts before the non-GitHub guard returns.</violation>

<violation number="2" location="apps/mesh/src/web/components/thread/github/header-actions.tsx:62">
P3: This `no-branch` check is unreachable dead code because `branch` is already guarded as truthy above.</violation>
</file>

<file name="apps/mesh/src/web/components/thread/github/git-tab.tsx">

<violation number="1" location="apps/mesh/src/web/components/thread/github/git-tab.tsx:119">
P1: Rendering PR body with `MemoizedMarkdown` allows untrusted raw HTML from PR descriptions to be parsed in-app. Keep PR body as plain text or sanitize before rendering.</violation>
</file>

<file name="apps/mesh/src/web/components/thread/github/comments-accordion.tsx">

<violation number="1" location="apps/mesh/src/web/components/thread/github/comments-accordion.tsx:42">
P1: Decoding HTML entities on untrusted PR comment text before markdown rendering can enable XSS.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@tlgimenes
tlgimenes force-pushed the tlgimenes/github-pr-panel branch from 4809f22 to 26033d0 Compare April 22, 2026 15:11

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 8 files (changes from recent commits).

You’re at about 96% of the monthly review limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/mesh/src/web/layouts/main-panel-tabs/tab-id.ts">

<violation number="1" location="apps/mesh/src/web/layouts/main-panel-tabs/tab-id.ts:119">
P2: The ext-app fallback can still return `"instructions"` in GitHub mode because `declaredTabIds[0]` is not coerced to `"git"`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 19 files (changes from recent commits).

You’re at about 97% of the monthly review limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/mesh/src/tools/vm/branch-name.ts">

<violation number="1" location="apps/mesh/src/tools/vm/branch-name.ts:119">
P2: The fallback branch space is too small; collisions will eventually make unrelated VM_STARTs share the same Git branch/vmMap entry. Add a unique suffix (for example a thread/user id or a short time/UUID component).</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread apps/mesh/src/shared/branch-name.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

You’re at about 99% of the monthly review limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/mesh/src/tools/vm/daemon.ts">

<violation number="1" location="apps/mesh/src/tools/vm/daemon.ts:277">
P1: `git fetch origin <branch>:<branch>` can fail for the default checked-out branch, causing false "branch absent" handling and incorrect setup warnings.

(Based on your team's feedback about cloning/fetching the intended branch safely.) [FEEDBACK_USED]</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread apps/mesh/src/tools/vm/daemon.ts Resolved
tlgimenes and others added 22 commits April 22, 2026 21:27
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Adds optional branch input to VM_START
- Daemon receives injectedBranch, attaches to origin/<branch> if it exists
  on the remote; otherwise creates a new local branch
- Domain key includes branch (when provided) so different branches for the
  same user get distinct preview domains
- After vm creation, writes vmMap[userId][branch] = vmId
- Lookup prefers vmMap[userId][branch] when branch is injected, falling back
  to activeVms for branch-unaware callers

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
StreamRequestSchema accepts optional branch. Routes pass it to streamCore.
createMemory persists it on the thread when the thread is created for the
first time; existing threads keep their branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Reads available branches from vmMap (yours) + github-mcp-server.list_branches
(others). "+ New branch" sub-form invokes create_branch synchronously.
Selected branch is stored in ?branch=... URL param, injected into message
metadata on sendMessage so the server persists it on first-message thread
creation and forwards to VM_START.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
github-mcp-server returns branches as a stringified JSON in content[0].text
rather than structuredContent. Accept both shapes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- New "git" tab with git-branch icon when metadata.githubRepo is set
- GitTab renders 3 states: no branch, no PR yet, PR open, PR merged/closed
- Primary actions (Create PR / Squash & merge / Rebase / Close) call
  sendMessage with natural-language templates; LLM executes via its
  github tools
- PR data fetched via useMCPToolCallQuery (list_pull_requests, 60s poll)
- Parses both structuredContent and content[0].text tool-result shapes
- Instructions tab preserved for non-github vms — zero regression

Scoped MVP: single view, no sub-tabs (Changes/Checks/Comments deferred),
no header action buttons (buttons render inside the tab for now).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ntext)

MainPanelContent renders as a SIBLING of ActiveTaskProvider inside
ChatMainPanelGroup, so useChatStream/useOptionalChatStream return null
there. Switch GitTab to useChatBridge and extend ChatBridgeValue to
expose isStreaming so action buttons still disable during a turn.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Agent was asking clarifying questions because prompts didn't specify the
repo. Each template now leads with "On repo `owner/repo`, …" so the
agent can act immediately.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ates

GitHub MCP tools like update_pull_request_branch perform merge-of-base
rather than true rebase, so rebase/resolve-conflicts/create-PR templates
now instruct the agent to use the BASH tool with git in the vm's working
tree. PR-level ops (close, reopen, merge) keep using GitHub MCP tools.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Creating a new task from the tasks panel previously dropped ?branch and
?main URL params, forcing the user to re-select the branch and re-open
the git tab. Preserve both so the new thread inherits the prior state.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
useChatBridge previously returned bridgeRef.current captured at
ChatContextProvider's first render — always BRIDGE_NOOP when a consumer
rendered before ActiveTaskProvider registered the real sendMessage.

Now the context holds the RefObject and useChatBridge returns wrappers
that read .current at call time. Consumers get the latest sendMessage /
isStreaming even when the bridge is registered later.

Fixes GitTab buttons silently no-op'ing on a fresh task page load.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
tlgimenes and others added 2 commits April 22, 2026 21:27
- Primary button label: "Squash & merge" → "Merge" (still squash-merge
  under the hood)
- Drop "Rebase and merge" and "Merge commit" dropdown items plus their
  unused mergeRebase / mergeCommit templates
- Dropdown now contains only "Review PR"

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Drops git-jargon labels in favor of outcome-focused ones:

- Commit & Push          → Save changes
- Reopen PR              → Reopen
- Create PR              → Submit for review
- Rebase on {base}       → Sync with {base}
- Fix checks             → Fix tests
- Waiting for checks     → Running tests…
- Mark ready for review  → Mark ready
- Resolve review comments → Address feedback
- Waiting for review     → Awaiting review
- Merge                  → Publish
- Review PR (dropdown)   → Review

Action identifiers in the selector stay the same; only the display
strings change. Unit tests updated (17/17 passing).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@tlgimenes
tlgimenes force-pushed the tlgimenes/github-pr-panel branch from e317a75 to 5deeab4 Compare April 23, 2026 00:28
tlgimenes and others added 25 commits April 22, 2026 21:36
github-mcp-server consolidated several per-action tools into a single
`pull_request_read` dispatched by a `method` arg. The old tool names
(`get_pull_request_files`, `list_check_runs`, `get_pull_request`,
`get_issue_comments`) are no longer exposed — calls return
`MCP error -32602: Tool not found` and our select() fell back to empty
results, silently hiding real data.

Observable fallout:
- PR sub-tabs showed "Changes 0" even when files existed.
- HeaderActions saw empty check/review data and always fell through to
  "Publish" regardless of actual CI/draft/approval state.

Changes:
- usePrFiles, useChecks, usePrComments → pull_request_read with the
  matching method ("get_files"/"get_check_runs"/"get_comments").
- usePrReviews → pull_request_read with method:"get".
- All args switched to camelCase (pullNumber, perPage).
- useChecks signature: headSha → prNumber (the new tool takes the PR
  number, not the commit SHA). ChecksTab and HeaderActions updated.
- usePrFiles derives `deletions` from `changes - additions` since the
  new response shape only includes `changes`.

Verified in-browser: "Changes 1" shown for PR #11 with the single
bun.lock file.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Wraps the right-side cluster in inline-flex + items-center so the
LinkExternal01 icon aligns with the numeric counts instead of sitting on
the text baseline.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…n header

The branch and PR number now ride alongside the vMCP title in the main
Toolbar's center column, visible across every main-panel tab instead of
only on the Git tab's sub-view.

- VirtualMcpHeaderInfo extends the center cluster with a branch chip
  (links to GitHub branch page) and a PR chip (#N + external-link,
  single click-target to pr.htmlUrl). Both are gated on the github-linked
  branch state; the PR chip hides when the PR is merged to stay
  consistent with the next-action selector treating merged as "no PR".
- git-tab.tsx drops the topbar above PrSubTabs (state C) and the
  mini-header above the "no PR" explanation (state B). Closed/merged
  summary (state D) unchanged — its body already carries the status.
- Copy tweak: state B mentions the new "Submit for review" button label.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The branch name is now a non-interactive span; only the PR #N chip is
still a link (opens the PR on GitHub). Middle-dot separators are
replaced by plain flex `gap-3` spacing.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
PR sub-tabs (TabsList underline) was 52px; dev-panel header row was
implicit 31px. Both now explicit 40px, matching the main app Toolbar
height for visual cohesion across the three header rows.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Matches the TabsTrigger[variant=underline] styling exactly:
- text-sm (was text-xs), drop font-medium
- h-full px-3 (was px-3 py-1.5) so the row controls vertical alignment
- border-b-2 mb-[-1px] so the active-tab underline overlaps the
  container's border-b (matching PR sub-tabs). Previously the 2px
  underline sat above the 1px container border, producing a visible
  double line.

Also aligns the `+` add-script button to the same h-full vertical
rhythm. `capitalize` stays since the tab labels come from lowercase
data keys ("setup", "dev", "daemon").

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Three shifts:

1. Decisive tone. Imperative one-liners. No more "You may call..." or
   "For each, do X: ...". Templates go from ~300 chars → ~60-100.

2. Drop environmental boilerplate. Owner, repo, branch, base are
   already in the agent's env (system prompt, VM cwd); stop restating
   them in every prompt. Most templates become zero-arg.

3. Don't ask, execute. The new <repo-environment> paragraphs tell the
   agent that short imperative git/PR actions from the user are a
   button click — authenticated intent, not a question. Skip
   user_ask. This overrides the default <safety> rule for this
   context, so merges/rebases/force-pushes don't get second-guessed.

Also moves the "git CLI for code ops, GitHub MCP for PR ops" rule
(and the `update_pull_request_branch` caveat) from the per-template
GIT_CLI_PREAMBLE into buildRepoEnvironmentPrompt, where it's stated
once and applies universally.

Template signatures simplify:
- commitAndPush, createPr, reopenPr, rebaseOnBase, markReadyForReview,
  resolveReviewComments, reviewPr, mergeSquash → ()
- fixChecks({ failingChecks }), rerunCheck({ checkName })

Callers (HeaderActions, MergeSplitButton, ChecksTab) drop now-unused
args. Tests updated (10/10 passing).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ick intent

Templates now include the specific PR number (for PR-level actions) and
branch name (for git ops) where the UI has them. This saves the agent
the discovery round-trip it would otherwise need — PR# normally requires
a `list_pull_requests` call; branch can be derived from the VM but
including it removes any ambiguity.

Every template also carries a short per-prompt reinforcement: "The user
clicked this action deliberately — execute directly. Do not call
user_ask unless you hit an actual problem outside the scope of this
intent (missing auth, unresolvable conflict, a check with multiple
plausible fixes)." This is belt-and-suspenders alongside the
<repo-environment> override already in the system prompt.

Signatures tightened: all templates take exactly the ctx they need
(prNumber, branch, or checkName + prNumber, etc.). HeaderActions,
MergeSplitButton, and ChecksTab updated. 11 tests passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Squash-merging into main doesn't reset origin/<branch> — its pre-merge
commits stay put, while main gets a single new squash commit. So git's
rev-list --left-right sees the branches as divergent and the daemon
reports aheadOfBase > 0 even though the work shipped.

Before: selector saw `aheadOfBase > 0 && pr.merged`, fell into
`!pr || pr.merged` branch, and offered "Submit for review" — as if the
user should open a second PR for the same work.

Now: short-circuit to null as soon as `pr.merged` is true. The work is
done; user starts a new branch to do more. If someone really does push
new commits to a merged branch and wants a new PR for them, they can
type it in the chat — not a common enough flow to warrant a UI path.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ast a merged PR

Previous fix short-circuited merged PRs to null regardless of whether
new commits had been pushed after the merge — too blunt. Now:

1. Daemon adds `headSha` (current HEAD sha of origin/<branch>) to the
   branch-status SSE payload.
2. BranchStatus type + parser carry it through.
3. Selector compares branchStatus.headSha against pr.headSha when
   pr.merged is true:
   - Same sha → null (branch is exactly where it was merged — done)
   - Different sha → "Submit for review" (branch advanced post-merge;
     propose a new PR for the new work)

This covers the flow: user merges PR #11, then pushes a new commit to
the same branch to make a follow-up change — the button now re-appears
as expected.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
GitHub-linked vMCPs: Connections → Automations → Layout → Terminal →
Preview → git. Previously git led the list.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…el top

Three coordinated moves to make the git context feel minimal:

1. The git tab's label is now the current branch name (falls back to
   "git" when no branch is selected). Clicking the tab was already the
   user's way to see branch detail; making the label the branch makes
   the breadcrumb self-evident.

2. The main header center drops the branch chip and the PR# chip. Only
   the vMCP icon+title remain there. The center column gets its
   breathing room back.

3. Inside the git panel, a new PrHeader row (h-12, border-b) renders
   "PR #N ↗" prominently above the sub-tabs / merged summary. Single
   link — click to open the PR on GitHub. The older "Open PR #N on
   GitHub" button in the merged state is removed (the new header
   supersedes it).

No PR → no PrHeader; the existing "No pull request yet" body stands on
its own.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Previously preview.tsx, env.tsx, and use-branch-status.ts each opened
their own EventSource to /_decopilot_vm/events. On reloads the old
connections didn't always release before new ones opened, backing up
against the daemon's MAX_SSE_CLIENTS cap and leaving branchStatus stuck
at null — which made the selector hide the Publish button until a
manual VM restart.

Now:
- VmEventsProvider (added in a prior commit) owns exactly one
  EventSource per previewUrl and fans out to all consumers via React
  context. Chunk subscribers register through a Set-backed registry.
- useVmEvents() is argless and just reads the context.
- useVmChunkHandler(handler) registers per-consumer PTY chunk
  subscriptions with stale-closure safety via a ref.
- useBranchStatus() collapses to `useVmEvents().branchStatus`.
- HeaderActions drops its direct session/userId plumbing (the provider
  does the vmMap → previewUrl derivation once, at the layout level).

The provider mounts inside Chat.Provider in agent-shell-layout for
both desktop and mobile, so all VM-event consumers are always inside
one shared scope.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Splits refreshAccessToken into its own file so mock.module can intercept
calls made from inside refreshAndStore, and adds proactive refresh to
buildCloneInfo so the daemon's git clone no longer fails when the stored
token has expired between VM_START calls.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Without this scope the MCP SDK's authorize request omits both `scope` and
`prompt=consent`, and downstream OAuth servers (e.g. sites-github-mcp)
don't issue a refresh_token. The resulting token row in downstream_tokens
has null refresh_token / null expires_at and can never be proactively
refreshed — forcing users to reconnect whenever the token goes stale.

Applied at every authenticateMcp call site in apps/mesh/src/web.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Merges ChatContextProvider + ActiveTaskProvider into one Chat.Provider
that takes virtualMcpId + taskId as props. Hoists Suspense + ErrorBoundary
above the provider so the full content area (header portals, chat, main
panel) skeletons together on task switch. key={taskId} forces full
remount, rebuilding DefaultChatTransport per task.

Drops chatContent indirection in ChatMainPanelGroup; ChatCenterPanel
renders directly inside. Deletes ActiveTaskBoundary helper (suspense
duties migrated up).

Bridge ref retained for compatibility until consumers migrate
(see next commit).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- useChatTask re-export in chat/index.tsx was redundant; all consumers
  import from ./context directly.
- PENDING_MESSAGE_TTL_MS is only used inside pending-message-context.tsx.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@tlgimenes
tlgimenes merged commit 4689f6c into main Apr 23, 2026
15 checks passed
@tlgimenes
tlgimenes deleted the tlgimenes/github-pr-panel branch April 23, 2026 20:42
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