Skip to content

feat: add right panel tabs for workspace apps and ports - #26208

Merged
ethanndickson merged 7 commits into
mainfrom
ethan/agents-app-port-tabs
Jun 17, 2026
Merged

ethanndickson merged 7 commits into
mainfrom
ethan/agents-app-port-tabs

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Jun 10, 2026 •

Copy link
Copy Markdown
Member

Adds workspace app and forwarded port tabs to the AgentsPage right panel, so app previews and port views can sit alongside terminals while working in the chat view.

  • The new add-tab dropdown lists the agent's apps and a ports submenu: embeddable apps open as iframe tabs, command apps open as renamed terminal tabs running their command, and ports open in a new port preview panel served through the wildcard access URL.
  • Tabs persist per chat and are validated against the current workspace state: tabs whose app disappears, stops being embeddable, or whose agent no longer exposes the port forwarding helper are hidden rather than deleted, and reappear if the workspace exposes them again.
  • A shared usePortsData hook keeps the add-tab control, workspace pill, and existing PortForwardButton on the same port queries and refresh cadence.
  • App and port tabs are limited to devel builds for now; terminal tabs remain generally available. This was done in favour of adding a backend experiment for a frontend-only feature. TODO: I'm just gonna switch to a backend experiment.

Closes CODAGT-346

@github-actions

Copy link
Copy Markdown
Contributor

Docs preview

📖 View docs preview for docs/ai-coder/agents/index.md

ethanndickson commented Jun 10, 2026 •

Copy link
Copy Markdown
Member Author

@ethanndickson ethanndickson changed the title feat(site/src/pages/AgentsPage): add workspace-app and port preview tabs feat: add right panel tabs for workspace apps and ports Jun 10, 2026
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-frame-refactor branch from 6e6d829 to 0476e85 Compare June 11, 2026 04:51
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-port-tabs branch from be8f4c3 to 350cef5 Compare June 11, 2026 04:51
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-frame-refactor branch from 0476e85 to 393908a Compare June 11, 2026 05:59
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-port-tabs branch from 350cef5 to 5f8c3b8 Compare June 11, 2026 05:59
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-frame-refactor branch from 393908a to aa8b5f2 Compare June 11, 2026 06:31
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-port-tabs branch 3 times, most recently from 4c7360a to eb4f9a3 Compare June 11, 2026 08:08
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-frame-refactor branch 2 times, most recently from 51b7fad to 0887837 Compare June 11, 2026 13:34
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-port-tabs branch 2 times, most recently from ef0f871 to 24eae83 Compare June 11, 2026 14:28
Base automatically changed from ethan/agents-app-frame-refactor to main June 12, 2026 01:51
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-port-tabs branch from 24eae83 to 6beae33 Compare June 12, 2026 05:04
@ethanndickson
ethanndickson marked this pull request as ready for review June 12, 2026 05:31

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

Copy link
Copy Markdown

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: 6beae330aa

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ethanndickson
ethanndickson force-pushed the ethan/agents-app-port-tabs branch from 6beae33 to 2ead90b Compare June 12, 2026 05:45
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@ethanndickson

Copy link
Copy Markdown
Member Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review in progress | View chat
Requested: 2026-06-12 07:12 UTC by @ethanndickson
Spend: $45.18 / $100.00

deep-review v0.7.1 | Round 2 | b1c6010..90024f7

Last posted: Round 2, 16 findings (1 P2, 11 P3, 3 P4, 1 Nit), APPROVE. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P3 Author fixed (90024f7) PortPreviewPanel.stories.tsx:41 PortPreviewPanel stories have no play functions R1 Netero Yes
CRF-2 Nit Author contested; panel closed R2 (3/3 close) rightPanelTabs.ts:33 Mixed indentation on union type closing braces R1 Netero, Meruem Yes
CRF-3 P2 Author contested; panel closed R2 (5/5 close) PortPreviewPanel.tsx:60 Port preview iframe loads immediately without active gating R1 Hisoka Yes
CRF-4 P3 Author fixed (90024f7) rightPanelTabs.ts:93 Port validator accepts port numbers above 65535 R1 Mafuuu P3, Meruem P3, Razor P4 Yes
CRF-5 P3 Author fixed (90024f7) rightPanelTabs.test.ts:74 Negative validation tests don't assert surviving tab kinds R1 Chopper P3, Kite P3 Yes
CRF-6 P3 Author fixed (90024f7) WorkspacePill.tsx:87 Inline port-forwarding gate diverges from canShowPortsMenu R1 Robin P3, Zoro P3 Yes
CRF-7 P3 Author fixed (90024f7) rightPanelTabs.ts:9 Utility module imports from UI component file R1 Zoro P3, Razor Note Yes
CRF-8 P3 Author fixed (90024f7) AgentChatPageView.tsx:594 renderUserTabContent switch not exhaustive (no never guard) R1 Meruem Yes
CRF-9 P3 Author contested; panel closed R2 (4/4 close) AgentChatPageView.tsx:529 display_name ?? slug passes through empty strings as labels R1 Hisoka Yes
CRF-10 P3 Author fixed (90024f7) PortPreviewPanel.tsx:82 Fallback unavailable message gives no actionable information R1 Leorio Yes
CRF-11 P3 Author contested; panel closed R2 (4/4 close) WorkspacePillPorts.tsx:258 Listening port tab protocol is snapshot of user preference, not live R1 Pariston Yes
CRF-12 P3 Author fixed (90024f7) rightPanelTabs.test.ts:190 No storage round-trip test for workspace_app or port tabs R1 Bisky Yes
CRF-13 P3 Author fixed (90024f7) RightPanelAddTabControl.stories.tsx:91 Default story never asserts callback wiring R1 Bisky Yes
CRF-14 P4 Author contested; panel closed R2 (4/4 close) AgentChatPageView.tsx:601 initialCommand sent on every WebSocket reconnection R1 Hisoka Yes
CRF-15 P4 Author fixed (90024f7) AgentChatPageView.tsx:597 Terminal tab returns null instead of unavailable message R1 Nami Yes
CRF-16 P4 Author fixed (90024f7) usePortsData.ts:45 Shared hook adds agent-name filter changing PortForwardButton contract R1 Kite P3, Razor P3 Yes

Contested and acknowledged

CRF-2 (Nit, rightPanelTabs.ts:33) - Mixed indentation on union type closing braces

  • Finding: Closing braces of union variants use tab + 2 spaces instead of consistent tabs.
  • Author defense: Biome's canonical formatting for leading-pipe union members. Committed examples confirm the pattern. Hand-editing reverted on next format pass.
  • Panel closure (R2, 3/3): Nami, Meruem, and Razor verified this is the formatter's output. Closing.

CRF-3 (P2, PortPreviewPanel.tsx:60) - Port preview iframe loads without active gating

  • Finding: PortPreviewPanel renders WorkspaceIframe unconditionally. WorkspaceAppFrame gates behind active prop.
  • Author defense: WorkspaceAppFrame's active prop toggles CSS visibility only; iframe loads at mount. SidebarTabView keeps all panels mounted. Loading is symmetric across tab types. Better solved generically with lazy first-mount in SidebarTabView.
  • Panel closure (R2, 5/5): Hisoka, Pariston, Nami, Meruem, Razor all verified SidebarTabView mounts all panels and WorkspaceAppFrame's active prop is CSS-only. Concern is real but architectural (SidebarTabView), not PortPreviewPanel-specific.

CRF-9 (P3, AgentChatPageView.tsx:529) - display_name ?? slug passes through empty strings

  • Finding: Nullish coalescing does not fall through on empty string.
  • Author defense: display_name serialized with omitempty on backend. Empty string arrives as undefined. Matches useAppLink.ts precedent.
  • Panel closure (R2, 4/4): Hisoka, Nami, Meruem, Razor verified codersdk/workspaceapps.go has omitempty tag. Wire state cannot produce empty string.

