Repository navigation
refactor(frontend): remove unused agent service code - #9728
Conversation
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.
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bobbai00
left a comment
There was a problem hiding this comment.
🟡 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 livegetReActSteps(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
left a comment
There was a problem hiding this comment.
🟢 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.
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:getAgent,getAgentWorkflowId,getAgentCount,isAgentConnected,getHeadId,getVisibleSteps,getReActStepsByOperatorAccessandgetStepsByOperatorIds. The agent service's routes stay.showPortShapes$,togglePortShapesandgetShowPortShapes.AgentInfo'sisBaselineModeandcreatedAtare set when an agent is mapped but never read. The specs' agent fixtures drop them.ApiMessageResponseinterface is unused, and theModelMessageandWorkflowContentimports are never referenced.let i = indexand the tab title'slet-active="active"declare variables that nothing reads.getHeadIdorgetVisibleStepsnow take the latest value ofgetHeadIdObservableorgetReActStepsObservable. 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.getAllAgentscase now checks the mapped name and model type, and that the delegate'suserTokenis dropped. Only a removedgetAgentcase checked the token before.getReActStepson a successful response, including the operator-accessMapthat the chat's export iterates. Only the removedgetReActStepsByOperatorAccesscases covered that path before.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
mainatfec4330be6(Windows 11; Node 24 with Yarn 4.14.1):main, all passing.mainhas the removed methods' ten cases, and this branch adds thegetReActStepssuccess case. Three cases are renamed, as above.getHeadIdObservablefail. If the mapped agent keeps the delegate'suserToken, thegetAllAgentscase fails. IfgetReActStepsreturns the fetched steps unconverted, orgetHeadIdObservablestops creating tracking for a new id, the matching new assertion fails.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/agentWas this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)