Skip to content

fix(frontend): link a locked agent tab to its workflow - #9604

Open
bobbai00 wants to merge 3 commits into
apache:mainfrom
bobbai00:fix/agent-locked-tabs
Open

bobbai00 wants to merge 3 commits into
apache:mainfrom
bobbai00:fix/agent-locked-tabs

Conversation

@bobbai00

@bobbai00 bobbai00 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Two ways an agent's chat could not be reopened:

  • An agent on another workflow: its tab was disabled behind a lock. It can now be selected, and shows the agent's workflow with a link to it in place of the chat. The agent stays inactive there, since an active agent loads its workflow into the canvas. The link is a plain one, as on the admin executions page: the workspace reads the workflow id only when it is created.
  • Your own agent on this workflow: a prompt sent right after its tab opened could arrive before the page fetched the workflow, carrying the content alone. The reload dropped the workflow's id and name, blanking the title and locking the tab. For an agent bound to the open workflow, the reload now keeps them. An agent bound to no workflow reloads as before.

An agent on another workflow. On "Iris species report", the chat of an agent working on "Q4 sales by region". Before, its tab does not respond:

Before: clicking the locked tab of an agent on another workflow does nothing

After, it names that workflow and links to it, where the chat is:

After: the tab names the agent's workflow, and its link opens that workflow with the chat

Your own agent on this workflow. A prompt sent the moment the agent's tab opens. Before, the title and the workflow id disappear, and both tabs lock:

Before: after a quick prompt the workflow title and id disappear and the agent tabs lock

After, they stay:

After: after a quick prompt the workflow title and id stay and the tabs stay open

Any related issues, documentation, discussions?

Part of #9575: this fixes the chats that cannot be reopened, and #9579 fixes the model card that does not respond.

How was this PR tested?

New specs cover the selectable tab, the link and the kept workflow id; each fails without its change. Also run in headless Chromium against a local stack with a real model, alone and merged with #9579. The link opens the agent's workflow, where the chat answers, and a prompt sent at once keeps the title.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Fable 5.2, Claude Opus 5.5)

An agent's step can reach the page before the agent's workflow has been
fetched, and then carries the content alone. Reloading the workspace from it
dropped the open workflow's id and name: the title went blank and the agent's
own tab locked as belonging to a different workflow. For an agent bound to
the open workflow, the reload now keeps that workflow's id and name. An agent
bound to no workflow is reloaded as before, so its content is not saved over
the workflow that happens to be open.
The tab of an agent that works on another workflow was disabled: it showed a
lock and could not be clicked, so its chat could not be reached again. The
tab can now be selected. In place of the chat it names the agent's workflow
and links to it. The agent is not activated there, since an active agent
loads its workflow into the canvas.

The link is a plain one, as on the admin executions page, because the
workspace reads the workflow's id from its address only when it is created.
@github-actions github-actions Bot added fix frontend Changes related to the frontend GUI labels Nov 21, 2026
@Yicong-Huang Yicong-Huang added release/v1.3 back porting to release/v1.3 release/v1.2 back porting to release/v1.2 labels Nov 21, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 November 21, 2026 09:18
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
✅ release/v1.3 Already labeled — this fix is queued to backport here. @mengw15 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other.
✅ release/v1.2 Already labeled — this fix is queued to backport here. @xuang7 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other.

Auto-label run.

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @eugenegujing, @aglinxinyuan
    You can notify them by mentioning @eugenegujing, @aglinxinyuan in a comment.

@codecov-commenter

codecov-commenter commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.68%. Comparing base (f030df1) to head (7235d75).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9604      +/-   ##
============================================
- Coverage     91.68%   91.68%   -0.01%     
  Complexity     5135     5135              
============================================
  Files          1302     1304       +2     
  Lines         58119    58103      -16     
  Branches       7582     7584       +2     
============================================
- Hits          53285    53270      -15     
+ Misses         2923     2922       -1     
  Partials       1911     1911              
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 18c1c12
agent-service 99.56% <ø> (ø) Carriedforward from 18c1c12
amber 85.76% <ø> (ø) Carriedforward from 18c1c12
computing-unit-managing-service 63.83% <ø> (ø) Carriedforward from 18c1c12
config-service 87.50% <ø> (ø) Carriedforward from 18c1c12
file-service 82.16% <ø> (ø) Carriedforward from 18c1c12
frontend 96.46% <100.00%> (+<0.01%) ⬆️
notebook-migration-service 83.77% <ø> (ø) Carriedforward from 18c1c12
pyamber 98.38% <ø> (ø) Carriedforward from 18c1c12
result-service 85.71% <ø> (ø) Carriedforward from 18c1c12
workflow-compiling-service 78.30% <ø> (ø) Carriedforward from 18c1c12

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bobbai00
bobbai00 marked this pull request as ready for review November 22, 2026 23:23
@bobbai00 bobbai00 removed release/v1.2 back porting to release/v1.2 release/v1.3 back porting to release/v1.3 labels Nov 22, 2026
@bobbai00
bobbai00 requested a review from kunwp1 November 22, 2026 23:33
@bobbai00

Copy link
Copy Markdown
Contributor Author

@sshiv012 could you take a look and share what you think? This is part of #9575: a chat from another workflow now shows a link to that workflow instead of a lock, and a prompt sent right after opening a chat no longer locks it. The GIFs in the description show the before and after.

…le branch

Only an agent bound to another workflow reaches the notice that links to
its workflow, so the agent's delegate is always set there. Optional
chaining on it added a branch that could never run, which left the line
partly covered.

@kunwp1 kunwp1 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.

LGTM!

Comment on lines +292 to +295
const open = this.workflowActionService.getWorkflowMetadata();
const boundWid = this.agentInfo.delegate?.workflowId;
const isBoundToOpen = !!boundWid && boundWid === open.wid;
this.workflowActionService.reloadWorkflow(isBoundToOpen ? { ...open, ...workflow } : workflow, false, false);

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.

The content-only Workflow comes from agent.service.ts (the WsServerStepEvent branch, around lines 555-561), where { ...(existingWorkflow || {}), content } is cast with as Workflow. Merging here works, since only the workspace has the full metadata. As a follow-up, typing that stream as WorkflowContent and building { ...open, content } here would stop any other consumer from getting a Workflow with no id. Not blocking.

Comment on lines +149 to +154
<a
nz-button
nzType="primary"
[href]="workspaceCanvasUrl(workflowId)">
Open that workflow
</a>

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.

The plain href makes sense: workspace.component.ts reads route.snapshot.params.id only once, and this is the first link from one workspace to another. Two small notes:

  • After the reload, the panel opens on the "+ Agent" tab, so the user still has to click the agent's tab to see the chat.
  • A follow-up could have the workspace react to paramMap (or add a RouteReuseStrategy), so links like this one can be routerLinks.

Neither is needed here.

Comment on lines +233 to 237
if (!this.canSwitchToAgent(agent)) {
this.deactivateCurrentAgent();
this.selectedTabIndex = index;
return;
}

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.

Every tab can be selected now, so canSwitchToAgent really means "the agent is on the open workflow". The new *ngIf and this branch both rely on it. Renaming it (e.g. to isOnOpenWorkflow) would read better. Optional.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants