Skip to content

Think on the harness: reply attachments to the turn's channel; a replayed turn's messenger context (C4, completes #3489) - #3493

Merged
mattzcarey merged 7 commits into
mainfrom
slim/deliveries-channels-c4-attachments-2
Nov 28, 2026
Merged

mattzcarey merged 7 commits into
mainfrom
slim/deliveries-channels-c4-attachments-2

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Completes #3489. On the harness-backed Think, a turn's reply attachments are delivered to its channel as on Think, and a replayed turn's response hook keeps its messenger context. The upgrade tests' last fixture is now 0.24's exact recovery job.

  • Reply attachments, as on Think:

    • renderAttachment() is added (default: defaultAttachmentText).
    • A turn's attachments go with onChatResponse's result, and each one that renders is posted to the turn's channel first, as an interim notice.
    • deliverNotice defaults to the active turn's channel, and to its messenger thread while that turn or its response hook runs, as Think's _activeChannelId() does. Outside a turn, a messenger notice still names its thread. New tests: a tool in a messenger turn and a response hook each call deliverNotice() with no channel, and the notice lands on the turn's thread, on both configs. The tool test fails on the shell at f641312.
    • Web attachment notices are posted whatever is pending, as Think's _renderChannelAttachments does.
    • attachment-consumption goes from 0 to 4/5; the fifth calls the class's private _renderChannelAttachments, so it's class-only with a new successor. actions-attach-reply goes from 0 to 11/12; the twelfth is a durable-pause attachReply, which is harness's actpause_ area.
  • Messenger context in response hooks (items owed from Think on the harness: messenger recovery, the messenger context, and channel continuations (C4 part 3, completes #3453) #3477's review):

    • A terminal report replayed after a reset gets the messenger context from its own turn's user message, read only for a turn that didn't run in this isolate. It reads the reply's stored path newest first and stops at the first user message, so only the rows up to it are loaded.
    • The kept context is forgotten before anything in the end hook can throw.
  • Tests (Devin's notes on test(think): upgrade fixtures as [email protected] wrote them; a mid-reply channel continuation successor (completes #3484) #3489):

    • The recovery-job fixture is the run as 0.24 left it: waiting on its backoff sleep, with the step journaled.
    • Open recovered-reply deliveries count as open reply runs.
    • The mid-reply channel-recovery successor checks that recovery continued the reply (recoveryKind: "continue").
  • Cost: nothing on an ordinary turn. One deliverNotice per rendered attachment, as on Think. On a messenger agent's replayed terminal report, the stored path read back to the turn's user message (a transcript sync when the reply isn't stored).

  • Not covered: there's no test for the replayed-report window, since it needs a reset between a saved reply and its report.

Tests ran on both configs: attachment-consumption, actions-attach-reply, the upgrade files, channel-recovery, messengers (shell 123/131, the 8 class-only), deliver-notice, messenger-replay, plus hooks and think-session's response and messenger tests, with none lost against main. The compat table was regenerated before the last push (the two new tests pass on both configs and aren't in it yet): 720 of 1357 (87 class-only, 10 of them mechanics-only, 6 ruled out, the rest each with a successor).
Left as on Think: a turn's attachments are one list per agent, so a turn that begins before the previous turn's end hook reads them replaces them (the class does the same).


Devin Review

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0d38f9c

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

@pkg-pr-new

pkg-pr-new Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@3493

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@3493

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@3493

hono-agents

npm i https://pkg.pr.new/hono-agents@3493

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@3493

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@3493

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@3493

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@3493

commit: 0d38f9c

@agent-think

agent-think Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ agents import sizes: no significant changes (372822c4 → 0d38f9c9, workflow run)

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

…s the messenger context from the stored user message; the kept context is forgotten before anything in the end hook can throw
…lt and are posted to the turn's channel; deliverNotice defaults to the active turn's channel and messenger thread
…red-reply runs fail; the held reply is silent until its job; the lease test checks ActionPendingError; a mid-reply channel continuation successor that checks recovery continued
…ssenger turn's response hook; web attachment notices wait while the reply waits on a client; a turn's attachments survive the next turn's start; a replayed report reads its turn's path from storage; the compat total
…hen the running turn's messenger thread, then the responding context, as on Think; web attachment notices post whatever is pending, as on Think; no attachment snapshot that never took effect; a replayed report reads its turn's user message newest first, stopping at it; tests: a tool's and a response hook's notice land on the turn's thread
@mattzcarey
mattzcarey marked this pull request as draft November 28, 2026 13:01
@mattzcarey
mattzcarey force-pushed the slim/deliveries-channels-c4-attachments-2 branch from 20e8685 to 0d38f9c Compare November 28, 2026 13:01
@mattzcarey
mattzcarey marked this pull request as ready for review November 28, 2026 13:03
@mattzcarey
mattzcarey merged commit d96d8ba into main Nov 28, 2026
18 checks passed
@mattzcarey
mattzcarey deleted the slim/deliveries-channels-c4-attachments-2 branch November 28, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant