Skip to content

Chat: a tab that was away learns how its requests ended (4.iii 6f, parity 9, draft) - #3330

Closed
mattzcarey wants to merge 2 commits into
slim/chat-fn-6f9from
slim/chat-fn-6f10
Closed

mattzcarey wants to merge 2 commits into
slim/chat-fn-6f9from
slim/chat-fn-6f10

Conversation

@mattzcarey

Copy link
Copy Markdown
Member

DRAFT, 4.iii 6f parity step 9, stacked on #3322. A tab that was away when its request ended learns how it ended, per arch's ruling (6f terminals).

ChatDeps gains kv, the object's synchronous key-value storage (the existing RecentTerminalsKv type). The module writes the same bounded record under the same key (cf:chat-recent-terminals, 16 requests), so released records read as they are.

  • Recorded: every end the definition sends, after sending it. A request dropped, or replaced under latest/merge, is recorded skipped. A chat clear forgets the record.
  • Read in resumeChat(…, requestIds): the request ids a tab says it still waits on.
    • The ones that ended are ended at once, with a replay done frame.
    • When nothing streams or waits, the newest that ended is offered as STREAM_RESUMING, and replayTurn on its ack sends its recorded end. That's the only frame a tab surfaces as the request's outcome, as ResumeHandshake does today.

Tests (the first three fail without the change; the clear test only guards the clear):

  • a request that ended while no tab was connected is offered and its end replayed on ack;
  • several ended requests: the older ones end at once, the newest follows its ack;
  • a clear forgets;
  • a dropped request is offered to a tab that comes back for it.

Cost: as today. One KV read and one write per request end. One KV read per resume request that names ids.

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 82fc0a7

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

@cloudflare/ai-chat

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

@cloudflare/codemode

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

hono-agents

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

@cloudflare/shell

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

@cloudflare/think

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

@cloudflare/voice

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

@cloudflare/worker-bundler

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

commit: 82fc0a7

@agent-think

agent-think Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ agents import sizes: no significant changes (3197c8c6 → 82fc0a7d, workflow run)

mattzcarey added a commit that referenced this pull request Nov 27, 2026
…placed connections only for double ends (until #3330), README
mattzcarey added a commit that referenced this pull request Nov 27, 2026
* test(nightly): a seeded reset fuzz on the fault Worker

* test(fuzz): write each run's requests and trace to results/, check replaced connections only for double ends (until #3330), README

* test(fuzz): each tab and the resetter draw from their own seeded stream; a run must reset the object at least once

* docs(nightly): FUZZ_MINUTES must be 2 or more

* test(fuzz): same draws per step whatever the socket did, cancel only a request still streaming, the object must restart, the seed in each test's name, every connection's frames and the transcript in results/

* test(fuzz): the late tab's frames in results/
@mattzcarey

Copy link
Copy Markdown
Member Author

Closed to drain open PRs (COMMON, 27 Nov). This PR's commits are commits of #3361 (the switch), which now sits directly on #3298. The branch is kept.

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