Harden OpenRouter path with opt-in transcript and routing controls#50
Harden OpenRouter path with opt-in transcript and routing controls#50blue-az wants to merge 2 commits into
Conversation
…marization, disable subagents, and ignore openwiki.* directories
PRATHAM KUMAR (rajpratham1)
left a comment
There was a problem hiding this comment.
configureDeepAgentHarness() only calls registerHarnessProfile() when OPENWIKI_DISABLE_SUBAGENTS === "1", but there are no corresponding tests verifying that the task tool is actually disabled. Since this changes runtime behavior by removing subagent delegation, please add an integration or unit test that confirms the task tool is excluded and generalPurposeSubagent.enabled is false when the environment variable is set, while leaving the default behavior unchanged. This helps prevent future regressions.
Adds node:test coverage (no new deps) for the subagent-disable path: - disabled profile drops the task tool and sets generalPurposeSubagent.enabled=false - the exclusion middleware filters the task tool out of the model call when set - default behavior is unchanged (no middleware, no tools removed) when unset - the opt-in gate only triggers on the literal "1" Extracts the harness profile into a pure buildSubagentDisabledProfile() and shares the task tool name via a single constant so the profile and middleware stay in sync. Adds a "test" script. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Good call — added |
|
Pushed the requested test coverage in 6e17267 — could you re-review when you get a chance? |
|
Closing in favor of #312 — main has moved far enough (connector tools, output modes, ChatGPT OAuth) that the same three opt-in controls needed a clean redo rather than a conflict resolution. Thanks for the review here; the test-coverage ask carried over. |
Problem
On the OpenRouter path with constrained/budget models, documentation runs fail with HTTP 500 errors before summarization ever triggers: the summarization middleware's default trigger (~170k tokens) sits far above the payload size where OpenRouter requests actually start failing (roughly 270–340KB, ~12–25k tokens depending on the model). Two secondary issues compound this on longer runs: generated
openwiki.*variant directories (from testing/validation runs) leak into discovery and get re-read, and subagent fan-out multiplies transcript growth.Changes
All hardening is strictly opt-in — with no environment variables set, behavior is unchanged for every provider:
OPENWIKI_OPENROUTER_MAX_INPUT_TOKENS— when set, attaches a model profile with thismaxInputTokensto OpenRouter model instances (viaObject.defineProperty, so frozen/non-extensible instances don't crash), which lets the summarization middleware trigger early enough to stay under the payload limit. Suggested value for constrained models:15000.OPENWIKI_DISABLE_SUBAGENTS=1— disables subagent task delegation for runs where transcript growth is the binding constraint.OPENWIKI_DISABLE_MODEL_FALLBACK=1— disables OpenRouter fallback routing for deterministic single-model runs.openwiki.*variant directories so testing/validation copies of the wiki are never inspected or documented.openwiki/operations/credentials-and-updates.md.Verification
pnpm run build,pnpm run lint:check, andpnpm run format:checkall pass.--init/--updateruns complete with no 500s (previously reproducible failures).Related
The remaining workspace-pollution item found during this testing is filed separately as #49 (
conversation_history/offloads written into the target repository).🤖 Generated with Claude Code