Skip to content

refactor(frontend): remove unused agent service code - #9728

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:refactor/unused-agent-service-code
Nov 27, 2026
Merged

aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:refactor/unused-agent-service-code

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Remove code that nothing uses from the frontend's agent service and the agent panel (+73/−365 lines). There is no behavior change.

  • AgentService:
    • Eight public methods have no caller outside the service's own spec: getAgent, getAgentWorkflowId, getAgentCount, isAgentConnected, getHeadId, getVisibleSteps, getReActStepsByOperatorAccess and getStepsByOperatorIds. The agent service's routes stay.
    • Nothing reads the port-shape toggle: showPortShapes$, togglePortShapes and getShowPortShapes.
    • AgentInfo's isBaselineMode and createdAt are set when an agent is mapped but never read. The specs' agent fixtures drop them.
    • The ApiMessageResponse interface is unused, and the ModelMessage and WorkflowContent imports are never referenced.
  • Agent panel template: the tab loop's let i = index and the tab title's let-active="active" declare variables that nothing reads.
  • Service spec:
    • The ten cases that cover only the removed methods go.
    • Assertions that read the current HEAD or steps through getHeadId or getVisibleSteps now take the latest value of getHeadIdObservable or getReActStepsObservable. Unlike the removed getters, those create tracking for an unknown id, and the two accessor cases now assert that. Three cases are renamed to match.
    • The getAllAgents case now checks the mapped name and model type, and that the delegate's userToken is dropped. Only a removed getAgent case checked the token before.
    • A new case covers getReActSteps on a successful response, including the operator-access Map that the chat's export iterates. Only the removed getReActStepsByOperatorAccess cases covered that path before.
Event PR / Commit
Introduced by All of it: #4495 (2026-04-27)
Usage removed by Never used

As of 2026-11-26, all of it has gone unused for the 7 months since it was added.

Any related issues, documentation, discussions?

Closes #9727.

How was this PR tested?

Ran on this branch and on main at fec4330be6 (Windows 11; Node 24 with Yarn 4.14.1):

cd frontend
npx ng test --watch=false --include='**/agent.service.spec.ts' --include='**/agent-interaction.component.spec.ts' --include='**/agent-chat.component.spec.ts' --include='**/agent-panel.component.spec.ts' --include='**/agent-registration.component.spec.ts' --include='**/react-step-detail-modal.component.spec.ts' --include='**/workflow-editor.component.spec.ts'
npx tsc --noEmit -p src/tsconfig.app.json
npx tsc --noEmit -p src/tsconfig.spec.json
npx ngc -p src/tsconfig.app.json --noEmit
yarn prettier-eslint --list-different $(git diff --name-only --relative origin/main -- src)
yarn eslint $(git diff --name-only --relative origin/main -- src | grep -E '\.(ts|html)$')
  • Specs: the seven specs that import the agent service or its types run 436 tests on this branch and 445 on main, all passing.
    • main has the removed methods' ten cases, and this branch adds the getReActSteps success case. Three cases are renamed, as above.
    • Every other test keeps its name and outcome.
  • Controls: if a step event stops advancing HEAD, the two step-event cases that now read getHeadIdObservable fail. If the mapped agent keeps the delegate's userToken, the getAllAgents case fails. If getReActSteps returns the fetched steps unconverted, or getHeadIdObservable stops creating tracking for a new id, the matching new assertion fails.
  • Checks: both typechecks, the AOT compile (the template changes), prettier-eslint and ESLint pass.

To re-check, this returns no hits on this branch and 56 on main:

git grep -nE "getAgentWorkflowId|\.getAgent\(|getAgentCount|isAgentConnected|getHeadId\(|getVisibleSteps|getReActStepsByOperatorAccess|getStepsByOperatorIds|PortShapes|isBaselineMode|ApiMessageResponse|let-active=|of agents; let i" -- frontend/src/app/workspace/service/agent frontend/src/app/workspace/component/agent

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

Generated-by: Claude Code (Claude Opus 5.5)

