Repository navigation
fix(chat): preserve model history across Turns - #1848
Merged
Merged
Conversation
Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
Co-Authored-By: David Cramer <[email protected]>
dcramer
marked this pull request as ready for review
September 11, 2026 17:16
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e8b5aa2. Configure here.
Co-Authored-By: David Cramer <[email protected]>
dcramer
approved these changes
Sep 11, 2026
dcramer
added a commit
that referenced
this pull request
Oct 15, 2026
In a Slack Conversation, a Turn that a person's Slack message did not start got a shorter tool list. This covers event, automation, Agent invocation (child result), and dashboard Turns. They dropped 11 tools: `slackPublicSearch`, `addReaction`, the 4 event automation tools, and the 5 scheduled automation tools. Explicit `/skill` Turns also dropped `loadSkill`. The provider caches tools before the system prompt and messages, so each change to the tool list wrote the whole Conversation to the cache again. **Change** - `createTools` registers these tools from the Conversation's Slack Location, not from the Source or Actor of the Turn. `loadSkill` is always registered, and the `includeLoadSkill` option is gone. - A tool can now be disabled for one Turn without leaving the tool list. `disableTools(tools, reason)` sets `disabledReason`. The tool adapter rejects calls to a disabled tool, direct or through `executeTool`, before hooks, action review, and the executor. The Turn context lists disabled tools in a `<disabled-tools>` block. The reason never goes into a tool description or schema, so the tool list stays the same. - The automation tools are disabled unless a person started the Turn with a Slack message (`isSlackMessageTurn`). Scheduled automation tools get the Slack Actor and Source only on those Turns. The existing checks in the tools still reject other Turns, so a child agent result that carries the person's Actor cannot create or change automations with that person's credentials. - `slackPublicSearch` is disabled without a Slack action token, and `addReaction` without a message. - `src/chat/README.md` documents the rule: tool registration depends on the Conversation, not on one Turn. **Why tests did not catch it** - `model-message-history.test.ts` (#1848) only compared two web Turns from the same origin. - `tool-registration.test.ts` asserted the drift as expected behavior. **Tests** - `tool-registration.test.ts`: message, scheduled automation, event, and Agent invocation Turns in one Slack Conversation get the same tool names, descriptions, and schemas. - `pi-tool-adapter.test.ts`: a disabled tool keeps the same tool list, and direct and `executeTool` calls are rejected before the executor runs. - `slack-schedule-tools.test.ts`: an Agent invocation Turn with the person's Slack Actor cannot create or delete automations, even when the tools are called directly. - `prompt.test.ts`: the Turn context lists disabled tools. **Not in scope** - Automation dispatch Conversations also change the system prompt, so a stable tool list alone does not keep the cache there. - Plugin tools cannot set `disabledReason` yet. No plugin tool changes by Turn today. Eval recordings will change, because more Turns now send these tools. <!-- junior-request-attribution:start --> via **David Cramer**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0B595QDZLL%3A1792042432.276599 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/slack%3AC0B595QDZLL%3A1792042432.276599) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0B595QDZLL%3A1792042432.276599/?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]>
This was referenced Nov 2, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
<runtime-turn-context>in model history while presentation projections can hide itRoot cause
The Conversation history cutover removed
<runtime-turn-context>before it wrote and replayed model history. The next Turn then inserted runtime context at the end of the prompt. This changed the cached prefix even when the context content did not change.Normal history must be append-only. Compaction and handoff remain the only operations that can replace it. Presentation code can omit internal context without changing model history.
Verification
pnpm --filter @sentry/junior exec vitest run tests/integration/model-message-history.test.ts tests/component/task-execution/checkpoint.test.ts tests/unit/chat/pi/conversation-events.test.ts tests/component/runtime/agent-run-model-handoff.test.tspnpm --filter @sentry/junior typecheckpnpm lintRefs #1844.
via David Cramer.
--
View Junior Session [Sentry]