Skip to content

Fill missing LLM capability fields from fallback constant (CS-11252)#5037

Open
FadhlanR wants to merge 1 commit into
mainfrom
cs-11252-t2-ai-bot-fills-capability-fields-from-fallback-constant
Open

Fill missing LLM capability fields from fallback constant (CS-11252)#5037
FadhlanR wants to merge 1 commit into
mainfrom
cs-11252-t2-ai-bot-fills-capability-fields-from-fallback-constant

Conversation

@FadhlanR
Copy link
Copy Markdown
Contributor

Summary

  • ai-bot's strict prompt.toolsSupported === true gate silently stripped tools for older rooms whose APP_BOXEL_ACTIVE_LLM events predate the toolsSupported / inputModalities fields.
  • Fill the missing fields once at the source in getActiveLLMDetails (packages/runtime-common/ai/prompt.ts) by looking up the curated row in DEFAULT_FALLBACK_MODELS (introduced in CS-11249: realm-independent fallback models + host wire/picker integration #4949). The bot's gate is unchanged — the value reaching it is now correctly populated.
  • Strict undefined check, so an explicit toolsSupported: false on the event is still respected. Non-curated models (not in the constant) stay as today; the constant doesn't cover them.

Test plan

  • pnpm test in packages/ai-bot: new fill missing capability fields from fallback constant module — 5 cases green: older curated room fills caps, explicit false respected, healthy room passthrough unchanged, non-curated model stays undefined, no-event branch uses DEFAULT_FALLBACK_MODEL_ID.
  • Existing set model in prompt module unchanged (5 tests still green).
  • pnpm lint clean on packages/ai-bot and packages/runtime-common for the files touched.

Linked

CS-11252 — depends on T1 (#4949, merged).

🤖 Generated with Claude Code

Older rooms have APP_BOXEL_ACTIVE_LLM events that predate the
toolsSupported / inputModalities fields, so the ai-bot's strict
`prompt.toolsSupported === true` gate silently strips tools for them.
Fill the missing fields once at the source in getActiveLLMDetails by
looking up the curated row in DEFAULT_FALLBACK_MODELS. Explicit `false`
on the event is respected; non-curated models stay as today.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Host Test Results

    1 files      1 suites   1h 49m 24s ⏱️
2 841 tests 2 826 ✅ 15 💤 0 ❌
2 860 runs  2 845 ✅ 15 💤 0 ❌

Results for commit ca734c1.

Realm Server Test Results

    1 files      1 suites   12m 23s ⏱️
1 515 tests 1 514 ✅ 1 💤 0 ❌
1 606 runs  1 605 ✅ 1 💤 0 ❌

Results for commit ca734c1.

@FadhlanR FadhlanR marked this pull request as ready for review May 29, 2026 10:18
@FadhlanR FadhlanR requested a review from a team May 29, 2026 10:18
@habdelra habdelra requested a review from Copilot May 29, 2026 12:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Closes the "silent tools-off" hole on the ai-bot side for older rooms whose APP_BOXEL_ACTIVE_LLM events predate the toolsSupported / inputModalities fields. getActiveLLMDetails() now fills those missing fields from DEFAULT_FALLBACK_MODELS (keyed by model id), while a strict undefined check preserves explicit false values. The bot's prompt.toolsSupported === true gate is unchanged — the value reaching it is now correctly populated for the curated set.

Changes:

  • Rewrite getActiveLLMDetails() in runtime-common/ai/prompt.ts to merge event capability fields with DEFAULT_FALLBACK_MODELS, and fall back to DEFAULT_FALLBACK_MODEL_ID (replacing DEFAULT_LLM) when no active-LLM event is present.
  • Add a 5-case ai-bot test module covering curated fill, explicit-false respect, healthy passthrough, non-curated leave-undefined, and the no-event branch.
  • Add a scratch planning doc that the PR description and the doc itself say should be deleted before merge.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/runtime-common/ai/prompt.ts Fill missing toolsSupported / inputModalities from DEFAULT_FALLBACK_MODELS; default model to DEFAULT_FALLBACK_MODEL_ID.
packages/ai-bot/tests/prompt-construction-test.ts New module exercising fallback fill, explicit-value preservation, and non-curated/no-event paths.
docs/cs-11252-ai-bot-fallback-caps-plan.md Scratch planning doc; marked for deletion before merge.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +3
# CS-11252 — ai-bot fills capability fields from fallback constant

> Scratch planning doc. Deleted before this PR merges.
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.

agreed!

Copy link
Copy Markdown
Contributor

@backspace backspace left a comment

Choose a reason for hiding this comment

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

pending temporary documentation removal

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.

3 participants