Repository navigation
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 8, 2026, 11:40 AM ET / 15:40 UTC. ClawSweeper reviewWhat this changesThe PR carries the selected agent’s existing context-token cap into embedded-run prechecks, safeguard compaction, and direct or Gateway-started compaction while retaining model-limit clamping. Merge readiness⛔ Blocked until stronger real behavior proof is added - 6 items remain This is a coherent root-cause repair for a real embedded-run budget inconsistency, but it should remain open for maintainer selection between two same-root-cause PRs and stronger exact-head behavior proof before merge. Priority: P2 Review scores
Verification
How this fits togetherThe embedded runner converts a selected agent and model into an effective context budget for each agent attempt. That budget also controls compaction and low-context safeguards, so every consumer must use the same prepared value. flowchart LR
A[Selected agent configuration] --> B[Embedded model policy]
C[Model context limit] --> B
B --> D[Attempt context budget]
D --> E[Prompt precheck]
D --> F[Safeguard compaction]
D --> G[Direct and Gateway compaction]
Decision needed
Why: Both branches address the same owner-boundary invariant, but their exact diffs could not be compared and the chosen patch changes upgrade-visible session thresholds. Before merge
Agent review detailsSecurityNone. PR surfaceSource +21, Tests +190. Total +211 across 13 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Select one canonical repair that resolves the selected-agent cap once and carries the prepared, model-clamped budget through every embedded and compaction consumer, then retain the stronger regression coverage from the other proposal. Do we have a high-confidence way to reproduce the issue? Yes—current main is source-reproducible: the CLI supplies merged selected-agent contextTokens while the embedded policy omits it and falls back to the global/default model resolution path. Is this the best way to solve the issue? Yes for the architectural shape: resolving the selected agent once and carrying the prepared model-clamped budget to all consumers is preferable to separate fallback calculations; the canonical branch still needs selection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7ecdef6e2ed4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (23 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Updated the PR relationship to |
|
Inspectable real-behavior proof for current head Command: a local This is a redacted local runtime transcript: the selected-agent cap reaches both the normal embedded effective model and the safeguard-compaction runtime. |
|
@clawsweeper re-review Added inspectable redacted runtime transcript to the PR body and comments for the selected 64,000-token cap reaching both normal embedded policy and safeguard-compaction runtime. |
|
@clawsweeper re-review Updated current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Synced branch with latest upstream
No re-review requested: the author diff is unchanged from the last reviewed head ( |
|
@clawsweeper re-review Current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…o fix/agent-context-cap-71136
|
The maintainer decision that the ClawSweeper block on this PR asks for has been made, and the canonical repair has landed. #120343 merged 2026-08-09 00:56Z as
The same comment also leaves this branch's disposition open: "#119277 remains open for separate orchestrator disposition; no close authority was exercised here." So the call here is yours. What follows is only the measurement I would want if it were my branch. Overlap, measured nowThis head
Where this branch's remaining 20 lines go:
The difference is the line that was ruled on, and it reaches one step further than precedenceThis branch: agentContextTokens: requestedTokenBudget ?? configuredAgentTokenBudget,
const agentContextTokens = params.agentId
? resolveAgentConfig(params.config ?? {}, params.agentId)?.contextTokens
: undefined;
const capTokens =
normalizePositiveInt(params.agentContextTokens) ??
normalizePositiveInt(params.cfg?.agents?.defaults?.contextTokens);
if (capTokens && capTokens < baseInfo.tokens) {
return { tokens: capTokens, referenceTokens: baseInfo.tokens, source: "agentContextTokens" };
}So routing the caller's requested budget into that field does two things rather than one: the requested value replaces the agent cap, and because of the
The One stale artifactThe ClawSweeper review on this PR was last written 2026-08-08 15:40Z against head Scope: |
Related: #71136
What Problem This Solves
Embedded runs can ignore the selected agent's existing
contextTokenscap, so an agent-specific context budget is honored by the CLI path but not by the normal embedded runtime. Safeguard compaction and low-context recovery guidance must use the same selected-agent budget.Why This Change Was Made
The embedded context-budget owner now resolves the selected agent's merged configuration and passes its resolved
contextTokenBudgetthrough both the normal embedded session and the separate compaction session. Direct compaction treats a caller-resolved budget as the selected-agent cap, while Gateway-started compaction derives the selected agent's cap from the session agent when no caller budget is supplied. Both paths still clamp to the actual compaction model limit.User Impact
Per-agent
contextTokenssettings now consistently cap context budgets for embedded runs, safeguard compaction, and Gateway-started manual compaction, including agent-specific entries that differ from the global default.Evidence
acd01cb587f30eb8a449ccb40b81530284843517, a sync-only merge of the remote PR head andupstream/main=e5d4fe02a46a; none of this PR's 13 files changed during synchronization.node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts src/agents/context-window-guard.test.ts src/agents/embedded-agent-runner/compaction-runtime-context.test.ts src/agents/embedded-agent-runner/extensions.test.ts src/agents/embedded-agent-runner/run/setup.test.ts: passed; 25 tests in the unit-fast owner group.node scripts/run-vitest.mjs run --config test/vitest/vitest.agents-embedded-agent.config.ts embedded-agent-runner/compaction-runtime-context.test.ts embedded-agent-runner/extensions.test.ts: passed; 2 files, 46 tests.node scripts/run-vitest.mjs run --config test/vitest/vitest.agents-embedded-agent-run.config.ts setup.test.ts: passed; 1 file, 22 tests.pnpm check: passed on the current head in manual verification.git diff --check upstream/main...HEAD: passed.PI_CODING_AGENT_DIR=/root/.pi/agent AUTOREVIEW_PROVIDER_ENV_ALLOW=ASXS_API_KEY .agents/skills/autoreview/scripts/autoreview --mode branch --base upstream/main --engine pi --model 'asxs/gpt-5.5' --thinking high --pi-bin /usr/local/bin/pi: passed; TruffleHog clean; autoreview clean: no accepted/actionable findings reported.This PR was AI-assisted. I reviewed the embedded model-policy owner, its normal-session and compaction-session callers, safeguard runtime, the CLI sibling path, and native model-owned bypass behavior, and understand the behavior implemented here.