CRF-11 (P3, WorkspacePillPorts.tsx:258) - Protocol snapshot, not live

  • Finding: Listening port tab captures protocol preference at creation. Stale if user changes preference later.
  • Author defense: Protocol preference is a plain localStorage read with no reactivity. Live read only on incidental re-renders. Changing iframe src reloads preview and loses state.
  • Panel closure (R2, 4/4): Pariston, Nami, Meruem, Razor confirmed getWorkspaceListeningPortsProtocol is a raw localStorage read with no reactive signal. Snapshot is correct design.

CRF-14 (P4, AgentChatPageView.tsx:601) - initialCommand sent on every reconnection

  • Finding: initialCommand persisted and sent on every WebSocket connect. Future backend change could re-execute commands.
  • Author defense: Backend only runs command for fresh reconnect token (documented). Clearing after first connect breaks reattach after PTY token expiry.
  • Panel closure (R2, 4/4): Hisoka, Nami, Meruem, Razor verified backend contract (Razor traced to reconnectingpty/server.go LoadOrStore). Clearing would break recovery path.

Law analysis

Effective LOC: 1197. Head SHA: 2ead90b47303. Verdict: Don't split. Enforcement: Advisory.

Round log

Round 1

Panel. 1 P2, 11 P3, 3 P4. 2 Nit (not posted). Reviewed against b1c6010..2ead90b47303.

Round 2

Churn guard: PROCEED. 11 addressed, 5 contested. Panel: 0 new findings. All 5 contested findings closed unanimously. All 11 fixes verified. Reviewed against b1c6010..90024f74917e.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 2ead90b473

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@linear-code

linear-code Bot commented Jun 12, 2026

Copy link
Copy Markdown

CODAGT-346

@coder-agents-review coder-agents-review 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.

Clean work. The usePortsData extraction is well-motivated: three consumers on the same query keys without duplication. The discriminated union for UserRightPanelTab is the right type-level encoding. Validation, deduplication, and the raw-vs-filtered persistence split are all sound. The feature gate hides without destroying stored state, which is correct.

Severity summary: 1 P2, 11 P3, 3 P4.

The P2 is about port preview iframes loading immediately even when the tab is not active, unlike the WorkspaceAppFrame pattern which gates on an active prop.

"When you're chatting with an AI agent that's building a web app, and it says 'I updated the page layout,' you want to see it right there. Not in another browser tab you forgot about." (Luffy)


site/src/pages/AgentsPage/components/WorkspacePill.tsx:87

P3 [CRF-6] Inline port-forwarding gate diverges from canShowPortsMenu. This PR introduces canShowPortsMenu(agent, host) in WorkspacePillPorts.tsx:40 as the canonical gate, and two other call sites already use it. But WorkspacePill.tsx still inlines:

const portForwardingEnabled =
    host !== "" && builtinApps.has("port_forwarding_helper");

The inline version uses host !== "" while canShowPortsMenu uses host.trim() !== "", so the two copies disagree on whitespace handling. This file was already touched by the import change. Replace with canShowPortsMenu(agent, host).

(Robin, Zoro)

🤖

🤖 This review was automatically generated with Coder Agents.

@ethanndickson

Copy link
Copy Markdown
Member Author

Re CRF-6 (from the review summary, no inline thread since WorkspacePill.tsx:87 is outside the diff): fixed in 90024f7. WorkspacePill.tsx now uses the shared canShowPortsMenu (relocated to utils/portForward.ts as part of CRF-7) instead of the inline host !== "" gate, so the whitespace-host handling no longer diverges.

@ethanndickson

Copy link
Copy Markdown
Member Author

/coder-agents-review

@coder-agents-review coder-agents-review 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.

All 16 findings from round 1 are resolved: 11 fixed in 90024f7, 5 contested and closed by unanimous panel vote.

The fixes are solid. CRF-6 (inline gate divergence) was generalized into a shared canShowPortsMenu utility with its own tests rather than a one-site patch. CRF-13 (story callback wiring) was fixed with full click-and-assert coverage for all four callback types. The port range guard, exhaustive switch, storage round-trips, and PortPreviewPanel play functions all address root causes.

