Skip to content

Improve test coverage of the agent service #5266

@bobbai00

Description

@bobbai00

Task Summary

The agent service (agent-service/) currently has low automated test coverage. A bun test --coverage run reports ~51.6% line / 54.2% function coverage overall, and the gaps are concentrated in the core logic rather than helpers:

Module % Lines Role
util/context-utils.ts 1% builds per-step LLM context
tools/workflow-execution-tools.ts 5% operator execution tool
api/workflow-api.ts 8% workflow CRUD client
api/compile-api.ts 10% compile client
util/workflow-utils.ts 10% workflow helpers
agent/prompts.ts 15% system prompt builder
tools/workflow-crud-tools.ts 22% add/modify/delete tools
agent/texera-agent.ts 32% core ReAct loop (sendMessage)
server.ts 50% REST routes + websocket

The well-covered files (result-formatting, tools-utility, auto-layout, workflow-result-state) are mostly leaf utilities, so the headline number overstates how much of the agent's behavior is actually exercised.

Add unit/integration tests for, at minimum:

  • the texera-agent.ts ReAct loop — step-tree construction, HEAD/checkout, stop/abort, error steps, settings effects;
  • the CRUD and execution tools (positive + error/[ERROR] paths);
  • context assembly in context-utils.ts;
  • the API clients (workflow-api, compile-api, backend-api) against mocked HTTP, including bad/malformed responses.

Tests should cover both positive and negative paths (invalid input, missing config, backend errors), per the project testing guidelines.

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions