Skip to content

Add Jest E2E tests for trueforge-core - #431

Open
ramantehlan wants to merge 5 commits into
mainfrom
sd/e2e-test
Open

Add Jest E2E tests for trueforge-core#431
ramantehlan wants to merge 5 commits into
mainfrom
sd/e2e-test

Conversation

@ramantehlan

@ramantehlan ramantehlan commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Adds a Jest E2E harness for @truefoundry/trueforge-core with a mocked LLM and a first orchestrator loop test.

Changes

  • Separate tests/e2e tree and jest.e2e.config.cjs, kept out of unit Jest
  • pnpm test:e2e / pnpm test:trueforge-core:e2e; core pnpm test runs units then E2E
  • Sample test: mocked text LLM, no tools, send + execute through AgentThreadOrchestrator

How was this tested?

  • pnpm --filter @truefoundry/trueforge-core test:e2e
  • pnpm --filter @truefoundry/trueforge-core typecheck

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Low Risk
Test-only and documentation changes; no production runtime or API behavior is modified. Default pnpm test for trueforge-core will take longer because E2E runs after unit tests.

Overview
Introduces a separate Jest E2E suite for @truefoundry/trueforge-core that exercises AgentThreadOrchestrator and AgentThread directly (mocked ILLM, no store/HTTP), mirroring production’s send → execute turn contract.

Tooling: jest.e2e.config.cjs scopes tests/e2e (60s timeout, maxWorkers: 1); unit jest.config.cjs ignores that tree. pnpm test:e2e / root test:trueforge-core:e2e were added; package test now runs unit Jest then E2E.

Coverage: Three scenarios with shared runOrchestratorTurn / expectTurn helpers (event trace, result, root context): text-only reply; create_sub_agent delegation and parent tool routing; pause on tool.approval.required and resume after USER_TOOL_APPROVAL. Mock streams and approval-gated write_note tooling live in E2E helpers; a long tests/e2e/README.md documents the harness.

Reviewed by Cursor Bugbot for commit 9144a39. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9144a39

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chiragjn chiragjn added the core label Aug 26, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a3b6b85. Configure here.

type: 'function',
function: {
name: 'create_sub_agent',
arguments: JSON.stringify({ name: 'worker', input: 'do the delegated task [output]' }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mock tool-call arguments disagree

Medium Severity

createSubAgentStream streams create_sub_agent arguments with input do the delegated task, but the generator return uses do the delegated task [output]. AgentThread persists and executes result.value.output, so the child is spawned with a different task than the streamed delta. The [output] suffix looks like a leftover debug marker rather than a real completion.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a3b6b85. Configure here.

Comment thread packages/trueforge-core/tests/e2e/orchestrationWithTools.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants