Skip to content

feat(cache-warming): Warm after reportBlocked Turns - #3211

Merged
BYK merged 1 commit into
mainfrom
feat/cache-warming-report-blocked
Nov 11, 2026
Merged

BYK merged 1 commit into
mainfrom
feat/cache-warming-report-blocked

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Cause. A run that ends with reportBlocked stops right after that tool batch, as noReply does. No final response comes, so the Turn starts no idle period. A child agent that ends blocked never warms, even though its parent often answers.

Change

  • The recorder method noReplyEnded() becomes answerToolEnded(toolName, gated). The agent calls it for every answer tool that ends the run. The recorder maps the core tool names: noReply gives no_reply, reportBlocked gives blocked. Gated Automation runs still start no idle period. The decision now lives in the recorder, so the scenario test covers it.
  • stop() starts the idle period from the reportBlocked request, the same way it does for noReply (feat(cache-warming): Warm after a Turn that ends with noReply #3162). That request holds the prefix that the next Turn reads: the next request appends the assistant tool call, its result and the new input to it.
  • app.cache_warming.turn_ending gets a new value, blocked. That keeps no_reply meaning noReply only. It is documented in the runCacheWarmup JSDoc.

Tests (cache-warming-segments.test.ts): the #3162 case now runs for both noReply and reportBlocked.

  • A gated run schedules nothing.
  • A non-gated run schedules a warmup and records the return gap.
  • Without the reportBlocked mapping, the reportBlocked case fails.

No UI change.

via @BYK.

--

View Session [Sentry]

A run that ends with reportBlocked stops right after that tool batch, like
noReply. Start the normal idle period from that request too, outside gated
Automation runs, and record it with turn_ending blocked.

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

vercel Bot commented Nov 11, 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 11, 2026 9:14pm UTC

Request Review

@BYK
BYK marked this pull request as ready for review November 11, 2026 21:37
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 11, 2026
@BYK
BYK merged commit 7bfca16 into main Nov 11, 2026
46 checks passed
@BYK
BYK deleted the feat/cache-warming-report-blocked branch November 11, 2026 21:38

@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 654a208. Configure here.

Comment thread packages/junior/src/chat/agent/index.ts Resolved
BYK added a commit that referenced this pull request Nov 11, 2026
…ed (#3218)

Follow-up to #3211 ([Bugbot
comment](#3211 (comment))).

`answerToolEnded` got `behavior.gated`, and the recorder stored no
ending for a gated Turn. Child-agent Turns are gated, and only gated
Turns have `reportBlocked`. So the `reportBlocked` ending never applied,
and a child agent's `noReply` started no idle period.

Now `answerToolEnded(toolName)` has no gate argument. The recorder skips
only Automation runs, using the Prompt mode (`automation`) that it
already gets in its `SystemPromptKey`. A child agent's `noReply` or
`reportBlocked` starts an idle period like any other Turn.

The answer-tool case in `cache-warming-segments.test.ts` covers both
endings: a child-agent Turn warms and records the gap, and an Automation
run schedules nothing.

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

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Ac630b15e2afdd86b09f440d1fe3ff152 -->

--

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

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

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>
BYK added a commit that referenced this pull request Nov 20, 2026
In a long design conversation, Junior wrote its own Plan item ids in
replies as `#1914`, `#3211` and `#2673`. Readers took them for
getsentry/junior PRs. One of them, #3211, is a real and
unrelated PR. Plan ids are global numbers, and the plan blocks rendered
them as `- #<id> (...)`, so the model copied the GitHub `#N` form.

Two fixes:

- **Model-facing ids are now `TODO-<n>`.** `updatePlan` and `listAgents`
results, `removed_ids`, `replaced_person_changes`, and the `<plan>` and
`<plan-delta>` blocks render `TODO-12`. `updatePlan` accepts only that
form, so a bare `12` or `#12` fails with a hint. Storage, the REST API,
and the dashboard keep numeric ids.
- **Planning rule:** Plan item ids are only for `updatePlan`. Do not
write them in a reply, a PR, an issue, or a message to a person. Name
the work instead.

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

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3Aaf43b9a62d41482f5a8b4154 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/local%3Aweb%3Aaf43b9a62d41482f5a8b4154)
[[Sentry]](https://sentry.sentry.io/explore/conversations/local%3Aweb%3Aaf43b9a62d41482f5a8b4154/?project=4510944073809921)

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

---------

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

This branch was successfully deployed

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

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant