Repository navigation
Cap the investigation's answer and raw tool-call arguments at 8000 characters - #62
Merged
Merged
Conversation
This was referenced Oct 9, 2026
…aracters spec.answer and trace[].toolCalls[].arguments are the model's text and can quote host output, yet the record kept both unbounded after #52 capped the trace's reasoning and text (D-4). Both now keep at most 8000 characters, cut mark included, keeping the start and ending with a [last N characters cut] mark (D-6). Only the stored copy is cut: the finding is read from the whole answer and the tool runs on the whole arguments. The schema bounds both fields with maxLength 8000. Fixes #57 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shipmill-romamo
Bot
force-pushed
the
fix/57-cap-answer-and-arguments
branch
from
October 9, 2026 16:25
1654b27 to
4524679
Compare
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
The investigation record kept
spec.answerandspec.trace[].toolCalls[].argumentsunbounded after #52 capped the trace's reasoning and text (D-4). Both are the model's text and can quote host output. This caps them as D-6 (#59) settles.sdk/src/cloudfall/investigation.py: newANSWER_LIMITandARGUMENTS_LIMIT(bothTOOL_TEXT_LIMIT, 8000) and_head_text, the mirror of D-4's_trace_text. It keeps the start and ends with a\n[last N characters cut]mark, D-4's[first N characters cut]\nturned round. As in D-4, the mark counts against the limit, so a stored value is never longer than 8000 characters, mark included (a cut value can be one to three under). Characters are counted, not bytesstatus: answered) is still read from the model's whole answer, so a finding past the cut still counts_call_text, which builds only the trace'sToolCallText._run_callstill parses the endpoint's own argument string, so the tool runs on the whole arguments and nothing parses the cut copy as JSONturnevents carry the sameTurn, and the lastinvestigationevent is the saved record'sas_document(), so whatagent investigateprints matches the recordconfig/schemas/v1/agent-investigation.schema.json:maxLength: 8000onspec.answerandtrace[].toolCalls[].arguments, with descriptions, the same bound D-4 put ontextandreasoningRecords already on disk: handled as #52 did. Stored investigation records are not re-validated on read, still true on main:
InvestigationStorevalidates only on save, nothing in the SDK or engine loadsinvestigations/, andevaluations/nemotron-incident/run.pyreads them as plain JSON and uses onlyfinding.proposed. A record written before with a longer answer or arguments stays readable everywhere it is read today; only revalidating it against the new schema would fail.No schema lock or snapshot test covers this schema; none needed updating. One existing assertion changed:
test_a_long_reasoning_is_cut_to_the_limit_and_markedasserted the record'sanswerstayed whole (that was #52's design); it now asserts the start is kept with the mark.Out of scope, unchanged:
spec.steps[].arguments(the parsed object that ran) andfinding.rootCause/whystay unbounded.Test plan
test_a_long_answer_keeps_its_start_and_its_finding[8000|8001|50000]: exactly 8000 is kept whole; 8001 and 50,000 (Cyrillic) keep the start and the mark, the finding is still read, and the saved record passes the schematest_a_finding_past_the_cut_is_still_read_from_the_whole_answertest_the_cli_streams_the_answer_as_the_record_keeps_it: the stream's record event and the file on disk have the same cut answertest_long_raw_arguments_keep_their_start_in_the_trace_only[8000|8001|50000]: the tool receives the whole arguments,steps[].argumentsis whole, the trace's raw string is cut with the marktest_the_schema_refuses_an_answer_or_arguments_past_the_limit[answer|arguments]: 8001 characters fail the schemauv run ruff check .,uv run mypy,uv run pytest(full suite, 476 passed),uv run cloudfall config validate --project config/examples: all passFixes #57
🤖 Generated with Claude Code