Skip to content

fix(think): warn when skills hide system prompt fallback#1949

Open
cjol wants to merge 1 commit into
mainfrom
fix/1871-system-prompt-skills
Open

fix(think): warn when skills hide system prompt fallback#1949
cjol wants to merge 1 commit into
mainfrom
fix/1871-system-prompt-skills

Conversation

@cjol

@cjol cjol commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

This PR documents getSystemPrompt() as a fallback-only API and adds a warning for the confusing getSystemPrompt() plus getSkills() combination. Addresses #1871.

Why

  • getSkills() registers the skills catalog as a Session context block, so Think correctly treats getSystemPrompt() as fallback-only once skills are present.
  • That behavior is easy to miss because an agent can override both APIs and still run, but its getSystemPrompt() instructions will not reach the model.
  • We could merge getSystemPrompt() with context blocks, but that changes behavior for existing agents that use Session context as the system prompt source.
  • The safer path is to keep the current prompt assembly semantics, document them clearly, and warn when a likely footgun is detected.

Code Changes

  • Updates getSystemPrompt() JSDoc and the Think README to describe it as a legacy fallback used only when no Session context blocks are configured.
  • Emits a deduped [think] warning when getSkills() returns sources and the agent overrides getSystemPrompt().
  • Adds a regression test agent that reproduces the getSkills() plus overridden getSystemPrompt() setup and asserts the warning.
  • Adds a patch changeset for @cloudflare/think.

Open in Devin Review

@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0b2e6a8

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

This PR includes changesets to release 2 packages
Name Type
@cloudflare/think Patch
@cloudflare/agent-think Patch

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Jul 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

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

@cloudflare/ai-chat

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

@cloudflare/codemode

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

create-think

npm i https://pkg.pr.new/create-think@1949

hono-agents

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

@cloudflare/shell

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

@cloudflare/think

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

@cloudflare/voice

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

@cloudflare/worker-bundler

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

commit: 0b2e6a8

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