Skip to content

Commit f4a81d2

Browse files
authored
chore(agent): trim hydration budget comments
Generated-By: PostHog Code Task-Id: c6065620-5694-4478-a20a-fec4ccde8f1a
1 parent ac0af56 commit f4a81d2

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

packages/agent/src/adapters/claude/session/jsonl-hydration.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,10 @@ export function rebuildConversation(
241241
return turns;
242242
}
243243

244-
// JSON-heavy tool payloads tokenize at ~2.5-3 chars/token, so estimate low:
245-
// overestimating a turn's cost just drops more history, underestimating
246-
// overfills the context window.
244+
// JSON-heavy tool payloads tokenize at ~2.5-3 chars/token, so estimate low.
247245
const CHARS_PER_TOKEN = 3;
248-
// Budgets must leave the window room for the system prompt, tools, skills,
249-
// and the resumed run's own work. The rebuilt transcript carries zero usage
250-
// metadata, so the SDK can't see the real context size and auto-compact
251-
// before the first API call — if the hydrated history overfills the window,
252-
// every request (including compaction itself) fails with "prompt is too
253-
// long" and the run dies. Target roughly half the window in real tokens.
246+
// Target ~half the context window: hydrated transcripts carry no usage
247+
// metadata, so the SDK can't auto-compact before the first API call.
254248
const DEFAULT_MAX_TOKENS = 80_000;
255249
const LARGE_CONTEXT_MAX_TOKENS = 400_000;
256250

0 commit comments

Comments
 (0)