Skip to content

refactor(tests): build the workflow agents in the error-event tests from config - #681

Merged
kalenkevich merged 1 commit into
mainfrom
refactor/collapse-workflow-agent-double-wrap
Aug 12, 2026
Merged

refactor(tests): build the workflow agents in the error-event tests from config#681
kalenkevich merged 1 commit into
mainfrom
refactor/collapse-workflow-agent-double-wrap

Conversation

@kalenkevich

@kalenkevich kalenkevich commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Link to Issue or Description of Change

Problem:

Two spots in node_error_event_test.ts built a workflow agent as:

new WorkflowAgent(new Workflow({name: 'wf', edges: [...]}))

WorkflowAgent has a convenience overload that takes the workflow config directly and constructs the Workflow itself, so the inner constructor was only adding a nesting level.

Solution:

Use the config overload in both places.

The other two new WorkflowAgent(existingWorkflow) uses in the suite are deliberate and stay — workflow_agent_test.ts covers that overload specifically ("still accepts a pre-built Workflow, with optional overrides").

No behaviour change: the config form constructs the same Workflow from the same config, including the rerunOnResume default.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

No new tests — this is a readability change inside existing ones.

npm run ts:check          clean
npx vitest --project unit:core    212 files, 2963 passed

Manual End-to-End (E2E) Tests:

Not applicable.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

Touches only a file from #657, so it is independent of the other workflow PRs in flight.

For the record on the larger question this came out of — whether the sample and integration tests could drop WorkflowAgent now that #680 lets a Workflow be a Runner root — they cannot, and it is worth knowing why. agent_loader.ts:277 selects exports with isBaseAgent, so a sample exporting a bare Workflow would not load at all; and agent_graph.ts:50 reads rootAgent.workflow through isGraphWorkflowAgent to render the graph added in #654. Widening those two seams is the same work as dissolving WorkflowAgent, which belongs with the LLMAgentWrapper cleanup rather than being done piecemeal.

…rom config

Two of these constructed `new WorkflowAgent(new Workflow({...}))`. The
convenience overload takes the workflow config directly and builds the
`Workflow` itself, so the inner constructor was only adding a nesting level.

Both remaining `new WorkflowAgent(existingWorkflow)` uses in the suite are
deliberate -- `workflow_agent_test.ts` covers that overload specifically -- so
they stay as they are.

No behaviour change: the config form constructs the same `Workflow` with the
same config.

@AmaadMartin AmaadMartin left a comment

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.

Reviewed at 686c52d. The refactor is correct. WorkflowAgent has a constructor(config: WorkflowConfig) overload that builds new Workflow(config) internally (workflow_agent.ts), so the config form produces the same Workflow as the old explicit wrap. No behaviour change. Workflow stays imported and used across the file. No any, no suppressions, no instanceof added.

Not approving yet: run-tests (windows-latest) is still pending. macOS and ubuntu passed. Approve once Windows is green.

@AmaadMartin AmaadMartin left a comment

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.

Approving at 686c52d. My earlier review said the refactor was correct and then withheld approval because run-tests (windows-latest) was pending. That was wrong, and it was the reviewer's fault rather than anything about this PR.

The cause is worth naming: the review skill still said to treat a pending check as not green and wait for it. An unattended reviewer cannot wait — it only re-reviews when the head SHA changes, and CI turning green does not change the SHA — so "approve once Windows is green" was a promise it could never keep. The skill has been corrected.

On the code, unchanged from my earlier read: WorkflowAgent's constructor(config: WorkflowConfig) overload builds new Workflow(config) internally, so the config form produces the same Workflow as the old explicit wrap. No behaviour change, Workflow stays imported and used, and the diff adds no suppressions and no instanceof. All checks are green now in any case. LGTM.

@kalenkevich
kalenkevich merged commit e11c2bd into main Aug 12, 2026
13 checks passed
@kalenkevich
kalenkevich deleted the refactor/collapse-workflow-agent-double-wrap branch August 12, 2026 22:45
@kalenkevich kalenkevich mentioned this pull request Aug 20, 2026
prasanna8585 pushed a commit to prasanna8585/adk-js that referenced this pull request Aug 21, 2026
…rom config (google#681)

Two of these constructed `new WorkflowAgent(new Workflow({...}))`. The
convenience overload takes the workflow config directly and builds the
`Workflow` itself, so the inner constructor was only adding a nesting level.

Both remaining `new WorkflowAgent(existingWorkflow)` uses in the suite are
deliberate -- `workflow_agent_test.ts` covers that overload specifically -- so
they stay as they are.

No behaviour change: the config form constructs the same `Workflow` with the
same config.
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.

3 participants