refactor(tests): build the workflow agents in the error-event tests from config - #681
Conversation
…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
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
…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.
Link to Issue or Description of Change
Problem:
Two spots in
node_error_event_test.tsbuilt a workflow agent as:WorkflowAgenthas a convenience overload that takes the workflow config directly and constructs theWorkflowitself, 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.tscovers that overload specifically ("still accepts a pre-built Workflow, with optional overrides").No behaviour change: the config form constructs the same
Workflowfrom the same config, including thererunOnResumedefault.Testing Plan
Unit Tests:
No new tests — this is a readability change inside existing ones.
Manual End-to-End (E2E) Tests:
Not applicable.
Checklist
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
WorkflowAgentnow that #680 lets aWorkflowbe aRunnerroot — they cannot, and it is worth knowing why.agent_loader.ts:277selects exports withisBaseAgent, so a sample exporting a bareWorkflowwould not load at all; andagent_graph.ts:50readsrootAgent.workflowthroughisGraphWorkflowAgentto render the graph added in #654. Widening those two seams is the same work as dissolvingWorkflowAgent, which belongs with theLLMAgentWrappercleanup rather than being done piecemeal.