coding-agents: turn 1 injects the tool guide twice (page preamble + page refresh) with the default pageRefreshEveryTurns=1
Package: @vectorize-io/hindsight-coding-agents 0.8.7 (seen in dist/pi.js; the hook hosts share buildHookOutput).
What happens: with the default pageRefreshEveryTurns: 1, the first user turn of every session gets the page preamble and the page refresh, so the tool guide and any toolGuideExtra are sent twice in the same injection.
buildHookOutput(dist/pi.js~18736) checksif (cadence > 0 && turns % cadence === 0). Withcadence === 1,1 % 1 === 0holds on turn 1.- On turn 1,
RuntimeCore.onPrompt(~18885) already prependsbuildPagesPreamble(...)(<hindsight_pages>, which includestoolGuide(opts)), then appendsoutput.context, which now also holdsbuildRosterRefresh(...)(<hindsight_page_refresh>, which includestoolGuide(opts)again). - Measured over 343 turn-1 injections in 315 real sessions (12-15 Nov): 343/343 carried the second copy, about 5.5k duplicated chars each with a ~2k-char
toolGuideExtra.
Suggested fix:
- Guard the refresh on turn 1:
if (turns > 1 && cadence > 0 && turns % cadence === 0). - Optionally, when the rendered roster equals the session-cached one (
sessionCacheFilealready persistspages), skip the refresh or send a one-line delta. The only part that changes in the ~5.5k-char block is the page count.
We are keeping the every-turn cadence: the comment at pi.js ~16216 (searches 15% → 32.5% of turns) is convincing. This is only about the turn-1 duplicate and unchanged re-sends.
Same bug as #5977: on turn 1 the tool guide is sent twice (session-start/preamble + the roster refresh, since turns % cadence === 0 is true on turn 1). Tracking there.