Nothing outside AgentService's own spec calls these eight methods or
reads the port-shape toggle, the two AgentInfo fields set at mapping
time, or the unused response interface and imports. The agent panel
never reads its tab loop's index or its tab title's active flag. All of
it has been unused since apache#4495 added it.
Copilot AI balanced review requested due to automatic review settings November 27, 2026 00:44
@aglinxinyuan aglinxinyuan self-assigned this Nov 27, 2026

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added refactor Refactor the code frontend Changes related to the frontend GUI labels Nov 27, 2026
@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: @bobbai00, @CaroFernando
    You can notify them by mentioning @bobbai00, @CaroFernando in a comment.

@codecov-commenter

codecov-commenter commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.76%. Comparing base (fec4330) to head (8f7b660).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9728      +/-   ##
============================================
- Coverage     91.77%   91.76%   -0.01%     
  Complexity     5134     5134              
============================================
  Files          1308     1308              
  Lines         58048    58013      -35     
  Branches       7558     7552       -6     
============================================
- Hits          53271    53237      -34     
  Misses         2888     2888              
+ Partials       1889     1888       -1     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from 50a265b
agent-service 99.56% <ø> (ø) Carriedforward from 50a265b
amber 85.94% <ø> (ø) Carriedforward from 50a265b
computing-unit-managing-service 63.81% <ø> (ø) Carriedforward from 50a265b
config-service 87.50% <ø> (ø) Carriedforward from 50a265b
file-service 82.16% <ø> (ø) Carriedforward from 50a265b
frontend 96.45% <100.00%> (-0.01%) ⬇️
notebook-migration-service 83.84% <ø> (ø) Carriedforward from 50a265b
pyamber 98.70% <ø> (ø) Carriedforward from 50a265b
result-service 86.48% <ø> (ø) Carriedforward from 50a265b
workflow-compiling-service 80.90% <ø> (ø) Carriedforward from 50a265b

*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 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.

🟡 0 must-fix · 1 advisory · 2 polish: the deletion checks out; one test gap on a live method and two wording touch-ups.

Simplifications (1)

  • agent.service.spec.ts:1059: the deleted cases were the only success-path coverage of the live getReActSteps (advisory, see inline)

Polish: 2 quick touch-ups (see inline comments).

Verification trace

Checked that every removed member was unused. At base fec4330be the PR's own grep pattern hits 56 lines, all inside the six touched files, and at the head the removed symbols have no hits anywhere in the repo. Every remaining public AgentService method keeps a production caller, defer, throwError and BehaviorSubject keep other users, and nothing subclasses the service. readSnapshot reads synchronously because both getters it wraps return a BehaviorSubject.

- Add a getReActSteps success case beside its failure case. The removed
  getReActStepsByOperatorAccess cases were its only coverage on a
  successful response, and the chat's export iterates the operator-access
  Map that its conversion builds.
- Reading HEAD or steps for an unknown id creates that id's tracking.
  Assert it, and rename both cases to match.
- The class doc now says canvas annotation streams: the port-shape toggle
  was the only toggle.

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

🟢 3 resolved · 0 open · 0 new (0 new = 0 newly introduced · 0 late catches)

All three round-1 findings are fixed in 8f7b660, and the new commit adds nothing to flag.

Verification trace

Checked each fix in the tree before leaving the closed threads closed. The getReActSteps success case (agent.service.spec.ts:1313) runs the real conversion, so unconverted steps would fail its id, timestamp and Map assertions. Both accessor cases now assert that reading an unknown id creates tracking (agent.service.spec.ts:1179, :1189), and the class doc at agent.service.ts:207 names the streams workflow-editor reads. The delta changes no production code.

@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!

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Nov 27, 2026
Merged via the queue into apache:main with commit e8c37e6 Nov 27, 2026
32 checks passed
@aglinxinyuan
aglinxinyuan deleted the refactor/unused-agent-service-code branch November 27, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unused agent service code

5 participants