Skip to content

agent: prompts embed the philosophy as an invalid JSON fragment once it outgrows the caps - #2225

Open
phamngocquy wants to merge 1 commit into
gittensor-vanguard:testfrom
phamngocquy:miner/issue-1962
Open

agent: prompts embed the philosophy as an invalid JSON fragment once it outgrows the caps#2225
phamngocquy wants to merge 1 commit into
gittensor-vanguard:testfrom
phamngocquy:miner/issue-1962

Conversation

@phamngocquy

Copy link
Copy Markdown

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_philosophy puts the unbounded evidence list last in the serialization, so whenever the philosophy outgrows a cap the slice cuts mid-string inside evidence — 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 trailing evidence entries (they are real, individually intact signals) so the prompt stays valid JSON and summary/values/merge_bar/direction survive; keep the existing hard slice only as the last resort for shapes that cannot fit even with evidence empty, so no input ever renders worse than today. The call-site budgets (3000/4000) stay unchanged, and the philosophy solve() returns is untouched — only what the agent shows itself in prompts changes.

Fixes #1962

@phamngocquy
phamngocquy requested a review from matedev01 as a code owner July 30, 2026 00:27
@github-actions github-actions Bot added agent The maintainer agent tests Test suite labels Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent The maintainer agent tests Test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant