Fill missing LLM capability fields from fallback constant (CS-11252)#5037
Fill missing LLM capability fields from fallback constant (CS-11252)#5037FadhlanR wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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()inruntime-common/ai/prompt.tsto merge event capability fields withDEFAULT_FALLBACK_MODELS, and fall back toDEFAULT_FALLBACK_MODEL_ID(replacingDEFAULT_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.
| # CS-11252 — ai-bot fills capability fields from fallback constant | ||
|
|
||
| > Scratch planning doc. Deleted before this PR merges. |
backspace
left a comment
There was a problem hiding this comment.
pending temporary documentation removal
Summary
prompt.toolsSupported === truegate silently stripped tools for older rooms whoseAPP_BOXEL_ACTIVE_LLMevents predate thetoolsSupported/inputModalitiesfields.getActiveLLMDetails(packages/runtime-common/ai/prompt.ts) by looking up the curated row inDEFAULT_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.toolsSupported: falseon the event is still respected. Non-curated models (not in the constant) stay as today; the constant doesn't cover them.Test plan
pnpm testinpackages/ai-bot: newfill missing capability fields from fallback constantmodule — 5 cases green: older curated room fills caps, explicitfalserespected, healthy room passthrough unchanged, non-curated model stays undefined, no-event branch usesDEFAULT_FALLBACK_MODEL_ID.set model in promptmodule unchanged (5 tests still green).pnpm lintclean onpackages/ai-botandpackages/runtime-commonfor the files touched.Linked
CS-11252 — depends on T1 (#4949, merged).
🤖 Generated with Claude Code