Skip to content

ref(agent): Remove model handoff, Turn router, and model profiles - #2681

Merged
dcramer merged 4 commits into
mainfrom
ref/remove-model-handoff
Nov 4, 2026
Merged

dcramer merged 4 commits into
mainfrom
ref/remove-model-handoff

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Every agent Turn now runs on one model at one reasoning level. The default is anthropic/claude-opus-5.5 at high. Set the model with createApp({ modelId }) or AI_MODEL. Set the reasoning level with AI_REASONING_LEVEL.

Removed

  • The handoff tool and agent/handoff.ts, with handoff compaction (compactContextForHandoff, the handoff compaction mode, and the profile_changed discard).
  • The Turn router (services/turn-router.ts), its prompt blocks, and the router attachment previews in prompt.ts.
  • Model profiles: model-profile.ts, createApp({ profiles, defaultProfile }), AI_HANDOFF_MODEL, AI_MODEL_PROFILES, and the spawnAgent profile input.
  • The router eval suite (evals/router/, evals-router.yml, the router harness and config, evals:router) and evals/integration/coding/handoff.eval.ts.
  • openspec/changes/model-handoff.
  • Dashboard rendering of handoff and Turn route rows, and profile and reasoning fields on event models.

The fast, Guardian, reranker, vision, and web search models are unchanged. spawnAgent keeps its reasoning_level input.

Rollout and data

  • Stored handoff and turn_routed rows stay readable. Replay applies a legacy handoff's replacement history and skips routing rows, so checkpoints still resume. The report API and dashboard skip both types. New writes of either type are rejected.
  • Auxiliary costs still count the router cost on old turn_routed rows.
  • A resumed Turn ignores its stored route and uses the configured model.
  • No schema change. junior_agent_invocations.model_profile stays in the schema but code no longer reads or writes it. It is nullable with no default, so new rows leave it NULL and old pods can still write it during the rolling deploy. A follow-up PR drops the column after this ships.

Prod cost and latency

No change. Prod has run one default profile (Opus 5.5, high) with no Turn router since getsentry/junior-prod#589. This PR makes that the only path.

junior-prod follow-ups when this ships

  • server.ts: replace the Normalize egress auth-required for broker-backed OAuth #589 block (defaultProfile: "default" and profiles.default = { modelId: "anthropic/claude-opus-5.5", reasoningLevel: "high" }) with modelId: "anthropic/claude-opus-5.5", or drop it to use the default. JuniorAppOptions no longer has profiles or defaultProfile, so typecheck fails until this changes.
  • Check the Vercel env for AI_MODEL, AI_REASONING_LEVEL, AI_HANDOFF_MODEL, and AI_MODEL_PROFILES. AI_MODEL now sets the agent model when createApp omits modelId. Remove the two handoff and profile variables.
  • app/skills/self-improve/SKILL.md line 73 tells the agent to use handoff. Remove that sentence.

Known gap

The #2585 memory recall gap still exists. handoff.eval.ts was its only eval, so this PR removes that coverage. Thomas owns the fix.

Checks

  • pnpm typecheck (junior, dashboard, evals), pnpm lint (includes file length, test architecture, and migration metadata), and pnpm skills:check pass.
  • Dashboard vitest passes. @sentry/junior vitest: 3126 passed; only attachment-s3-storage.test.ts fails here because the sandbox has no local S3 endpoint (file untouched). Dashboard e2e and evals run in CI only (no Chrome or gateway key in the sandbox).

via @dcramer.

--

View Session [Sentry]

Every agent Turn now runs on one model (default anthropic/claude-opus-5.5)
at one reasoning level (default high). Set the model with createApp
modelId or AI_MODEL, and the reasoning level with AI_REASONING_LEVEL.

Remove the handoff tool, the Turn router, model profiles, the router
eval suite, and handoff.eval.ts. Stored handoff and turn_routed events
stay readable: replay applies legacy handoff replacement history and
skips routing rows, and the report API and dashboard skip both. Drop the
unused junior_agent_invocations.model_profile column.

Co-Authored-By: David Cramer <[email protected]>
@vercel

vercel Bot commented Nov 4, 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 Nov 4, 2026 8:59pm UTC

Request Review

@sentry-junior sentry-junior Bot added the trigger-evals Run evals on a PR label Nov 4, 2026
sentry-junior Bot and others added 2 commits November 4, 2026 20:12
Drop migration 0077. The column is nullable text with no default, so new
inserts leave it NULL and old pods can still write it during rollout.
A follow-up removes the column after #2681 deploys.

Co-Authored-By: David Cramer <[email protected]>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

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

Review screenshots in Frameshift

Conversation Detail · Desktop
Conversation Detail · Desktop
Changed
Conversation Detail · Mobile
Conversation Detail · Mobile
Changed
Conversation Event Details · Desktop
Conversation Event Details · Desktop
Changed
Conversation Event Details · Mobile
Conversation Event Details · Mobile
Changed
Conversation Event Details Mobile · Desktop
Conversation Event Details Mobile · Desktop
Changed
Conversation Event Details Mobile · Mobile
Conversation Event Details Mobile · Mobile
Changed
Show 8 more changed screenshots
Conversation Event Log · Desktop
Conversation Event Log · Desktop
Changed
Conversation Event Log · Mobile
Conversation Event Log · Mobile
Changed
Conversation Fork Dialog · Desktop
Conversation Fork Dialog · Desktop
Changed
Conversation Fork Dialog · Mobile
Conversation Fork Dialog · Mobile
Changed
Conversation Quick Question · Desktop
Conversation Quick Question · Desktop
Changed
Conversation Quick Question Answered · Desktop
Conversation Quick Question Answered · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed
System Cache Missing · Desktop
System Cache Missing · Desktop
Changed

@dcramer
dcramer marked this pull request as ready for review November 4, 2026 20:21
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 4, 2026
Evals ran on gpt-6-luna through the standard profile. They now run on
Opus 5.5, which exposed fixture gaps:

- delivery: the 1x1 stub image looks blank, so Opus would not send it.
  Return a real red panda PNG.
- calendar: "next tuesday" on a Monday is ambiguous, and Guardian read it
  differently. State the date.
- forks: the decision reply only said blue was picked, so Opus would not
  say the banner is blue. Say it was applied.
@dcramer
dcramer merged commit 69531bc into main Nov 4, 2026
51 checks passed
@dcramer
dcramer deleted the ref/remove-model-handoff branch November 4, 2026 21:40
dcramer added a commit that referenced this pull request Nov 8, 2026
…soning (#2866)

The behavioral and integration eval configs now default `AI_MODEL` to
`openai/gpt-6-luna` and `AI_REASONING_LEVEL` to `high`. This cuts eval
cost.

Since #2681, evals use the product default, Opus 5.5 at `high`. Before
#2681, the `standard` profile was Luna at `high`, and most eval Turns
ran on it.

- Both values use `||=`. `apps/example/.env.example` loads both as empty
strings, so `??=` would keep the blanks and fall back to Opus. A
non-empty `AI_MODEL` or `AI_REASONING_LEVEL` in the env or a local
`.env` file still selects another model.
- The Guardian suite already defaults to Luna. The classifiers suite
uses the decision model. Neither changes.
- The Roach recording key includes the model id, so the first run of
each case on Luna misses and records again.

## Fixes from the Luna runs

- **Auth MCP fixture:** the `budget-echo` tool said it only confirms the
MCP connection, so action review correctly rejected it for a budget
lookup. It now looks up a budget and returns one.
- **Lost reply:** when Slack rejects a reply, the failed-turn note for
the next Turn now says the reply was not delivered. Before, it said only
that the person may have seen an error. A local probe confirmed that the
lost reply does not reach the next Turn's model context. The
`delivery_failed` test in `local-agent-runner.test.ts` asserts the new
note.
- **History fixture eval:** a failing comparison now prints the first
row that differs, because the eval reporter cuts off the deep-equal
diff.

## Integration evals keep only runtime rules

Integration evals are hard pass/fail, so cases that depend on a model
choice moved to the behavioral suite (80% floor). Each moved case keeps
its assertions.

- To behavioral: no visible reply (`conversation/delivery.eval.ts`), the
reply after a lost reply (`conversation/delivery.eval.ts`), the creator
credential default for a new schedule (`scheduler/credentials.eval.ts`),
one event automation for an issue or a repo
(`coding/event-automations.eval.ts`), and the progress report after a
child agent's turn budget (`agent/child-agents.eval.ts`).
- Integration keeps the runtime part of two split cases: a rejected
Slack reply fails the Turn and stores nothing, and a child agent past
its turn budget gets a result Turn that succeeds.
- The eyes-reaction case now checks the Slack reaction, not a direct
`addReaction` call. If Junior did not keep the requested reaction, the
completed reaction would follow, so `reactions == ["eyes"]` still proves
the rule. A call from a Code Mode script now counts.
- The script output-limit case now expects the cut note from #2823
(`[cut: … full: /tmp/jr/…]`). The old `.junior/codemode` note no longer
exists on `main`.

Not run here: the eval suites themselves, because they need AI Gateway
access. `local-agent-runner.test.ts` and the `@sentry/junior` and
`@sentry/junior-evals` typechecks pass.

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0AHB7N2JCR%3A1794030228.239499 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0AHB7N2JCR%3A1794030228.239499)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0AHB7N2JCR%3A1794030228.239499/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <[email protected]>
Co-authored-by: David Cramer <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 4adb4f2d Deployed Nov 4, 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 trigger-evals Run evals on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant