Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Jan 14, 2026

Summary

Add link detection and display to the workspace header, with special handling for GitHub PR links.

Features

  • Branch-based PR detection: Automatically detects PR for current branch via gh pr view (no URL argument)
  • Link extraction: Scans assistant text and tool output for URLs (shown in dropdown)
  • PR badge display: Shows workspace's PR as a clickable badge in the workspace header
  • PR status enrichment: Fetches PR state (open/merged/closed), mergeability, and draft status
  • Generic links dropdown: Non-PR URLs displayed in a scrollable dropdown with copy functionality

Architecture

Two separate concerns

  1. PR detection (badge): Branch-based via gh pr view - robust, doesn't depend on chat content
  2. Link extraction (dropdown): Scans chat for URLs - shows relevant links mentioned in conversation

PR detection flow

WorkspaceLinks mounts
  → monitorWorkspace(workspaceId)
  → gh pr view --json ...  (no URL = current branch)
  → PRStatusStore caches result
  → useWorkspacePR(workspaceId) returns PR with status

Link extraction robustness

  • Only scans complete text parts (triggered on tool-call-start or stream-end)
  • Rescans after compaction to catch URLs split across deltas
  • Tracks occurrence count and last-seen timestamp

Design decisions

  • Links derived from message history on load, not persisted to localStorage
  • PR badge comes from branch detection, not from chat-extracted PR links
  • Dropdown sorted by occurrence count (most seen first), then recency

UX Features

  • Copy button on each link in dropdown
  • Hover tooltip shows full URL + "Seen N times · Last seen X ago"
  • Scrollable dropdown (max 10 visible, all accessible via scroll)
  • PR badge shows status icons (draft, checks, mergeability)

Generated with mux • Model: ${MUX_MODEL_STRING:-unknown} • Thinking: ${MUX_THINKING_LEVEL:-unknown} • Cost: $${MUX_COSTS_USD:-unknown}

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7c7e177f1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

CI Status

The test failures in handleCompactCommand are pre-existing issues on main (see run 20999346497 on main which has the same failures). These tests are unrelated to the link feature changes.

Link-related tests all pass locally:

  • src/common/types/links.test.ts - 17 tests
  • src/browser/utils/messages/StreamingMessageAggregator.links.test.ts - 11 tests

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37a8818ebd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62646e5597

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 621b206f05

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

@ammar-agent ammar-agent force-pushed the links-1gg2 branch 14 times, most recently from 0d79e24 to 2b90d9b Compare January 14, 2026 19:39
Add link detection and display to the workspace header:

- Extract links from chat content (user messages, assistant text, tool output)
- Parse GitHub PR URLs into structured data (owner, repo, number)
- Show the most recent PR link as a badge in the workspace header
- Fetch PR status via gh CLI (state, mergeable, merge status, draft)
- Display generic links in a dropdown menu

Link extraction is robust to streaming:
- Only scan complete text parts (on tool-call-start or stream-end)
- Use progress tracking to avoid re-scanning parts
- Deduplicate links by URL

Implementation details:
- Links derived from message history, not persisted to localStorage
- PR status cached with TTL and refreshed on focus
- Single PR link tracked (lastGitHubPRLink) per review feedback
@ammario ammario merged commit 2584f69 into main Jan 14, 2026
20 checks passed
@ammario ammario deleted the links-1gg2 branch January 14, 2026 19:52
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5aaf2cb2f2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +41 to +45
if (mergeStateStatus === "CLEAN") return "text-success";
if (mergeStateStatus === "BEHIND") return "text-warning";

// Prefer check rollup when available; fall back to mergeStateStatus.
if (hasFailedChecks || mergeStateStatus === "UNSTABLE") return "text-danger-soft";

Choose a reason for hiding this comment

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

P2 Badge Respect check rollup before marking PR as clean

The badge logic returns success as soon as mergeStateStatus === "CLEAN", so any hasFailedChecks/hasPendingChecks data from statusCheckRollup is ignored. That means a PR with non‑required checks failing or still running will still show a green check/“ready” even though the rollup says otherwise. The comment says to prefer the rollup, but the ordering makes the rollup unreachable in the CLEAN/BEHIND paths. The same ordering issue exists in StatusIcon below, so both color and icon can be misleading for optional checks.

Useful? React with 👍 / 👎.

Comment on lines +118 to +122
.filter((url) => {
// Filter out malformed URLs that are too short or don't have a domain
try {
const parsed = new URL(url);
return parsed.hostname.includes(".");

Choose a reason for hiding this comment

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

P2 Badge Allow localhost/intranet URLs in link extraction

The hostname filter parsed.hostname.includes(".") drops valid URLs like http://localhost:3000 or short intranet hosts (http://devbox). Those are common in tool output (local preview servers, internal dashboards), so they will never appear in the links dropdown even though they are valid URLs. This makes the link extraction feature silently miss a frequent class of links.

Useful? React with 👍 / 👎.

ethanndickson pushed a commit that referenced this pull request Jan 15, 2026
## Summary

Add link detection and display to the workspace header, with special
handling for GitHub PR links.

## Features

- **Branch-based PR detection**: Automatically detects PR for current
branch via `gh pr view` (no URL argument)
- **Link extraction**: Scans assistant text and tool output for URLs
(shown in dropdown)
- **PR badge display**: Shows workspace's PR as a clickable badge in the
workspace header
- **PR status enrichment**: Fetches PR state (open/merged/closed),
mergeability, and draft status
- **Generic links dropdown**: Non-PR URLs displayed in a scrollable
dropdown with copy functionality

## Architecture

### Two separate concerns
1. **PR detection** (badge): Branch-based via `gh pr view` - robust,
doesn't depend on chat content
2. **Link extraction** (dropdown): Scans chat for URLs - shows relevant
links mentioned in conversation

### PR detection flow
```
WorkspaceLinks mounts
  → monitorWorkspace(workspaceId)
  → gh pr view --json ...  (no URL = current branch)
  → PRStatusStore caches result
  → useWorkspacePR(workspaceId) returns PR with status
```

### Link extraction robustness
- Only scans **complete** text parts (triggered on `tool-call-start` or
`stream-end`)
- Rescans after compaction to catch URLs split across deltas
- Tracks occurrence count and last-seen timestamp

### Design decisions
- Links derived from message history on load, **not persisted to
localStorage**
- PR badge comes from branch detection, **not** from chat-extracted PR
links
- Dropdown sorted by occurrence count (most seen first), then recency

## UX Features
- Copy button on each link in dropdown
- Hover tooltip shows full URL + "Seen N times · Last seen X ago"
- Scrollable dropdown (max 10 visible, all accessible via scroll)
- PR badge shows status icons (draft, checks, mergeability)

---
_Generated with `mux` • Model: `${MUX_MODEL_STRING:-unknown}` •
Thinking: `${MUX_THINKING_LEVEL:-unknown}` • Cost:
`$${MUX_COSTS_USD:-unknown}`_
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