fix(config): allow per-agent contextTokens override in agents.list · openclaw/openclaw@ed03d91
statxc
·
2026-04-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -224,6 +224,7 @@ Docs: https://docs.openclaw.ai
|
224 | 224 | - WhatsApp: transcribe accepted voice notes before agent dispatch while keeping spoken transcripts out of command authorization. (#64120) Thanks @rogerdigital. |
225 | 225 | - Plugins/CLI: expose channel plugin CLI descriptors during discovery-mode plugin loads so snapshot registries keep channel commands visible without activating full runtimes. (#71309) Thanks @gumadeiras. |
226 | 226 | - WhatsApp: deliver media generated by tool-result replies while still suppressing text-only tool chatter. (#60968) Thanks @adaclaw. |
| 227 | +- Config/agents: accept `agents.list[].contextTokens` in strict config validation so per-agent overrides survive hot reload, letting `/status` reflect the configured model window instead of the 200k fallback. Fixes #70692. (#71247) Thanks @statxc. |
227 | 228 | |
228 | 229 | ## 2026.4.23 |
229 | 230 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -71ef32b7723f64d4a84ac43bb6d41ff21e0d77a099b42e026d8b0d3d5301f917 config-baseline.json |
2 | | -cfab1910132ed23777005e0c650a13f44626b0450963f733e9de56a13323ae2b config-baseline.core.json |
| 1 | +5c7709e1686f6ad90beaa8e34ba45e6445e34c48d598407bd837361b58c365ab config-baseline.json |
| 2 | +98c83ce8af9ec4703726d7d673add95279be008a801b1d298982cbd9c1785747 config-baseline.core.json |
3 | 3 | 22d7cd6d8279146b2d79c9531a55b80b52a2c99c81338c508104729154fdd02d config-baseline.channel.json |
4 | 4 | 86f615b7d267b03888af0af7ccb3f8232a6b636f8a741d522ff425e46729ba81 config-baseline.plugin.json |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6432,6 +6432,11 @@ export const GENERATED_BASE_CONFIG_SCHEMA: BaseConfigSchemaResponse = {
|
6432 | 6432 | description: |
6433 | 6433 | "Optional per-agent overrides for the focused context budget knobs. Omitted fields inherit agents.defaults.contextLimits.", |
6434 | 6434 | }, |
| 6435 | + contextTokens: { |
| 6436 | + type: "integer", |
| 6437 | + exclusiveMinimum: 0, |
| 6438 | + maximum: 9007199254740991, |
| 6439 | + }, |
6435 | 6440 | heartbeat: { |
6436 | 6441 | type: "object", |
6437 | 6442 | properties: { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -95,6 +95,8 @@ export type AgentConfig = {
|
95 | 95 | skillsLimits?: Pick<SkillsLimitsConfig, "maxSkillsPromptChars">; |
96 | 96 | /** Optional per-agent overrides for selected context/token-heavy limits. */ |
97 | 97 | contextLimits?: AgentContextLimitsConfig; |
| 98 | +/** Optional per-agent override for the model's total context window (in tokens). */ |
| 99 | +contextTokens?: number; |
98 | 100 | /** Optional per-agent heartbeat overrides. */ |
99 | 101 | heartbeat?: AgentDefaultsConfig["heartbeat"]; |
100 | 102 | identity?: IdentityConfig; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -116,4 +116,19 @@ describe("agent defaults schema", () => {
|
116 | 116 | expect(() => AgentDefaultsSchema.parse({ heartbeat: { timeoutSeconds: 0 } })).toThrow(); |
117 | 117 | expect(() => AgentEntrySchema.parse({ id: "ops", heartbeat: { timeoutSeconds: 0 } })).toThrow(); |
118 | 118 | }); |
| 119 | + |
| 120 | +it("accepts per-agent contextTokens override", () => { |
| 121 | +const agent = AgentEntrySchema.parse({ |
| 122 | +id: "ops", |
| 123 | +contextTokens: 1_048_576, |
| 124 | +}); |
| 125 | +expect(agent.contextTokens).toBe(1_048_576); |
| 126 | +}); |
| 127 | + |
| 128 | +it("rejects non-positive contextTokens on agent entries and defaults", () => { |
| 129 | +expect(() => AgentEntrySchema.parse({ id: "ops", contextTokens: 0 })).toThrow(); |
| 130 | +expect(() => AgentEntrySchema.parse({ id: "ops", contextTokens: -1 })).toThrow(); |
| 131 | +expect(() => AgentEntrySchema.parse({ id: "ops", contextTokens: 1.5 })).toThrow(); |
| 132 | +expect(() => AgentDefaultsSchema.parse({ contextTokens: 0 })).toThrow(); |
| 133 | +}); |
119 | 134 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -829,6 +829,7 @@ export const AgentEntrySchema = z
|
829 | 829 | humanDelay: HumanDelaySchema.optional(), |
830 | 830 | skillsLimits: AgentSkillsLimitsSchema, |
831 | 831 | contextLimits: AgentContextLimitsSchema, |
| 832 | +contextTokens: z.number().int().positive().optional(), |
832 | 833 | heartbeat: HeartbeatSchema, |
833 | 834 | identity: IdentitySchema, |
834 | 835 | groupChat: GroupChatSchema, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。