fix #259: pass prior tool outputs to actions by $ref instead of inlining#267
Open
ahmad-ajmal wants to merge 2 commits into
Open
fix #259: pass prior tool outputs to actions by $ref instead of inlining#267ahmad-ajmal wants to merge 2 commits into
ahmad-ajmal wants to merge 2 commits into
Conversation
Collaborator
Author
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
ActionOutputStore— every action invocation persists toagent_file_system/action_outputs/{session_id}/{action_name}__{run_id}.jsonat a stable{action_name}#{short_run_id}key.$refresolution in action parameters — LLM can pass{"$ref": "<key>", "path": "<dotted.path>"}instead of inlining prior data. Resolved by the manager before the handler runs.$refis ~80 chars where the inlined data was kilobytes. That smaller response is what enters the next prompt's event-stream history, so the saving compounds across turns.action_start/action_endevent stamps the exact$refkey in plain sight (e.g.Action get_discord_messages#c0b016 completed...) so the LLM never has to guess.run_pythonexposes sibling parameters as Python globals —codereferences already-resolved data by name.read_file/grep_files/stream_read/stream_edit; remove"plan"fromHIDDEN_EVENT_KINDSwhere it substring-matched"platform"and silently dropped every agent chat bubble.Why
The LLM had no way to reference prior tool output — it could only quote it. When asked to process ~50 Discord messages it pasted the lot into
run_python'scodeparameter as a triple-quoted string, blew past the model's output-token cap, and the response truncated mid-string. JSON parsing failed, the retry told it to "fix the JSON," and it reproduced the same failure three times until the task aborted.Closes #259
How to test
logs/<timestamp>.logfor:action_endevents that include the(Reference this output via {"$ref": ..., ...})suffix.run_pythonINPUT DATAshowing a$refvalue (resolved before exec).Unterminated string/truncated:retries.agent_file_system/action_outputs/<session_id>/— one JSON file per action, each containing the full output dict.Logs
Before:
After:
[PARALLEL] Selected 2 action(s): ['task_update_todos', 'send_message']; thesend_messageINPUT DATAshows'message': {'$ref': 'run_python#...', 'path': 'stdout'}and the chat panel receives clean formatted text.