feat(session): raise ping-pong turn ceiling · openclaw/openclaw@d90ab9a
steipete
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,6 +10,7 @@ Docs: https://docs.openclaw.ai
|
10 | 10 | - Build: enable stricter Vitest lint rules for focused, disabled, conditional, hook, matcher, and expectation hazards. |
11 | 11 | - Build: pin explicit oxfmt defaults in the shared formatter config to keep formatting behavior stable across upgrades. |
12 | 12 | - TypeScript: enable stricter compiler checks for implicit returns, side-effect imports, overrides, and unused production code. |
| 13 | +- Agents: allow `session.agentToAgent.maxPingPongTurns` up to 20 while keeping the default at 5 for longer agent-to-agent reply chains. Fixes #52382. (#52400) Thanks @thirumaleshp. |
13 | 14 | - Build: upgrade workspace package management to pnpm 11 and keep Docker, install, update, and release workflows on the pnpm 11 config surface. (#79414) Thanks @altaywtf. |
14 | 15 | - Models: add provider-level `localService` startup for on-demand local model servers before OpenAI-compatible requests, including one-shot model probes. |
15 | 16 | - Agents: trim default system prompt guidance and send-only message tool schemas to reduce prompt tokens while preserving GPT-5 personality guidance. |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -c9e88800854b697cb3c9721d0087eb2bc7bcf6ae7239cb51d9849c49ef3d48e3 config-baseline.json |
2 | | -67c58457ed2b525975cdb053489f92a5f840c8cf982666393e111fd327dd132e config-baseline.core.json |
| 1 | +1cc2cabc41c2261492dea4d927b48864c6992dcfb5b81fa97f2171848d037b1e config-baseline.json |
| 2 | +bfa974d070e5ef26fab023506b050cb3a582d1e54a096dbf4dddbc59535de29c config-baseline.core.json |
3 | 3 | f90c9d96ccc4c0c703d6c489f86d89fde208cd7f697b396aeee96ff3ee087956 config-baseline.channel.json |
4 | 4 | 18f71e9d4a62fe68fbd5bf18d5833a4e380fc705ad641769e1cf05794286344c config-baseline.plugin.json |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -104,7 +104,8 @@ provenance. The receiving agent should treat them as tool-routed data, not as a
|
104 | 104 | direct end-user-authored instruction. |
105 | 105 | |
106 | 106 | After the target responds, OpenClaw can run a **reply-back loop** where the |
107 | | -agents alternate messages (up to 5 turns). The target agent can reply |
| 107 | +agents alternate messages (up to `session.agentToAgent.maxPingPongTurns`, range |
| 108 | +0-20, default 5). The target agent can reply |
108 | 109 | `REPLY_SKIP` to stop early. |
109 | 110 | |
110 | 111 | ## Status and orchestration helpers |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1219,7 +1219,7 @@ See [Multi-Agent Sandbox & Tools](/tools/multi-agent-sandbox-tools) for preceden
|
1219 | 1219 | - **`reset`**: primary reset policy. `daily` resets at `atHour` local time; `idle` resets after `idleMinutes`. When both configured, whichever expires first wins. Daily reset freshness uses the session row's `sessionStartedAt`; idle reset freshness uses `lastInteractionAt`. Background/system-event writes such as heartbeat, cron wakeups, exec notifications, and gateway bookkeeping can update `updatedAt`, but they do not keep daily/idle sessions fresh. |
1220 | 1220 | - **`resetByType`**: per-type overrides (`direct`, `group`, `thread`). Legacy `dm` accepted as alias for `direct`. |
1221 | 1221 | - **`mainKey`**: legacy field. Runtime always uses `"main"` for the main direct-chat bucket. |
1222 | | -- **`agentToAgent.maxPingPongTurns`**: maximum reply-back turns between agents during agent-to-agent exchanges (integer, range: `0`–`5`). `0` disables ping-pong chaining. |
| 1222 | +- **`agentToAgent.maxPingPongTurns`**: maximum reply-back turns between agents during agent-to-agent exchanges (integer, range: `0`-`20`, default: `5`). `0` disables ping-pong chaining. |
1223 | 1223 | - **`sendPolicy`**: match by `channel`, `chatType` (`direct|group|channel`, with legacy `dm` alias), `keyPrefix`, or `rawKeyPrefix`. First deny wins. |
1224 | 1224 | - **`maintenance`**: session-store cleanup + retention controls. |
1225 | 1225 | - `mode`: `warn` emits warnings only; `enforce` applies cleanup. |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { beforeEach, describe, expect, it } from "vitest"; |
2 | 2 | import { setActivePluginRegistry } from "../../plugins/runtime.js"; |
3 | 3 | import { createSessionConversationTestRegistry } from "../../test-utils/session-conversation-registry.js"; |
4 | | -import { resolveAnnounceTargetFromKey } from "./sessions-send-helpers.js"; |
| 4 | +import { resolveAnnounceTargetFromKey, resolvePingPongTurns } from "./sessions-send-helpers.js"; |
5 | 5 | |
6 | 6 | describe("resolveAnnounceTargetFromKey", () => { |
7 | 7 | beforeEach(() => { |
@@ -63,3 +63,28 @@ describe("resolveAnnounceTargetFromKey", () => {
|
63 | 63 | }); |
64 | 64 | }); |
65 | 65 | }); |
| 66 | + |
| 67 | +describe("resolvePingPongTurns", () => { |
| 68 | +it("defaults to 5 when unset", () => { |
| 69 | +expect(resolvePingPongTurns(undefined)).toBe(5); |
| 70 | +expect(resolvePingPongTurns({ session: {} } as never)).toBe(5); |
| 71 | +}); |
| 72 | + |
| 73 | +it("uses configured values through the 20-turn ceiling", () => { |
| 74 | +expect( |
| 75 | +resolvePingPongTurns({ session: { agentToAgent: { maxPingPongTurns: 10 } } } as never), |
| 76 | +).toBe(10); |
| 77 | +expect( |
| 78 | +resolvePingPongTurns({ session: { agentToAgent: { maxPingPongTurns: 20 } } } as never), |
| 79 | +).toBe(20); |
| 80 | +}); |
| 81 | + |
| 82 | +it("keeps defensive floor and ceiling clamps", () => { |
| 83 | +expect( |
| 84 | +resolvePingPongTurns({ session: { agentToAgent: { maxPingPongTurns: -1 } } } as never), |
| 85 | +).toBe(0); |
| 86 | +expect( |
| 87 | +resolvePingPongTurns({ session: { agentToAgent: { maxPingPongTurns: 50 } } } as never), |
| 88 | +).toBe(20); |
| 89 | +}); |
| 90 | +}); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ export {
|
13 | 13 | } from "./sessions-send-tokens.js"; |
14 | 14 | |
15 | 15 | const DEFAULT_PING_PONG_TURNS = 5; |
16 | | -const MAX_PING_PONG_TURNS = 5; |
| 16 | +const MAX_PING_PONG_TURNS = 20; |
17 | 17 | |
18 | 18 | export type AnnounceTarget = { |
19 | 19 | channel: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1537,7 +1537,7 @@ export const FIELD_HELP: Record<string, string> = {
|
1537 | 1537 | "session.agentToAgent": |
1538 | 1538 | "Groups controls for inter-agent session exchanges, including loop prevention limits on reply chaining. Keep defaults unless you run advanced agent-to-agent automation with strict turn caps.", |
1539 | 1539 | "session.agentToAgent.maxPingPongTurns": |
1540 | | -"Max reply-back turns between requester and target agents during agent-to-agent exchanges (0-5). Use lower values to hard-limit chatter loops and preserve predictable run completion.", |
| 1540 | +"Max reply-back turns between requester and target agents during agent-to-agent exchanges (0-20, default 5). Use lower values to hard-limit chatter loops and preserve predictable run completion.", |
1541 | 1541 | "session.threadBindings": |
1542 | 1542 | "Shared defaults for thread-bound session routing behavior across providers that support thread focus workflows. Configure global defaults here and override per channel only when behavior differs.", |
1543 | 1543 | "session.threadBindings.enabled": |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -205,7 +205,7 @@ export type SessionConfig = {
|
205 | 205 | /** Session transcript write-lock acquisition policy. */ |
206 | 206 | writeLock?: SessionWriteLockConfig; |
207 | 207 | agentToAgent?: { |
208 | | -/** Max ping-pong turns between requester/target (0–5). Default: 5. */ |
| 208 | +/** Max ping-pong turns between requester/target (0-20). Default: 5. */ |
209 | 209 | maxPingPongTurns?: number; |
210 | 210 | }; |
211 | 211 | /** Shared defaults for thread-bound session routing across channels/providers. */ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -64,7 +64,7 @@ export const SessionSchema = z
|
64 | 64 | .optional(), |
65 | 65 | agentToAgent: z |
66 | 66 | .object({ |
67 | | -maxPingPongTurns: z.number().int().min(0).max(5).optional(), |
| 67 | +maxPingPongTurns: z.number().int().min(0).max(20).optional(), |
68 | 68 | }) |
69 | 69 | .strict() |
70 | 70 | .optional(), |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。