Skip to content

Add Jest E2E tests for trueforge-core - #431

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

Add Jest E2E tests for trueforge-core#431
ramantehlan wants to merge 3 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
Changes are limited to test configuration, fixtures, and documentation; no production runtime or API behavior is modified.

Overview
Introduces a separate Jest E2E suite under packages/trueforge-core/tests/e2e that exercises AgentThreadOrchestrator and AgentThread with mocked ILLM streams and no session store, matching production’s send then execute flow.

Tooling: jest.e2e.config.cjs (60s timeout, maxWorkers: 1); unit jest.config.cjs ignores tests/e2e/. Core pnpm test now runs unit Jest then E2E; pnpm test:e2e and root pnpm test:trueforge-core:e2e run E2E only.

Tests & helpers: A text-only happy path asserts events, terminal result, and root context. A dynamic sub-agent scenario uses DynamicSubAgents / create_sub_agent, with runOrchestratorTurn + expectTurn comparing send types, compacted execute trace, result, and root context (child thread ids normalized to <child>). Mock LLM helpers and optional turn-flow logging support debugging. A long tests/e2e/README.md documents scope and planned programs.

Reviewed by Cursor Bugbot for commit f0a0848. 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: f0a0848

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