host tests: wait for new-room skills to load before simulating bot message#4941
Open
habdelra wants to merge 1 commit into
Open
host tests: wait for new-room skills to load before simulating bot message#4941habdelra wants to merge 1 commit into
habdelra wants to merge 1 commit into
Conversation
…ssage
Two acceptance tests in commands-test.gts intermittently failed on CI
(shard 17 of the host test suite):
- "ShowCard command added from a skill, can be automatically executed
when agentId matches" — timed out waiting for apply-state="applied"
- "command request with arguments that do not match the json schema
gets an 'invalid' result" — warning text was 'No command for the
name "show-card_566f" was found' instead of the expected JSON-schema
validation message
Both tests click [data-test-create-room-btn] and then immediately
simulateRemoteMessage with a command request for show-card_566f, which
is a function on the env skill that the new room auto-attaches. The new
room's processRoomTask is still mid-loadSkills when the simulated bot
event lands; message-builder walks builderContext.skills and calls
store.get<Skill>(skill.cardId), but the env skill isn't in the store
yet, so the request never resolves to a codeRef and command-service
falls into the "No command for the name X was found" branch instead
of executing or running the JSON-schema validator.
Add waitForNewRoomSkillsLoaded(roomId): polls until the room's
enabledSkillCards is populated *and* roomResource.commands.length > 0
(commands is computed from the loaded skill instances in the store, so
a non-empty list proves loadSkills finished and the skill's @field
commands field is materialised). On timeout it throws with a JSON
diagnostic snapshot of skillsConfig + the room resource's view, so a
future flake reports enough state to distinguish "no skill loaded" from
"skill loaded but commands missing".
Use the new helper in the two failing tests and in the third sister
test ('is not automatically executed when agentId does not match'),
which has the same setup and was passing by luck. Also add inline
diagnostic logging in the two failing tests around the assertions that
have been flaking so we capture rendered apply states, warnings, and
room/skill state if either still misses after the fix.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces CI flakiness in host acceptance tests by ensuring a newly created AI assistant room has finished loading its default skills (and derived commands) before simulateRemoteMessage dispatches command requests that depend on those skills being present in the store.
Changes:
- Added
waitForNewRoomSkillsLoaded(roomId)test helper that waits until the room’s enabled skills are present and the room resource exposes non-emptycommands, with enriched timeout diagnostics. - Updated three acceptance tests to await skill/command readiness before simulating
show-card_566fcommand requests. - Added targeted console diagnostics on the previously-flaking assertions to improve future failure triage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/host/tests/helpers/index.gts | Adds a polling helper that waits for new-room skill loading to complete and enriches failures with diagnostic state. |
| packages/host/tests/acceptance/commands-test.gts | Uses the new helper to remove the skill-load race before simulating bot command requests; adds diagnostic logging around flaky assertions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two acceptance tests in
commands-test.gtsintermittently failed on CI (shard 17 of the host test suite):apply-state="applied"No command for the name "show-card_566f" was foundinstead of the expected JSON-schema validation messageRoot cause
Both tests click
[data-test-create-room-btn]and then immediatelysimulateRemoteMessagewith a command request forshow-card_566f, which is a function on the env skill that the new room auto-attaches.The new room's
processRoomTaskis still mid-loadSkillswhen the simulated bot event lands;message-builderwalksbuilderContext.skillsand callsstore.get<Skill>(skill.cardId), but the env skill is not in the store yet, so the request never resolves to acodeRefandcommand-servicefalls into the "No command for the name X was found" branch instead of executing or running the JSON-schema validator.Fix
waitForNewRoomSkillsLoaded(roomId): polls until the room'senabledSkillCardsis populated androomResource.commands.length > 0(commands is computed from the loaded skill instances in the store, so a non-empty list provesloadSkillsfinished and the skill's@field commandsfield is materialised). On timeout it throws with a JSON diagnostic snapshot ofskillsConfig+ the room resource's view, so a future flake reports enough state to distinguish "no skill loaded" from "skill loaded but commands missing".Test plan
🤖 Generated with Claude Code