Providers: skip context1m beta for Anthropic OAuth tokens (#24620)

* Providers: skip context1m beta for Anthropic OAuth tokens

* Tests: cover OAuth context1m beta skip behavior

* Docs: note context1m OAuth incompatibility

* Agents: add context1m-aware context token resolver

* Agents: cover context1m context-token resolver

* Commands: apply context1m-aware context tokens in session store

* Commands: apply context1m-aware context tokens in status summary

* Status: resolve context tokens with context1m model params

* Status: test context1m status context display
This commit is contained in:
Vincent Koc
2026-02-23 12:29:09 -05:00
committed by GitHub
parent 28377e1b7a
commit f03ff39754
11 changed files with 248 additions and 23 deletions

View File

@@ -120,6 +120,36 @@ describe("buildStatusMessage", () => {
expect(normalized).toContain("channel override");
});
it("shows 1M context window when anthropic context1m is enabled", () => {
const text = buildStatusMessage({
config: {
agents: {
defaults: {
model: "anthropic/claude-opus-4-6",
models: {
"anthropic/claude-opus-4-6": {
params: { context1m: true },
},
},
},
},
} as unknown as OpenClawConfig,
agent: {
model: "anthropic/claude-opus-4-6",
},
sessionEntry: {
sessionId: "ctx1m",
updatedAt: 0,
totalTokens: 200_000,
},
sessionKey: "agent:main:main",
sessionScope: "per-sender",
queue: { mode: "collect", depth: 0 },
});
expect(normalizeTestText(text)).toContain("Context: 200k/1.0m");
});
it("uses per-agent sandbox config when config and session key are provided", () => {
const text = buildStatusMessage({
config: {