Skip to content

test(context): restore provider init and per-provider tool tests - #3109

Merged
mattzcarey merged 2 commits into
mainfrom
slim/context-tests
Nov 24, 2026
Merged

mattzcarey merged 2 commits into
mainfrom
slim/context-tests

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Restores the tests #2773 deleted with context-init.test.ts and context-search.test.ts (verify finding F7). They pin two things nothing else on main covers:

  • ContextBlocks calls a provider's init(label) once, before get(), with each block's own label, and a provider without init still loads.
  • Which tools exist per provider kind: no search_context without a search provider, and a read-only search provider gets search_context but not set_context.

The files are as they were before #2773, with one change: ContextBlocks.freezeSystemPrompt() is now renderSystemPrompt(). Tests only, no runtime change.

Each behaviour fails with its line in context/blocks.ts removed or broken (20 tests, two files):

change to blocks.ts tests that fail
init call removed 8 (each label, before get, once, the label used in get and indexing)
init called on a provider that has none 12 (both "without init" tests, and every search test, whose provider has no init)
init also called on every read 2 ("before get", "only once")
search_context always offered 1 ("no search_context when no search providers")
a read-only search provider counted as writable 1 ("search_context but no set_context")

After Devin's review, three tests are stronger (22 now), each also failing with its line broken: the indexing test passes a title and checks that it is the key used (fails when set_context ignores the title); a remind block read afresh does not call init again (fails when init runs on every read); an empty read-only search block still renders (fails when only writable blocks render when empty).

@changeset-bot

changeset-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b410ac2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@agent-think

agent-think Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🟡 agents import sizes: 1 entry point grew

Entry point Exports Largest gzip change Size now
🟡 agents/sessions 1 resized +258 B (+1.64%) 15.7 KiB
Changed exports (1)
Import Gzip change Size now
🟡 agents/sessions#Sessions +258 B (+1.64%) 15.7 KiB
How this works

Each runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement.

Compared 9be3183e → b410ac2a · workflow run · reported by agent-think[bot]

@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

agents

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

@cloudflare/ai-chat

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

@cloudflare/codemode

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

hono-agents

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

@cloudflare/shell

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

@cloudflare/think

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

@cloudflare/voice

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

@cloudflare/worker-bundler

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

commit: b410ac2

devin-ai-integration[bot]

This comment was marked as resolved.

@mattzcarey
mattzcarey merged commit 788219f into main Nov 24, 2026
26 checks passed
@mattzcarey
mattzcarey deleted the slim/context-tests branch November 24, 2026 12: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