Spawned remote agent harness shows wrong context sizes #2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A deepseek-flash in a remote spawned pod shows a context maximum of 66k instead of the real 1 million that should be available. Fix context display.
Fixed in commit
6a56d7f.Root cause: a spawned session pod builds its agent from the agent image's config, so the provider's
context_lengthwas the image's built-in default (deepseek65536â shown as66k) rather than the spawning console's setting. The console'sprovider/model,remote-toolsanddocumented_tools/referencessettings already travelled with the create request, but the context window did not.Fix: propagate the console's context window for the selected provider the same way
max_iterationsis propagated:harness spawnresolvesproviders.<name>.context_lengthand sends it ascontext_lengthin the create request.agentdargs as--context-lengthon the process and cluster paths, mirroring--max-iterations).agentdaccepts--context-lengthand applies it to the active provider before the agent is built, soContextUsage()reports the console's real limit in the context meter.A request without the value leaves the session on its own config/default (including
0â auto-detection for a local provider). The README, the multi-agent/e2e docs, theharness-agentchart (contextLengthvalue) and the unit/e2e tests were updated to match.Released as
v0.10.0(tagv0.10.0at6a56d7f; CI/release and container images all green).Not solved, still shows deepseek-flash ctx 45k/66k (68%)
Reopened investigation: fixed on
maininf6dcdab, released asv0.10.3.Why
6a56d7fdid not solve it: the create request only travelledproviders.<name>.context_length. But a config that customizes a built-in provider (for example a localdeepseekendpoint with a custombase_url/model) replaces the default entry when YAML-decoded, andapplyDefaultsnever restorescontext_length. The value therefore ends up0, the console falls back to auto-detection and displays the detected 1M, whilespawnforwarded0(nothing) and the session fell back to the agent image's default (deepseek 65536, shown as66k). Hence console 1M vs pod 66k.Fix:
providerContextLengthnow resolves the effective window for a spawn: the configured value, or, when it is0(auto-detect) and the provider is local, the value detected from the endpoint (/props), matching what the console displays.spawnsends that, so the session inherits the same limit.Tests:
TestProviderContextLengthDetectsLocal(fake/propsreturns 1M) plus the existing configured-value cases;gofmt,go vet ./...,go test -count=1 ./...pass. Docs (README.md,docs/multi-agent.md,docs/e2e.md) now say the effective/detected window is inherited.Note: a non-local provider with
context_lengthunset still sends nothing (unknown), and the pod keeps its own default; setcontext_lengthexplicitly for a remote endpoint. Leaving open for verification.