Repository navigation
Cap the reasoning and text the investigation trace keeps - #52
Merged
Merged
Conversation
A model's reasoning often quotes the host output it just read, and since PR #45 the trace kept it verbatim with no bound. Each turn's reasoning and text now keep at most 8000 characters (TOOL_TEXT_LIMIT), their end after a [first N characters cut] mark that counts against the limit, and the schema bounds both with maxLength. The stream's turn event carries the same Turn, so it is capped alike. The schema also says the step's parsed arguments are what ran, and toolCalls[].arguments only the model's text. Fixes #50 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 9, 2026
This was referenced Oct 9, 2026
shipmill-romamo Bot
added a commit
that referenced
this pull request
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>
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
Since #45 the investigation record's
spec.trace[].reasoningkept the model'sreasoning_contentverbatim, with no bound, and a model's reasoning often quotes the host output it just read. This caps it as D-4 settled._turninsdk/src/cloudfall/investigation.pykeeps at mostTRACE_TEXT_LIMIT(=TOOL_TEXT_LIMIT, 8000) characters of each turn's reasoning and of its text. A longer value keeps its end after the same[first N characters cut]mark the tool-text cap writes (host_textnow shares the mark helper). The mark counts against the limit, so the stored value never exceeds 8000 characters, mark included. Characters are counted, not bytesturnevent carries the sameTurn, so it is capped the same way: the stream and the record stay equalconfig/schemas/v1/agent-investigation.schema.json:maxLength: 8000ontrace[].textandtrace[].reasoning, with descriptions, and point 2 of the issue:toolCalls[].argumentssays the step's parsed arguments are what ran and the raw string is only the model's textanswer(what the finding is read from) is not capped; only the trace's copy of the turn text isStored records are not re-validated on read:
InvestigationStoreonly validates on save,cloudfall whydoes not read investigations, andevaluations/nemotron-incident/run.pyreads them as plain JSON. A record written before with a longer reasoning stays readable everywhere it is read today.Test plan
test_a_long_reasoning_is_cut_to_the_limit_and_marked: a 10,532-character Cyrillic reasoning and a 9,017-character turn text are cut to at most 8000 characters with the mark, keep their ends, and the saved record passes the schema; the record'sanswerstays wholetest_the_schema_refuses_a_trace_longer_than_the_limit: an 8001-character reasoning fails the schemauv run ruff check .,uv run mypy,uv run pytest(438 passed),uv run cloudfall config validate --project config/examples,cloudfall-engine inventory renderall pass locallyansible-lintcould not run in the local session (Ansible refuses non-blocking stdio there); this PR touches no Ansible file, and CI runs themFixes #50
🤖 Generated with Claude Code