Skip to content

test(evals): Add the agent test fixture and move the first slice - #2006

Merged
dcramer merged 13 commits into
mainfrom
claude/junior-2001-first-slice-96572c
Oct 2, 2026
Merged

dcramer merged 13 commits into
mainfrom
claude/junior-2001-first-slice-96572c

Conversation

@dcramer

@dcramer dcramer commented Oct 1, 2026

Copy link
Copy Markdown
Member

Adds the agent test fixture from #2001 and moves the first slice of tests onto it: the fork tests, the Slack steering tests, the continuity eval, and the scheduler credentials eval. Every turn under test runs the real agent and model. Earlier turns come from loaded history, not model fakes.

A test drives one Junior app only through its routes and reads results through the reporting API:

test("recalls the earlier ask", async ({ run }) => {
  const conversation = await run(mention("what did i just ask?"), {
    history: [mention("I need the budget by Friday."), reply("Got it.")],
    criteria: rubric({ pass: ["Recalls the budget and Friday."] }),
  });
  expect(conversation.replies).toHaveLength(1);
});

Product changes in @sentry/junior (no change to agent behavior):

  • createApp() resets runtime config on every call, so a later app cannot inherit an earlier app's models, profiles, limits, or Slack settings. It also accepts limits (turn timeout, tool-call limit, slice limit, context window, consecutive automated turns) and slack.crossActorMidRunMode.
  • Slack ingress, heartbeat, OAuth callbacks, spawn bindings, ACP, events, and dashboard web input now send to one conversation work queue. Several used to call getVercelConversationWorkQueue() directly. A host can swap the Vercel transport for an in-process queue with conversationWorkQueue: (consume) => queue. In-process delivery reuses the callback's kill switch, deadline, and rejection rules.
  • Title work has an owner. The queue worker hands title generation and the Slack DM title projection to waitUntil. A turn still does not wait for slow titles.
  • Postgres pools have error listeners.

Fixture (packages/junior-evals/src/fixture/):

  • Inputs: signed Slack Events API webhooks and the conversations API.
  • Results: replies, tool calls, reactions, and turn states. Slack replies are the thread posts people saw, including the opt-out acknowledgement that Junior does not store.
  • onProgress: watches real AI Gateway and Slack traffic, so a test can send input while a turn runs. It never fakes a response.
  • History: loaded history writes the same rows as a real turn, and a fixture test compares the two for web and Slack. history also accepts sanitized recorded conversations; one is included.

Test rules:

  • scripts/check-test-architecture.mjs adds the five rules from the issue. Today's violations are listed in scripts/test-architecture-baseline.json, and the check fails unless an entry is lowered when its file is fixed.
  • anti-slop/no-module-mocking is on for integration and component tests. Today's files are excluded.

Review notes:

  • The web routes are createJuniorApi() behind a signed-in test viewer, not the dashboard package. Workspace packages are installed as copies, so loading the dashboard in tests would load a second copy of the Junior runtime.
  • Each Conversation is read as the person who started it. Without that, mention-only Slack threads are private by default and their payloads would be hidden.
  • The fork and Slack ingress API checks stay in packages/junior/tests without model fakes. Duplicate deliveries and late stops need exact timestamps the fixture does not send.
  • Three passes over the migrated tests cost about $0.53 in agent model spend and 96 AI Gateway requests per pass. Earlier slow cases came from test prompts that caused many tool calls. After fixing those prompts, every case runs in 5–27s.

Later steps from #2001, not in this PR:

  • Inputs: heartbeat(), githubWebhook(), event(), and completeAuth().
  • webFetch/webSearch replay in the fixture.
  • Failing packages/junior/tests on AI Gateway requests.
  • Removing the old harness, model fakes, streamFn, and the test-only conversationWork option.
  • Policy updates.

Refs #2001

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Oct 2, 2026 12:00am UTC

Request Review

@sentry-evals

sentry-evals Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Sentry Evals

junior-behavioral

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 61 7 0 $0.87 2.6M 1,304.12s

Base commit 2b4343b has no eval run to compare against.

junior-guardian

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 40 0 4 $0.01 0 129.23s

Base commit 2b4343b has no eval run to compare against.

junior-router

Run Status Passed Failed Errored Cost Tokens Duration
Head Complete 12 0 0 $0.00 0 26.58s

Base commit 2b4343b has no eval run to compare against.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

3 screenshot changes — 3 changed · 0 added · 0 removed

Review screenshots in Frameshift

Code Repository · Desktop
Code Repository · Desktop
Changed
Conversation Event Details · Desktop
Conversation Event Details · Desktop
Changed
Conversation Fork Dialog · Desktop
Conversation Fork Dialog · Desktop
Changed

@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.

Stale Bugbot comment from a previous run.

dcramer and others added 11 commits October 1, 2026 16:35
Add the agent test contract rules to the test architecture check. Each
rule starts from a baseline list of the files that break it today, and
the check fails when a list is not lowered after a fix. Turn on
anti-slop/no-module-mocking for integration and component tests with
today's files excluded.

