agent: prompts embed the philosophy as an invalid JSON fragment once it outgrows the caps - #2225
Open
phamngocquy wants to merge 1 commit into
Open
agent: prompts embed the philosophy as an invalid JSON fragment once it outgrows the caps#2225phamngocquy wants to merge 1 commit into
phamngocquy wants to merge 1 commit into
Conversation
…it outgrows the caps Fixes gittensor-vanguard#1962
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
All three scored prompt sites that embed the inferred philosophy hard-slice its serialization:
agent/planner.py(plan_next_actions):json.dumps(philosophy, indent=1)[:4000]agent/decider.py(direction lens):json.dumps(philosophy, indent=1)[:3000]agent/decider.py(final synthesis):json.dumps(philosophy, indent=1)[:3000]infer_philosophyputs the unboundedevidencelist last in the serialization, so whenever the philosophy outgrows a cap the slice cuts mid-string insideevidence— the model reads an unterminated JSON fragment with the tail destroyed, in the same prompts that tell it "Respond ONLY with JSON". Real inferred philosophies do exceed these caps: the instrumented run published in #1706 measured one at 4,237 chars (evidence 2,508 chars / 13 entries) — over all three budgets. #1706 covers the judge-side sibling of this defect (benchmark/judge.py::_render); this issue is the agent-internal side, where a fix is plain prompt-assembly correctness with no scoring-surface contact.Proposed fix: a field-aware bounding helper in
agent/philosophy.py— byte-identical serialization whenever it fits the existing cap; otherwise drop whole trailingevidenceentries (they are real, individually intact signals) so the prompt stays valid JSON andsummary/values/merge_bar/directionsurvive; keep the existing hard slice only as the last resort for shapes that cannot fit even withevidenceempty, so no input ever renders worse than today. The call-site budgets (3000/4000) stay unchanged, and the philosophysolve()returns is untouched — only what the agent shows itself in prompts changes.Fixes #1962