fix(runtime-host): admit structured-only Messages and keep them model-visible - #4815
Open
ggbdpq wants to merge 2 commits into
Open
fix(runtime-host): admit structured-only Messages and keep them model-visible#4815ggbdpq wants to merge 2 commits into
ggbdpq wants to merge 2 commits into
Conversation
…-visible
A quote-only or attachment-only turn carried real model-facing context but
was rejected at the Host admission boundary ("Invalid Message text") and,
once persisted, dropped by the replay visibility predicate, which counted
only inline text length. The result was exactly apache#4804: structured-only
sends fail before the provider request, and any that persisted render as
an empty user bubble while the model never sees the quoted content.
- decodeMessageAdmissionContent now decodes the frame structurally and
applies the text rule itself: empty inline text is admissible when the
Message carries quotes or attachments; a Message with none of the three
still throws the same invalid-frame error. All turn/message admission
call sites share this function, so skill-only and structured-only
admissions now follow one rule.
- runtimeEventHasModelVisibleContent counts a user-authored text event
with quotes or attachments as model-visible even when the text is
empty, so the durable event survives replay and the existing quote
projection (formatQuoteRefs) reaches the model.
Red-green: both new tests (apache#4804-tagged) fail with the production files
stashed and pass with them restored.
Fixes apache#4804
Generated-by: GLM-5.3-Flash (ZCode)
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
Fixes #4804. Quote-only and attachment-only turns carried real model-facing context but were rejected twice on the way to the model, both times by a text-only admission assumption:
decodeMessageAdmissionContentthrewInvalid Message textfor empty inline text unless skill ids were present, so a staged quote or a lone attachment could not be submitted.runtimeEventHasModelVisibleContentcounted only inline text length, so a persisted user event with empty text and a non-empty quotes array was dropped as blocking-unsupported, producing thedurable current-run projection is not replayable/empty_text_skippedfailure the issue records.Now
decodeMessageAdmissionContentapplies the rule itself after structural decode — empty inline text is admissible when the Message carries quotes or attachments, and a Message with none of the three still throws the same invalid-frame error — and the visibility predicate counts structured user context (quotes/attachments) as model-visible. All turn/message admission call sites share the one function, and the model projection already renders quotes (formatQuoteRefs), so structured-only turns now reach the model with their content.Verification
node --test --test-name-pattern="#4804"on coreruntime-event+ runtime-hostprotocoldist teststurn.message.submitwith{text:'', quotes:[…]}/{text:'', attachments:[…]}{text:''}alone stillInvalid Message textprotocol.test.js(78),message-coordinator.test.js(73)npm run format:checkKnown Windows-environment failures encountered while verifying, both reproduced identically with these production files stashed (control runs) and therefore pre-existing:
hosted linked child roots share admission…(EBUSY unlink of a tempruntime.sqlite) and one EPIPE shutdown test inhost-kernel. The full Runtime Host suite additionally stalls on this machine on an unrelated file; CI on Linux/macOS is the authoritative full-suite run.Scope note: the renderer-side empty user bubble beside a quote chip is a display projection and is not addressed here; the durable event and the model request are correct after this change.
AI use
Implemented with ZCode (GLM-5.3-Flash): traced the issue's four named boundaries to the two blocking ones, applied the smallest contract change at each, and added red-green tests tagged with the issue number. The commit carries the
Generated-bytrailer.Checklist