Track Slack title projection with title generation, and give both to
the queue worker's waitUntil. Add error listeners to Postgres pools.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
createApp() now starts from the environment defaults before it applies
options, so a later app cannot inherit models, profiles, limits, or
Slack settings from an earlier app. Add a limits option for the turn
timeout, tool-call limit, slice limit, context window, and consecutive
automated-turn limit, and a Slack option for the cross-actor steering
mode.

Every route and worker now sends to one conversation work queue: Slack
ingress, heartbeat, OAuth callbacks, spawn bindings, ACP, events, and
web input through the dashboard API. A host can replace the Vercel
transport with an in-process queue that receives a consume function.
The worker gives title work to the app's waitUntil.

Move dashboard route registration into dashboard-routes.ts to keep
app.ts under the file length limit.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the agent test fixture in packages/junior-evals/src/fixture. A test
calls run() with an input, continues or forks the returned Conversation,
and reads replies, tool calls, reactions, and turn states through
Junior's reporting API. Inputs go through the app routes: signed Slack
Events API webhooks and the conversations API. The real agent and model
run every turn. Loaded history writes earlier turns with the product
store functions, and insert functions write setup data the same way.

Move the continuity eval and the scheduler credentials eval to the
fixture, and add fork evals that run real turns.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fork and Slack steering behavior that needs the agent now runs as
integration evals on the agent test fixture. Steering cases send
messages from onProgress while the first model request waits, so the
real ingress, mailbox, and reply policy decide what happens.

The fork API test now builds its source history from stored rows and
keeps the API contract checks: idempotent concurrent forks, the frozen
history version, privacy, and nested fork notes. The Slack ingress test
keeps the duplicate-delivery and late-stop rules, which do not need the
agent. Slack replies in call results come from Slack thread posts, so
posts that Junior does not store, such as the opt-out acknowledgement,
count as replies people saw.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Loaded history now writes the same rows as a real web or Slack turn:
the stored input, the turn lifecycle, the agent input, the accepted
reply, and handled markers. A fixture test compares the rows with a
real turn, without ids, timestamps, model usage, and per-run routing
and context.

history also accepts a recorded conversation: sanitized event rows
exported from a real Conversation. The export drops the event types
that forks do not copy and replaces people and workspace identifiers.
The loader inserts the rows as they are, as a fork copies rows. A
fixture test continues every recording, starting with a launch planning
conversation.

Add insert functions for scheduled automations, event automations,
watches, memories, and credentials.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Send every input through one path: the first web input creates the
Conversation and the first Slack mention is the thread root. Move
result shaping into results.ts, use toJsonValue for transcripts, and
drop insert functions that no test uses.

Share the queue callback's kill switch, deadline, and rejection rules
with in-process consumption instead of copying them. Give the Slack
title projection to the worker's waitUntil through the Slack runtime,
so a turn still does not wait for slow titles.

Slack and team ids in recordings must contain a digit, so words such as
TRACKING stay. Steering evals ask for a plain two-sentence reply, which
keeps each turn to one model call instead of several canvas edits.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fixture signed fork requests and later web messages in as the
default web person. A mention-only Slack thread is private to the
person who started it, so forking it returned 403. Every API request
for a Conversation now signs in as its starter, and the fork belongs
to that person. Add the private Slack thread fork case.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The delivery eval required reportProgress for a lookup that takes less
than a second. Whether to post progress then is the model's choice, so
the case now checks the grounded answer in one reply without narration.

The event automation credentials eval penalized an offer to replace
Alice's automation. Any channel member may delete it today, so the
rubric now fails only an actual delete or replace, and the test asserts
that no delete call ran.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Anyone may edit or delete a public automation, so an offer to replace
Alice's task is allowed. The case now fails only an actual delete or
replace in the turn, and asserts that no delete call ran.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inputs must show real user behavior when a judge scores the outcome.
A case that only asserts a deterministic outcome, such as turn routing,
may use short manufactured inputs. Record this in the eval policy and
README, and point new cases at the agent test fixture.

Drop the fork case that overlapped the fork-of-a-fork case and judged a
contrived question, and remove inputs and assertions that tested
nothing. The eval policy now names the fixture's call results as the
assertion surface for fixture tests.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
mcp-oauth-client-auth.test.ts landed on main before the rule and resets
modules, so it starts on the runtime-config-mutation list.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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.

Stale Bugbot comment from a previous run.

Loaded Slack history always stored the Conversation as public. A real
mention-only turn learns no channel type, so Junior treats it as
private, and a later thread message in a channel makes it public. The
loader now applies the same rule to each history turn. Direct messages
arrive as message events with an im channel type, as Slack sends them.

The loaded history test also compares the stored visibility with a
real turn.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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 and found 1 potential issue.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 2b03a64. Configure here.

A real direct message turn stores explicitMention as true, because
Junior routes every direct message like a mention, even without the
@junior token. Loaded history now states that rule, and a fixture test
compares DM history with a real DM turn. The comparison tests also
require the real turn to succeed, so a failed turn reads as such.

Refs #2001

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dcramer
dcramer merged commit c978104 into main Oct 2, 2026
49 of 53 checks passed
@dcramer
dcramer deleted the claude/junior-2001-first-slice-96572c branch October 2, 2026 00:23

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 30941667 Deployed Oct 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant