Skip to content

refactor(agent-service): remove dead checkout/headChange path#5930

Merged
Yicong-Huang merged 1 commit into
apache:mainfrom
bobbai00:refactor/agent-service-remove-checkout
Jun 28, 2026
Merged

refactor(agent-service): remove dead checkout/headChange path#5930
Yicong-Huang merged 1 commit into
apache:mainfrom
bobbai00:refactor/agent-service-remove-checkout

Conversation

@bobbai00

@bobbai00 bobbai00 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Removes the step-checkout feature from agent-service, which was wired end-to-end but unreachable — nothing in the product ever invokes the frontend checkoutStep(), so the backend /agents/:id/checkout endpoint and its headChange WebSocket broadcast were never triggered. Removing the dead vertical slice:

  • agent-service/src/server.ts — drop the POST /:id/checkout route and the headChange / workflowContent members of the outgoing WebSocket-message type.
  • agent-service/src/agent/texera-agent.ts — drop TexeraAgent.checkout().
  • frontend/.../agent/agent.service.ts — drop the case "headChange" WS handler and the unused checkoutStep() method.

HEAD tracking is retained: init/step messages still carry headId, and the chat panel still walks the ancestor path from HEAD to render the visible step chain. Only the backward HEAD move (checkout) is removed.

This branches from main and is independent of the type-refactor stack (#5751#5928/#5927). Note #5751 currently lists headChange as a server message; whichever merges second will drop it from the union — a trivial reconciliation.

Any related issues, documentation, discussions?

Closes #5942
Part of #5747. Independent of the stack (branches from main).

How was this PR tested?

agent-service: tsc --noEmit clean, 93/93 bun test pass, prettier clean. Frontend: the removed checkoutStep() had zero callers and the headChange handler is now unreachable; verified no remaining checkout/headChange references and no orphaned imports.

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

Generated-by: Claude Opus 4.8 (1M context)

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

  • No candidates found from git blame history.

@github-actions github-actions Bot added refactor Refactor the code frontend Changes related to the frontend GUI agent-service labels Jun 24, 2026
@codecov-commenter

codecov-commenter commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.26%. Comparing base (a24d1d1) to head (3b9d332).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5930      +/-   ##
============================================
- Coverage     56.28%   56.26%   -0.03%     
  Complexity     2992     2992              
============================================
  Files          1120     1120              
  Lines         43217    43175      -42     
  Branches       4662     4658       -4     
============================================
- Hits          24326    24292      -34     
+ Misses        17472    17461      -11     
- Partials       1419     1422       +3     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from a24d1d1
agent-service 44.59% <100.00%> (-0.36%) ⬇️
amber 57.80% <ø> (ø) Carriedforward from a24d1d1
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from a24d1d1
config-service 51.56% <ø> (ø) Carriedforward from a24d1d1
file-service 59.02% <ø> (ø) Carriedforward from a24d1d1
frontend 49.33% <ø> (-0.01%) ⬇️
notebook-migration-service 78.57% <ø> (ø) Carriedforward from a24d1d1
pyamber 90.20% <ø> (ø) Carriedforward from a24d1d1
python 90.76% <ø> (ø) Carriedforward from a24d1d1
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from a24d1d1

*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 added a commit to bobbai00/texera that referenced this pull request Jun 24, 2026
Convert the per-message comments in types/ws to uniform JSDoc blocks (so they
surface in IDE hovers) and give every client and server frame a brief
purpose line. Mark WsServerHeadChangeMessage @deprecated: it is redundant and
unused (the checkout flow that emits it is unreachable) and is slated for
removal in apache#5930.

Doc-only; no type or runtime change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qFkyrpTd5PrkNBPcBeo4Q
bobbai00 added a commit to bobbai00/texera that referenced this pull request Jun 24, 2026
…lts on demand

Operator result summaries were pushed over the socket (on snapshot, step, and
completion frames), but the only frontend consumer — the per-operator chat
popover — reads them from a subject that was fed solely by those pushes, and
the step-frame results were never applied at all (dead payload). Most summary
fields are server-side agent context that is never displayed.

Move results to an on-demand pull and slim the socket to conversation +
lifecycle:

- Drop the `completion` frame entirely (type, server broadcast, frontend
  handler). Run-end is already signaled by the end-of-run `status` frame.
- Drop `operatorResults` from the `snapshot` and `step` frames (and stop
  computing/sending them there).
- The chat popover now calls fetchOperatorResults() (GET /operator-results)
  when it opens, pushing fresh summaries to operatorResultSummaries$.
- Remove the dead result-annotations machinery (toggleResultAnnotations,
  resultAnnotationsVisible(Subject/$), getResultAnnotationsVisible) — no callers.

Server frames are now: snapshot, step, status, error (plus the deprecated
headChange, removed in apache#5930).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qFkyrpTd5PrkNBPcBeo4Q
bobbai00 added a commit to bobbai00/texera that referenced this pull request Jun 28, 2026
Convert the per-message comments in types/ws to uniform JSDoc blocks (so they
surface in IDE hovers) and give every client and server frame a brief
purpose line. Mark WsServerHeadChangeMessage @deprecated: it is redundant and
unused (the checkout flow that emits it is unreachable) and is slated for
removal in apache#5930.

Doc-only; no type or runtime change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qFkyrpTd5PrkNBPcBeo4Q
bobbai00 added a commit to bobbai00/texera that referenced this pull request Jun 28, 2026
…lts on demand

Operator result summaries were pushed over the socket (on snapshot, step, and
completion frames), but the only frontend consumer — the per-operator chat
popover — reads them from a subject that was fed solely by those pushes, and
the step-frame results were never applied at all (dead payload). Most summary
fields are server-side agent context that is never displayed.

Move results to an on-demand pull and slim the socket to conversation +
lifecycle:

- Drop the `completion` frame entirely (type, server broadcast, frontend
  handler). Run-end is already signaled by the end-of-run `status` frame.
- Drop `operatorResults` from the `snapshot` and `step` frames (and stop
  computing/sending them there).
- The chat popover now calls fetchOperatorResults() (GET /operator-results)
  when it opens, pushing fresh summaries to operatorResultSummaries$.
- Remove the dead result-annotations machinery (toggleResultAnnotations,
  resultAnnotationsVisible(Subject/$), getResultAnnotationsVisible) — no callers.

Server frames are now: snapshot, step, status, error (plus the deprecated
headChange, removed in apache#5930).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qFkyrpTd5PrkNBPcBeo4Q
bobbai00 added a commit to bobbai00/texera that referenced this pull request Jun 28, 2026
apache#5751)

### What changes were proposed in this PR?

This PR refactors the agent-service ↔ frontend WebSocket messaging into
a dedicated **`types/ws`** folder. Each frame is a small class whose
`type` discriminator equals its class name (matching the main Texera WS
convention, e.g. `RegionUpdateEvent`). Building a frame with `new
WsServerStatusEvent(...)` sets the wire `type` for you, so no `type:
"..."` literal is hand-written at call sites; receivers `switch` on
`event.type`.

- `types/ws/client.ts` — frames the frontend sends, unioned as
`WsClientCommand`:
  - `WsClientPromptCommand` — a user prompt for the agent to run.
  - `WsClientStopCommand` — stop the in-flight run (payload-less).
- `types/ws/server.ts` — frames agent-service sends back, unioned as
`WsServerEvent`:
- `WsServerSnapshotEvent` — full state, sent once when a client
connects.
  - `WsServerStepEvent` — one step, streamed live as the agent runs.
- `WsServerStatusEvent` — a lifecycle change (GENERATING / AVAILABLE /
STOPPING).
  - `WsServerErrorEvent` — an error to surface to the user.
- `WsServerHeadChangeEvent` — unused by the frontend/UI (still reachable
via `/agents/:id/checkout`); slated for removal in apache#5930.
- Operator result summaries are no longer pushed over WebSocket — they
are pulled on demand via `GET /agents/:id/operator-results`. The
corresponding REST DTO `OperatorResultSummary` lives in
`types/execution.ts` (not under `ws/`).

This PR also adds unit tests and renames the `agent-service` test files
from `*.test.ts` to `*.spec.ts` to align with the frontend's naming
convention.

### Any related issues, documentation, discussions?

Closes apache#5749

### How was this PR tested?

Added/updated unit tests in both `agent-service` and `frontend` all
pass; a local end-to-end run was also verified.

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

Generated-by: Claude Opus 4.8 (1M context)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bobbai00 bobbai00 force-pushed the refactor/agent-service-remove-checkout branch from b7fc2c2 to 1b0d710 Compare June 28, 2026 17:54
@bobbai00 bobbai00 marked this pull request as ready for review June 28, 2026 18:04
@bobbai00 bobbai00 requested a review from Yicong-Huang June 28, 2026 18:05
The step-checkout feature was wired end-to-end but unreachable: nothing in
the product ever invokes the frontend `checkoutStep()`, so the backend
`/agents/:id/checkout` endpoint and its `WsServerHeadChangeEvent` broadcast
were never triggered. Remove the dead vertical slice:

- types/ws/server.ts: drop the `WsServerHeadChangeEvent` class and its
  membership in the `WsServerEvent` union (and the now-unused `WorkflowContent`
  import).
- server.ts: drop the `POST /:id/checkout` route, the `WsServerHeadChangeEvent`
  import, and its mention in the WS usage banner.
- texera-agent.ts: drop `TexeraAgent.checkout()`.
- server.spec.ts: drop the `checkout route` test block.
- agent.service.ts (frontend): drop the `case "WsServerHeadChangeEvent"`
  handler and `checkoutStep()`.

HEAD tracking itself is retained — the snapshot/step messages still carry
`headId`, and the chat panel still walks the ancestor path from HEAD to
render the visible step chain. Only the backward HEAD move (checkout) is
removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qFkyrpTd5PrkNBPcBeo4Q

@Yicong-Huang Yicong-Huang 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.

thanks for clean up. LGTM

@bobbai00 bobbai00 force-pushed the refactor/agent-service-remove-checkout branch from 1b0d710 to 3b9d332 Compare June 28, 2026 18:07
@bobbai00 bobbai00 added this pull request to the merge queue Jun 28, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 28, 2026
@Yicong-Huang Yicong-Huang added this pull request to the merge queue Jun 28, 2026
Merged via the queue into apache:main with commit 1aae005 Jun 28, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-service frontend Changes related to the frontend GUI refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(agent-service): remove the dead checkout/headChange path

3 participants