You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Context overflow from opencode-go is misclassified, bypassing automatic compaction #4253
A long-running Bot using DSH 0.2.2-rc.1 and the pi-ai opencode-go route stopped after repeated INVALID_REQUEST failures. The provider returned:
Input too long: model limit 1048576 tokens, requested 1123530 tokens
DSH's installed isContextWindowExceededError() returns false for this wording. The pi-ai adapter consequently reports INVALID_REQUEST; native compaction-basic only performs forced overflow recovery for CONTEXT_WINDOW_EXCEEDED. Repeating the request cannot shrink the history, so the Bot's consecutive-failure guard eventually holds it. Manual native compaction succeeded and the same Bot resumed responding.
Reproduction and expected result
Call isContextWindowExceededError() with the text above, including an OpenAI-compatible 400 invalid_request_error wrapper: expected true; observed false. Replay that response through the pi-ai HTTP adapter and a real Agent/compaction composition: expect a bounded compaction and successful retry, rather than repeated terminal INVALID_REQUEST failures.
Negative controls must preserve ordinary validation failures such as oversized non-token input and invalid parameter values.
Scope
Implement a Tobs-owned agent/request-error listener for this precise missed token-limit wording. Limit recovery to Tobs-owned Sessions, call the unmodified native compaction service, retry only after durable context progress, and bound the attempts. Do not modify DSH source, dependency bytes, classifier functions or native recovery methods. The earlier upstream fork PR is closed at the Human's instruction.
Automatic compaction was enabled and had succeeded previously. Idle compaction is an optimization requiring eligible idle time, not an unconditional overflow guard. The exact historical outbound payload was not captured; requested must not be described as prompt-only tokens.
The initial investigation also observed omitted catalog output caps in resolved model metadata. Current DSH tests explicitly distinguish catalog capabilities from configured request defaults. This PR must not change that contract without independent evidence and design review.
Task: codex/local/01a1df5e-8b2e-7813-8ac8-7ad9abf7061b (not a DSH Session)
Issue scope: reproduce token-limit wording through the pi-ai adapter and native compaction; fix upstream classification without changing catalog output-cap semantics.
Reproduced the original token-limit wording at the classifier, HTTP adapter and Loader-mounted Agent composition. Before the fix, the adapter returned INVALID_REQUEST and the Agent produced no compaction summary. After the fix, native compaction completes and the retry succeeds, without changing catalog output-cap semantics or recovery policy.
Checks: 179 focused tests; 100% classifier statement/branch/function/line coverage; full build 10/10; doc-sync 43/43; pre-push typecheck 5/5; focused lint and built classifier smoke passed. Two pre-existing Loader tests timed out during parallel build/doc work; the full Loader file passed afterward with unchanged timeouts.
Remaining: direct upstream PR creation was rejected by GitHub: DoodleBears does not have the correct permissions to execute CreatePullRequest. The fork PR uses a dedicated base ref pinned to upstream 39163dd30f703a79079e2d2446545cff3c453738, so reviewers see only this fix. An account allowed to submit upstream must complete that submission; upstream acceptance/release and VPS deployment remain outstanding. No production Host was changed.
Supersedes this task's upstream handoff: the Human requires Tobs-only changes. The DSH fork PR is closed. Implement bounded recovery through supported DSH events and compaction service calls, with unmodified DSH dependencies and before/after Host tests.
The DSH fork PR remains closed. This implementation changes only Tobs and its verification tooling, using the public native isolated Preset compaction service.
Real isolated Host replay on DSH 0.2.2-rc.1: base 7e0ca0012 yielded one token-limit rejection, zero summary requests, no reply and INVALID_REQUEST. Fixed Tobs yielded one rejection, one summary and committed OVERFLOW_RECOVERED in the same Session. The HTTP model endpoint is a local fixture; DSH implementations are unmodified.
Validation: 89 related tests, build, TypeScript, lint, formatting, feature-map and bilingual changelog checks passed. Initial Windows lifecycle failures were rechecked successfully with sufficient process-cleanup time; full related rerun passed. The same-Session proof uses the public context query and canonical Channel message read.
Both verification Hosts exited, their ports were released and private evidence was retained. Production provider, QQ, visual/Human QA and VPS deployment remain untested by this replay. CI is running; no merge or deployment performed.
An exact-head Chinese HTML explainer was generated locally. It is not published or reviewer-accessible, and was not visually checked in a browser.
Latest head 0990d33 passed all applicable CI checks; all three review threads were resolved before squash merge.
Tobs-side recovery, native persistence checkpoint and exact Session replacement readback are merged. DSH implementations remain unchanged. Sanitized real Host replay evidence is retained in the PR discussion.
Task verification Hosts were stopped and their listeners released. VPS deployment, production-provider and QQ verification were not performed as part of this merge.
Activity
DoodleBears commentedon Nov 15, 2026
Agent work claim
codex/local/01a1df5e-8b2e-7813-8ac8-7ad9abf7061b(not a DSH Session)fix/4253-context-overflow-recovery(DSH upstream fork)DoodleBears commentedon Nov 15, 2026
Agent work outcome
codex/local/01a1df5e-8b2e-7813-8ac8-7ad9abf7061bc96eb3be18d5f1f3b78c425f473a4787784f9de5DoodleBears does not have the correct permissions to execute CreatePullRequest. The fork PR uses a dedicated base ref pinned to upstream39163dd30f703a79079e2d2446545cff3c453738, so reviewers see only this fix. An account allowed to submit upstream must complete that submission; upstream acceptance/release and VPS deployment remain outstanding. No production Host was changed.DoodleBears commentedon Nov 15, 2026
Agent work claim (Tobs-only scope)
DoodleBears commentedon Nov 15, 2026
Agent work outcome (Tobs-only)
codex/local/01a1df5e-8b2e-7813-8ac8-7ad9abf7061b8f5791196634334778ef4551a1c19ca7ccb247940.2.2-rc.1: base7e0ca0012yielded one token-limit rejection, zero summary requests, no reply andINVALID_REQUEST. Fixed Tobs yielded one rejection, one summary and committedOVERFLOW_RECOVEREDin the same Session. The HTTP model endpoint is a local fixture; DSH implementations are unmodified.test(docs): include the overflow recovery event consumer
Merge main and retain both verification journeys
fix(core): persist compacted context before overflow retry
chore: keep overflow replay within the source policy
fix(core): confirm stored Session replacement before retry
DoodleBears commentedon Nov 15, 2026
Agent work outcome
codex/local/01a1df5e-8b2e-7813-8ac8-7ad9abf7061b52c5544d08ea61bd99a1d5c89c701a83b4edd9460990d33passed all applicable CI checks; all three review threads were resolved before squash merge.