The contested defenses held up under scrutiny. CRF-3 (iframe load gating): the panel verified that WorkspaceAppFrame.active is CSS-only and SidebarTabView mounts all panels eagerly, making the concern symmetric and architectural. CRF-9 (display_name ?? slug): confirmed omitempty on the Go struct prevents empty strings on the wire. CRF-14 (initialCommand on reconnect): Razor traced the contract to reconnectingpty/server.go LoadOrStore, confirming the backend ignores the command for existing tokens.

CI has a lint failure (run 80977494893) that should be checked before merge.

"I came looking for hidden couplings between the persisted tab state and the live workspace. The validation layer handles every transition I probed: app disappears, app changes embeddability, agent disconnects, wildcard hostname changes, port stops listening. The code held up." (Hisoka)

🤖 This review was automatically generated with Coder Agents.

Comment thread site/src/utils/portForward.ts Resolved
Comment on lines +21 to +25
/**
* Used by both the workspace port-forward button and the AgentsPage right-panel
* ports menu so they stay on the same query keys and refresh cadence.
*/
export const usePortsData = (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm slightly less opinionated but Kayla often pushes hard against having very single use hooks. I know we have a handful in the site and I'll be honest to saying I'm not entirely sure when we should and should not use them.

This one has been promoted from our silo'd AgentsPage/ into the proper frontend, and I'm hesitant to approve it.

Typically a suggestion would be: Just use a function that takes in the data required (obtained by useQuery) instead of creating a hook.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Typically a suggestion would be: Just use a function that takes in the data required (obtained by useQuery) instead of creating a hook.

The hook is as much of an abstraction for calling two useQuerys as much as it is an abstraction for the output filtering work IMO.

I haven't written enough React to have much of an opinion here, but it seems reasonable to me in theory, given it's unifying the queries with those in PortForwardButton.tsx from the workspaces page.

On the other hand though, the hook's not exactly a huge saving of LOC 🤷

@ethanndickson
ethanndickson force-pushed the ethan/agents-app-port-tabs branch from 8ddce6c to dc23d64 Compare June 12, 2026 15:16
Extend the Coder Agents right-panel add-tab control so users can open embeddable
workspace apps and forwarded ports as right-panel tabs alongside terminals.

The add-tab dropdown now lists the agent's visible workspace apps and a Ports
submenu. Command apps (e.g. Claude Code) open as a renamed terminal tab running
the app's command; embeddable subdomain apps open in a WorkspaceAppFrame tab;
non-embeddable apps fall back to the normal app launcher. Selecting a listening
or shared port opens a PortPreviewPanel tab built from the port-forward URL.

The Ports submenu reuses the existing WorkspacePillPorts data hook and menu
items, extended with an optional create-tab callback, instead of duplicating the
port-forwarding query and rendering logic.

Add the workspace_app and port variants to the right-panel tab model with
hydration validation that drops app tabs whose app no longer exists and port
tabs when wildcard access is unavailable, and document the feature.
@ethanndickson
ethanndickson force-pushed the ethan/agents-app-port-tabs branch from e5b95b9 to fce8738 Compare June 17, 2026 03:33
@ethanndickson
ethanndickson merged commit 5ee1946 into main Jun 17, 2026
31 checks passed
@ethanndickson
ethanndickson deleted the ethan/agents-app-port-tabs branch June 17, 2026 03:59
ethanndickson added a commit that referenced this pull request Jun 17, 2026
The workspace-app and port preview tabs in the Coder Agents right panel
were previously gated behind a `devel` prerelease build check, which
can't be toggled in real deployments.

This replaces that check with a proper `agent-app-tabs` deployment
experiment, registered in `ExperimentsKnown`, so the feature can be
enabled via `CODER_EXPERIMENTS=agent-app-tabs` like any other
experiment. The frontend now reads
`experiments.includes("agent-app-tabs")` from the dashboard instead of
`getPrereleaseFlag(buildInfo) === "devel"`.

Depends on #26208
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