Repository navigation
fix(blackbox): single global fixed char->token divisor 4.2 -> 4.5 - #46
Conversation
One divisor for ALL gateways (consistency over per-host tuning). Live post-deploy density measurement: Apollo ~4.36 ch/tok, Aegis ~4.83. 4.5 is the first single value that lands BOTH inside [0.90,1.05]: Apollo 1.03, Aegis 0.93. 4.2 left Aegis at ~0.87 (just under band). Non-fixed stays 3.5.
🔎 Lint report:
|
|
| Filename | Overview |
|---|---|
| agent/model_metadata.py | Default fixed char→token divisor bumped from 4.2 to 4.5; comment updated with live measurement data and acceptance-band rationale. Logic is correct and clamp/env-override path is unchanged. |
| tests/test_request_composition.py | Default-value assertion and fallback-loop assertion updated from 4.2 to 4.5. Two inline comments (section header and per-line annotation) still reference the old 4.2 value and were missed in the sweep. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["_composition_chars_per_token_fixed()"] --> B{"HERMES_COMPOSITION_CHARS_PER_TOKEN_FIXED set?"}
B -- Yes --> C{"2.0 ≤ val ≤ 8.0?"}
C -- Yes --> D["Return env value"]
C -- No --> E["Return 4.5 (default)"]
B -- No --> E
E --> F["COMPOSITION_CHARS_PER_TOKEN_FIXED = 4.5"]
F --> G["Fixed buckets: sys_tokens, tool_schema_tokens\n÷ 4.5 (was 4.2)"]
F --> H["Non-fixed buckets: history, tool_args, tool_result\n÷ 3.5 (unchanged)"]
Comments Outside Diff (2)
-
tests/test_request_composition.py, line 248 (link)The section header comment still references the old divisor value
~4.2; it should reflect the new default of4.5to stay consistent with the constant change.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
-
tests/test_request_composition.py, line 296 (link)The inline annotation still reads
# ~1690 at 4.2. With the new default of 4.5,math.ceil(7100 / 4.5)is 1578, so the comment is stale and could mislead anyone debugging the bound check.
Reviews (1): Last reviewed commit: "fix(blackbox): single global fixed char-..." | Re-trigger Greptile
…on thread (C5 #46) Ruling: no notify spool/outbox exists in-tree, so page_once dispatches the flock + notify send onto a tracked NON-daemon thread; flush_pages() gives it a bounded 5 s join at exit (threading._register_atexit, before the interpreter's non-daemon join) and logs any page still in flight. The dedup flock wait is bounded (5 s, then the in-process dedup fallback) so the thread is self-bounded. Test red on base (verdict blocked 10.16 s behind a slow page); shell_hooks + shell_hooks_missing 110/110.
…on thread (C5 #46) Ruling: no notify spool/outbox exists in-tree, so page_once dispatches the flock + notify send onto a tracked NON-daemon thread; flush_pages() gives it a bounded 5 s join at exit (threading._register_atexit, before the interpreter's non-daemon join) and logs any page still in flight. The dedup flock wait is bounded (5 s, then the in-process dedup fallback) so the thread is self-bounded. Test red on base (verdict blocked 10.16 s behind a slow page); shell_hooks + shell_hooks_missing 110/110.
Per Ace: use ONE divisor for both gateways (consistency), bump fixed 4.2->4.5 for a better system-prompt estimate; non-fixed stays 3.5.
Why 4.5: live post-deploy density measurement — Apollo/default ~4.36 ch/tok, Aegis ~4.83. 4.5 is the first single divisor landing BOTH inside the [0.90,1.05] acceptance band: Apollo 4.5/4.36=1.03 (3% under, safe), Aegis 4.5/4.83=0.93 (7% over, safe). 4.2 left Aegis at ~0.87 (just under band).
Constant + rationale comment + default-fallback test updated. 28/28 composition tests pass.