-
Notifications
You must be signed in to change notification settings - Fork 42
🤖 feat: add first-class link support with PR status badges #1623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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".
CI StatusThe test failures in Link-related tests all pass locally:
|
e7c7e17 to
37a8818
Compare
|
@codex review |
37a8818 to
82c46d2
Compare
There was a problem hiding this 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".
82c46d2 to
62646e5
Compare
|
@codex review |
62646e5 to
00a347b
Compare
There was a problem hiding this 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".
00a347b to
621b206
Compare
|
@codex review |
621b206 to
6994d60
Compare
There was a problem hiding this 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".
6994d60 to
e831f0e
Compare
|
@codex review |
0d79e24 to
2b90d9b
Compare
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
2b90d9b to
5aaf2cb
Compare
There was a problem hiding this 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".
| 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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👍 / 👎.
| .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("."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👍 / 👎.
## 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}`_
Summary
Add link detection and display to the workspace header, with special handling for GitHub PR links.
Features
gh pr view(no URL argument)Architecture
Two separate concerns
gh pr view- robust, doesn't depend on chat contentPR detection flow
Link extraction robustness
tool-call-startorstream-end)Design decisions
UX Features
Generated with
mux• Model:${MUX_MODEL_STRING:-unknown}• Thinking:${MUX_THINKING_LEVEL:-unknown}• Cost:$${MUX_COSTS_USD:-unknown}