fix(agent): load_skill carries an in-band truncation marker (#4163) - #4265
Open
iroiro147 wants to merge 1 commit into
Open
fix(agent): load_skill carries an in-band truncation marker (#4163)#4265iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
`load_skill` capped `output` at `MAX_SKILL_BODY_BYTES` (32 KiB) with `truncate_at_boundary` and returned the truncated text as if it were complete: no log, no error, no in-band marker, `is_error: false`. A truncated SKILL.md was indistinguishable from a whole one, so instructions at the tail — often the output format, refusal rules, or verification checklist — silently disappeared from the model's context. Add a shared `truncate_skill_output` helper: when the cap trips, reserve room for a `\n\n[…truncated…]` marker, truncate to fit, then append the marker in- band so the model can see content was lost and callers can detect it without a separate channel. Both truncation sites (skill body and supporting files) now route through the helper. The existing `call_load_skill_truncates_large_supporting_file` test is extended to require the marker; two new unit tests cover pass-through under the cap and cap+marker+Utf8 boundary behavior over the cap. Refs block#4163 Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
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.
What
load_skilltruncated any output overMAX_SKILL_BODY_BYTES(32 KiB) viatruncate_at_boundaryand returned the truncated text as if complete — nolog, no error,
is_error: false. Instructions at the tail of a SKILL.md(often the output format, refusal rules, or verification checklist) silently
vanished from the model's context.
Changes
truncate_skill_outputhelper: when the cap trips, reserves room for\n\n[…truncated…], truncates via the existing boundary-aware fn, thenappends the marker in-band. Model can see the loss; callers can detect it
without a separate channel.
helper — no behavioral drift between paths.
call_load_skill_truncates_large_supporting_filetest strengthenedto require the marker.
Tests
truncate_skill_output_under_cap_is_unchangedtruncate_skill_output_over_cap_appends_marker_and_stays_within_captruncate_skill_output_emits_valid_utf8_at_boundarycall_load_skill_truncates_large_supporting_filenow asserts themarker is present in the tail.
builtin::tests pass; fullbuzz-agent --libsuite 385/385.Refs #4163