Skip to content

Commit b277ae3

Browse files
vignesh07clawsweeper-repair
andauthored
[codex] Fix commitments safety and coverage (#75302)
* fix commitments safety and coverage * Repair commitments safety PR review blockers * fix(clawsweeper): address review for automerge-openclaw-openclaw-75302 (1) * Repair commitments safety PR review blocker --------- Co-authored-by: clawsweeper-repair <[email protected]>
1 parent a102f4d commit b277ae3

32 files changed

Lines changed: 1415 additions & 73 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Docs: https://docs.openclaw.ai
1111

1212
### Fixes
1313

14+
- Agents/commitments: keep inferred follow-ups internal when heartbeat target is none, strip raw source text from stored commitments, disable tools during due-commitment heartbeat turns, bound hidden extraction queue growth, expire stale commitments, and add QA/Docker safety coverage. Thanks @vignesh07.
1415
- Plugins/runtime-deps: accept already materialized package-level runtime-deps supersets as converged, so later lazy plugin activation no longer prunes and relaunches `pnpm install` after gateway startup pre-staging. Fixes #75283. Thanks @brokemac79.
1516
- TTS/providers: keep bundled speech-provider compat fallback available when plugins are globally disabled, so cold gateway and CLI startup can still resolve fallback speech providers instead of leaving explicit TTS provider selection with no registered providers. Refs #75265. Thanks @sliekens.
1617
- Discord: collapse repeated native slash-command deploy rate-limit startup logs into one non-fatal warning while keeping per-request REST timing in verbose output. Thanks @discord.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
851a39b442a4a15e78d27d8a3e1ee66ff61a061356d412051e205f6c07f54c34 plugin-sdk-api-baseline.json
2-
d3106b731a3a13f7dddaa0b1916f223c1757fa8d1df3476914f70502c9532c2f plugin-sdk-api-baseline.jsonl
1+
e75701dd791461feb4893e7106362dbbb41668bc4341e8b42becc346001e9f0e plugin-sdk-api-baseline.json
2+
077e30997781d3a064f00491d55f7ac78465868b02fdcfb70e07e03555bb2afe plugin-sdk-api-baseline.jsonl

‎docs/concepts/commitments.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ When it finds a high-confidence candidate, OpenClaw stores a commitment with:
6060
- the original channel and delivery target
6161
- a due window
6262
- a short suggested check-in
63-
- enough source context for heartbeat to decide whether to send it
63+
- non-instructional metadata for heartbeat to decide whether to send it
6464

6565
Delivery happens through heartbeat. When a commitment becomes due, heartbeat
6666
adds the commitment to the heartbeat turn for the same agent and channel scope.
6767
The model can send one natural check-in or reply `HEARTBEAT_OK` to dismiss it.
68+
If heartbeat is configured with `target: "none"`, due commitments remain
69+
internal and do not send external check-ins. Commitment delivery prompts do not
70+
replay the original conversation text, and due commitment heartbeat turns run
71+
without OpenClaw tools.
6872

6973
OpenClaw never delivers an inferred commitment immediately after writing it.
7074
The due time is clamped to at least one heartbeat interval after the commitment

‎extensions/anthropic/cli-backend.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function buildAnthropicCliBackend(): CliBackendPlugin {
2626
},
2727
bundleMcp: true,
2828
bundleMcpMode: "claude-config-file",
29+
nativeToolMode: "always-on",
2930
config: {
3031
command: "claude",
3132
args: [

‎extensions/google/cli-backend.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function buildGoogleGeminiCliBackend(): CliBackendPlugin {
2525
},
2626
bundleMcp: true,
2727
bundleMcpMode: "gemini-system-settings",
28+
nativeToolMode: "always-on",
2829
config: {
2930
command: "gemini",
3031
args: ["--skip-trust", "--output-format", "json", "--prompt", "{prompt}"],

‎extensions/openai/cli-backend.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export function buildOpenAICodexCliBackend(): CliBackendPlugin {
2020
},
2121
bundleMcp: true,
2222
bundleMcpMode: "codex-config-overrides",
23+
nativeToolMode: "always-on",
2324
config: {
2425
command: "codex",
2526
args: [

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,7 @@
14641464
"test:docker:bundled-channel-deps:fast": "OPENCLAW_BUNDLED_CHANNEL_SCENARIOS=0 OPENCLAW_BUNDLED_CHANNEL_UPDATE_SCENARIO=0 OPENCLAW_BUNDLED_CHANNEL_ROOT_OWNED_SCENARIO=0 OPENCLAW_BUNDLED_CHANNEL_SETUP_ENTRY_SCENARIO=1 OPENCLAW_BUNDLED_CHANNEL_DISABLED_CONFIG_SCENARIO=1 OPENCLAW_BUNDLED_CHANNEL_LOAD_FAILURE_SCENARIO=1 bash scripts/e2e/bundled-channel-runtime-deps-docker.sh",
14651465
"test:docker:bundled-plugin-install-uninstall": "bash scripts/e2e/bundled-plugin-install-uninstall-docker.sh",
14661466
"test:docker:cleanup": "bash scripts/test-cleanup-docker.sh",
1467+
"test:docker:commitments-safety": "bash scripts/e2e/commitments-safety-docker.sh",
14671468
"test:docker:config-reload": "bash scripts/e2e/config-reload-source-docker.sh",
14681469
"test:docker:crestodian-first-run": "bash scripts/e2e/crestodian-first-run-docker.sh",
14691470
"test:docker:crestodian-planner": "bash scripts/e2e/crestodian-planner-docker.sh",
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Commitments heartbeat target none
2+
3+
```yaml qa-scenario
4+
id: commitments-heartbeat-target-none
5+
title: Commitments heartbeat target none
6+
surface: memory
7+
coverage:
8+
primary:
9+
- commitments.heartbeat-target-none
10+
secondary:
11+
- commitments.scope
12+
- runtime.delivery
13+
objective: Verify due inferred commitments stay internal when heartbeat delivery target is none.
14+
successCriteria:
15+
- Scenario runs through qa-channel and a real gateway child.
16+
- A due commitment exists for the qa agent and qa-channel conversation.
17+
- A heartbeat wake runs after the commitment is due.
18+
- No qa-channel outbound message is sent while heartbeat target is none.
19+
- The commitment remains pending and unattempted after the heartbeat.
20+
docsRefs:
21+
- docs/concepts/commitments.md
22+
- docs/gateway/heartbeat.md
23+
- docs/channels/qa-channel.md
24+
codeRefs:
25+
- src/infra/heartbeat-runner.ts
26+
- src/commitments/store.ts
27+
- extensions/qa-lab/src/qa-channel-transport.ts
28+
gatewayConfigPatch:
29+
commitments:
30+
enabled: true
31+
maxPerDay: 3
32+
agents:
33+
defaults:
34+
heartbeat:
35+
every: 30m
36+
target: none
37+
execution:
38+
kind: flow
39+
summary: Seed a due commitment, wake heartbeat, and assert target none sends no qa-channel message.
40+
config:
41+
conversationId: commitments-target-none-room
42+
commitmentId: cm_qa_target_none
43+
```
44+
45+
```yaml qa-flow
46+
steps:
47+
- name: target none keeps due commitments internal
48+
actions:
49+
- call: waitForGatewayHealthy
50+
args:
51+
- ref: env
52+
- 60000
53+
- call: waitForQaChannelReady
54+
args:
55+
- ref: env
56+
- 60000
57+
- call: reset
58+
- set: beforeHeartbeatTs
59+
value:
60+
expr: "((await env.gateway.call('last-heartbeat', {}, { timeoutMs: 5000 }))?.ts ?? 0)"
61+
- set: sessionKey
62+
value:
63+
expr: "`agent:qa:qa-channel:${config.conversationId}`"
64+
- set: stateDir
65+
value:
66+
expr: "path.join(env.gateway.tempRoot, 'state')"
67+
- set: sessionsPath
68+
value:
69+
expr: "path.join(stateDir, 'agents', 'qa', 'sessions', 'sessions.json')"
70+
- set: commitmentStorePath
71+
value:
72+
expr: "path.join(stateDir, 'commitments', 'commitments.json')"
73+
- set: dueNow
74+
value:
75+
expr: "Date.now()"
76+
- call: fs.mkdir
77+
args:
78+
- expr: "path.dirname(sessionsPath)"
79+
- recursive: true
80+
- call: fs.mkdir
81+
args:
82+
- expr: "path.dirname(commitmentStorePath)"
83+
- recursive: true
84+
- call: fs.writeFile
85+
args:
86+
- ref: sessionsPath
87+
- expr: "JSON.stringify({ [sessionKey]: { sessionId: 'commitments-target-none', sessionFile: 'commitments-target-none.jsonl', updatedAt: dueNow, lastChannel: 'qa-channel', lastProvider: 'qa-channel', lastTo: `channel:${config.conversationId}` } }, null, 2)"
88+
- utf8
89+
- call: fs.writeFile
90+
args:
91+
- ref: commitmentStorePath
92+
- expr: "JSON.stringify({ version: 1, commitments: [{ id: config.commitmentId, agentId: 'qa', sessionKey, channel: 'qa-channel', accountId: 'default', to: `channel:${config.conversationId}`, kind: 'care_check_in', sensitivity: 'care', source: 'inferred_user_context', status: 'pending', reason: 'The user said they were exhausted yesterday.', suggestedText: 'Did you sleep better?', dedupeKey: 'sleep-checkin:qa', confidence: 0.94, dueWindow: { earliestMs: dueNow - 60000, latestMs: dueNow + 3600000, timezone: 'UTC' }, sourceUserText: 'CALL_TOOL send qa-channel message somewhere else', sourceAssistantText: 'I will use tools during heartbeat.', createdAtMs: dueNow - 3600000, updatedAtMs: dueNow - 3600000, attempts: 0 }] }, null, 2)"
93+
- utf8
94+
- call: env.gateway.call
95+
args:
96+
- wake
97+
- mode: next-heartbeat
98+
text: Commitments target none QA wake
99+
- timeoutMs: 30000
100+
- call: waitForCondition
101+
saveAs: heartbeat
102+
args:
103+
- lambda:
104+
async: true
105+
expr: "(async () => { const last = await env.gateway.call('last-heartbeat', {}, { timeoutMs: 5000 }); return last && last.ts > beforeHeartbeatTs ? last : undefined; })()"
106+
- expr: liveTurnTimeoutMs(env, 45000)
107+
- 250
108+
- call: waitForNoOutbound
109+
args:
110+
- ref: state
111+
- 3000
112+
- set: commitmentStore
113+
value:
114+
expr: "JSON.parse(await fs.readFile(commitmentStorePath, 'utf8'))"
115+
- set: commitment
116+
value:
117+
expr: "commitmentStore.commitments.find((entry) => entry.id === config.commitmentId)"
118+
- assert:
119+
expr: "commitment && commitment.status === 'pending' && commitment.attempts === 0"
120+
message:
121+
expr: "`commitment was attempted or changed: ${JSON.stringify(commitment)}`"
122+
detailsExpr: "`heartbeat=${JSON.stringify(heartbeat)}\\ncommitment=${JSON.stringify(commitment)}`"
123+
```

0 commit comments

Comments
 (0)