openclaw/src/agents
Drake Thomsen c5fa757ef6 fix(agents): prevent Anthropic 400 'Incorrect role information' error
Add validateAnthropicTurns() to merge consecutive user messages that can
occur when steering messages are injected during streaming. This prevents
the API from rejecting requests due to improper role alternation.

Changes:
- Add validateAnthropicTurns() function in pi-embedded-helpers.ts
- Integrate validation into sanitization pipeline in pi-embedded-runner.ts
- Add user-friendly error message for role ordering errors
- Add comprehensive tests for the new validation function
2026-01-12 23:42:13 +00:00
..
pi-extensions fix: add copilot tests and lint fixes 2026-01-12 17:48:08 +00:00
schema fix(agents): harden Cloud Code Assist compatibility 2026-01-10 18:06:35 +01:00
tools chore: reinforce memory recall prompts 2026-01-12 23:29:56 +00:00
agent-paths.test.ts fix(agents): default agent dir to multi-agent path 2026-01-06 21:54:42 +00:00
agent-paths.ts fix(agents): default agent dir to multi-agent path 2026-01-06 21:54:42 +00:00
agent-scope.test.ts fix: rename bash tool to exec (#748) (thanks @myfunc) 2026-01-12 02:49:55 +00:00
agent-scope.ts feat: add memory vector search 2026-01-12 11:23:44 +00:00
anthropic.setup-token.live.test.ts test: add setup-token live smoke 2026-01-10 21:45:15 +00:00
apply-patch.test.ts feat: add apply_patch tool (exec-gated) 2026-01-12 03:42:56 +00:00
apply-patch.ts feat: add apply_patch tool (exec-gated) 2026-01-12 03:42:56 +00:00
auth-health.test.ts feat(models): add oauth auth health 2026-01-09 00:34:38 +00:00
auth-health.ts feat: support token auth profiles 2026-01-09 08:13:04 +01:00
auth-profiles.test.ts fix: prevent claude-cli oauth downgrade (#654) (thanks @radek-paclt) 2026-01-10 15:50:25 +01:00
auth-profiles.ts fix: throttle cli credential sync 2026-01-10 17:44:03 +01:00
bash-process-registry.test.ts refactor: remove bash pty mode 2026-01-03 20:15:10 +00:00
bash-process-registry.ts fix: scope process sessions per agent 2026-01-07 23:35:04 +01:00
bash-tools.test.ts fix: rename bash tool to exec (#748) (thanks @myfunc) 2026-01-12 02:49:55 +00:00
bash-tools.ts fix: rename bash tool to exec (#748) (thanks @myfunc) 2026-01-12 02:49:55 +00:00
claude-cli-runner.test.ts test: stabilize claude cli serialization test 2026-01-09 05:27:50 +00:00
claude-cli-runner.ts Move provider to a plugin-architecture (#661) 2026-01-11 11:45:25 +00:00
clawdbot-gateway-tool.test.ts fix: cover extra thinking tags (#688) (thanks @theglove44) 2026-01-10 23:23:23 +01:00
clawdbot-tools.agents.test.ts feat: wire multi-agent config and routing 2026-01-09 12:48:42 +00:00
clawdbot-tools.camera.test.ts fix(nodes-tool): add run invoke timeout (PR #433, thanks @sircrumpet) 2026-01-08 00:18:06 +00:00
clawdbot-tools.session-status.test.ts chore: normalize Clawdbot naming 2026-01-10 05:14:09 +01:00
clawdbot-tools.sessions.test.ts fix: clarify sessions_send delivery semantics 2026-01-10 00:34:24 +01:00
clawdbot-tools.subagents.test.ts feat: subagent model defaults 2026-01-12 18:08:30 +00:00
clawdbot-tools.ts fix: stabilize session tools and tests 2026-01-12 18:21:20 +00:00
cli-backends.ts feat: add codex cli backend 2026-01-11 01:39:30 +00:00
cli-credentials.test.ts fix: make codex keychain platform-aware 2026-01-12 00:32:47 +00:00
cli-credentials.ts fix: make codex keychain platform-aware 2026-01-12 00:32:47 +00:00
cli-runner.ts fix: stabilize cli runner output 2026-01-11 02:25:45 +00:00
cli-session.ts feat: add CLI backend fallback 2026-01-11 00:55:22 +00:00
context-window-guard.test.ts fix: guard small context windows 2026-01-10 01:08:56 +01:00
context-window-guard.ts fix: guard small context windows 2026-01-10 01:08:56 +01:00
context.ts chore: rename project to clawdbot 2026-01-04 14:38:51 +00:00
defaults.ts feat(agent): enforce provider/model and identity defaults 2025-12-14 04:22:38 +00:00
failover-error.test.ts refactor: centralize failover error parsing 2026-01-10 01:26:06 +01:00
failover-error.ts refactor: centralize failover error parsing 2026-01-10 01:26:06 +01:00
identity.test.ts feat(agent): add human-like delay between block replies 2026-01-10 17:12:50 +01:00
identity.ts feat(agent): add human-like delay between block replies 2026-01-10 17:12:50 +01:00
lanes.ts fix(gateway): harden agent provider routing 2026-01-09 23:00:36 +01:00
live-auth-keys.ts fix: modernize live tests and gemini ids 2026-01-12 07:05:33 +00:00
live-model-filter.ts fix: modernize live tests and gemini ids 2026-01-12 07:05:33 +00:00
memory-search.test.ts feat: add memory vector search 2026-01-12 11:23:44 +00:00
memory-search.ts feat: add memory vector search 2026-01-12 11:23:44 +00:00
minimax-vlm.ts fix(image): route MiniMax vision to VLM 2026-01-12 20:38:34 +00:00
minimax.live.test.ts feat: Add MiniMax Anthropic-compatible API support (minimax-api) 2026-01-09 18:13:18 +01:00
model-auth.test.ts fix: send heartbeat reasoning (#694) (thanks @antons) 2026-01-11 03:51:51 +01:00
model-auth.ts feat: add Moonshot auth choice 2026-01-12 06:48:06 +00:00
model-catalog.ts chore: rename project to clawdbot 2026-01-04 14:38:51 +00:00
model-compat.test.ts fix: clamp z.ai developer role 2026-01-11 04:28:30 +01:00
model-compat.ts fix: clamp z.ai developer role 2026-01-11 04:28:30 +01:00
model-fallback.test.ts refactor(agents): centralize failover handling 2026-01-09 21:31:18 +01:00
model-fallback.ts refactor(agents): centralize failover normalization 2026-01-09 22:15:06 +01:00
model-scan.test.ts feat: add model scan progress callbacks 2026-01-08 05:20:39 +01:00
model-scan.ts style: apply lint fixes 2026-01-08 04:44:15 +00:00
model-selection.test.ts feat(model): fuzzy /model matching 2026-01-12 07:57:53 +00:00
model-selection.ts feat(model): fuzzy /model matching 2026-01-12 07:57:53 +00:00
models-config.providers.ts feat(image): auto-pair image model 2026-01-12 17:50:47 +00:00
models-config.test.ts fix(models): preserve implicit vision models 2026-01-12 19:09:15 +00:00
models-config.ts fix(models): preserve implicit vision models 2026-01-12 19:09:15 +00:00
models.profiles.live.test.ts fix: clean up lint + guardCancel typing 2026-01-12 07:07:27 +00:00
openai-responses.reasoning-replay.test.ts fix(testing): stabilize live model runs 2026-01-11 04:22:35 +00:00
opencode-zen-models.test.ts fix: align opencode-zen provider setup 2026-01-10 21:38:18 +01:00
opencode-zen-models.ts fix: align opencode-zen provider setup 2026-01-10 21:38:18 +01:00
pi-embedded-block-chunker.test.ts refactor: cron payload migration cleanup (#621) 2026-01-09 22:56:55 +00:00
pi-embedded-block-chunker.ts fix: enable block streaming for Telegram when streamMode is 'block' 2026-01-10 01:11:41 +01:00
pi-embedded-helpers.test.ts fix(agents): prevent Anthropic 400 'Incorrect role information' error 2026-01-12 23:42:13 +00:00
pi-embedded-helpers.ts fix(agents): prevent Anthropic 400 'Incorrect role information' error 2026-01-12 23:42:13 +00:00
pi-embedded-messaging.ts Move provider to a plugin-architecture (#661) 2026-01-11 11:45:25 +00:00
pi-embedded-runner-extraparams.live.test.ts test: respect openai max tokens floor 2026-01-12 04:04:04 +00:00
pi-embedded-runner-extraparams.test.ts feat: wire multi-agent config and routing 2026-01-09 12:48:42 +00:00
pi-embedded-runner.guard.test.ts fix: add copilot tests and lint fixes 2026-01-12 17:48:08 +00:00
pi-embedded-runner.test.ts fix: stabilize session tools and tests 2026-01-12 18:21:20 +00:00
pi-embedded-runner.ts fix(agents): prevent Anthropic 400 'Incorrect role information' error 2026-01-12 23:42:13 +00:00
pi-embedded-subscribe.test.ts style: italicize reasoning output 2026-01-12 21:24:36 +00:00
pi-embedded-subscribe.ts fix: enforce final tag gating (#754) (thanks @mcinteerj) 2026-01-12 08:45:23 +00:00
pi-embedded-utils.ts style: italicize reasoning output 2026-01-12 21:24:36 +00:00
pi-embedded.ts feat: gate slash commands and add compact 2026-01-06 02:23:55 +01:00
pi-settings.test.ts feat: add pre-compaction memory flush 2026-01-12 05:29:18 +00:00
pi-settings.ts feat: add pre-compaction memory flush 2026-01-12 05:29:18 +00:00
pi-tool-definition-adapter.test.ts fix(tools): keep tool errors concise 2026-01-07 19:08:13 +00:00
pi-tool-definition-adapter.ts fix(tools): keep tool errors concise 2026-01-07 19:08:13 +00:00
pi-tools-agent-config.test.ts feat: add apply_patch tool (exec-gated) 2026-01-12 03:42:56 +00:00
pi-tools.test.ts chore: fix lint warnings 2026-01-12 22:07:39 +00:00
pi-tools.ts chore: fix lint after rebase 2026-01-12 22:19:02 +00:00
pi-tools.workspace-paths.test.ts fix: rename bash tool to exec (#748) (thanks @myfunc) 2026-01-12 02:49:55 +00:00
provider-tools.ts Move provider to a plugin-architecture (#661) 2026-01-11 11:45:25 +00:00
sandbox-agent-config.test.ts fix(sandbox): always allow image tool 2026-01-12 18:07:34 +00:00
sandbox-create-args.test.ts test(sandbox): add coverage for binds -v flag emission 2026-01-12 21:57:51 +00:00
sandbox-explain.test.ts refactor(sandbox): drop legacy memory shorthand 2026-01-12 22:59:36 +00:00
sandbox-merge.test.ts Add docker bind mounds for sandboxing 2026-01-12 21:57:51 +00:00
sandbox-paths.ts feat: add per-session agent sandbox 2026-01-03 21:41:58 +01:00
sandbox-skills.test.ts test: stabilize doctor + sandbox tests 2026-01-11 04:45:04 +01:00
sandbox.resolveSandboxContext.test.ts fix(sandbox): canonicalize agent main alias 2026-01-12 02:23:02 +00:00
sandbox.ts refactor(sandbox): drop legacy memory shorthand 2026-01-12 22:59:36 +00:00
session-tool-result-guard-wrapper.ts fix: add copilot tests and lint fixes 2026-01-12 17:48:08 +00:00
session-tool-result-guard.test.ts fix: keep session sanitizer stable 2026-01-12 18:19:30 +00:00
session-tool-result-guard.ts fix: add copilot tests and lint fixes 2026-01-12 17:48:08 +00:00
session-transcript-repair.test.ts fix: rename bash tool to exec (#748) (thanks @myfunc) 2026-01-12 02:49:55 +00:00
session-transcript-repair.ts fix: guard session tool results 2026-01-12 17:28:46 +00:00
session-write-lock.ts fix(agents): enforce single-writer session files 2026-01-11 02:25:45 +00:00
shell-utils.ts fix(bash): use PowerShell on Windows to capture system utility output 2026-01-12 02:13:02 +00:00
skills-install.ts style: format lint offenders 2026-01-07 00:04:44 +01:00
skills-status.ts style: tidy cli formatting 2026-01-08 08:26:40 +01:00
skills.test.ts refactor: centralize skills prompt resolution 2026-01-09 21:27:20 +01:00
skills.ts feat: plugin system + voice-call 2026-01-12 01:16:39 +00:00
subagent-announce.ts fix(subagent): make announce prompt more emphatic 2026-01-12 00:52:36 +00:00
subagent-registry.ts fix(subagents): align wait timeout with run timeout 2026-01-12 02:06:43 +00:00
system-prompt.test.ts fix: rename bash tool to exec (#748) (thanks @myfunc) 2026-01-12 02:49:55 +00:00
system-prompt.ts chore: reinforce memory recall prompts 2026-01-12 23:29:56 +00:00
timeout.ts feat: wire multi-agent config and routing 2026-01-09 12:48:42 +00:00
tool-call-id.test.ts fix(agents): sanitize transcripts for strict tool APIs 2026-01-11 04:46:18 +00:00
tool-call-id.ts fix(agents): sanitize transcripts for strict tool APIs 2026-01-11 04:46:18 +00:00
tool-display.json feat: add memory vector search 2026-01-12 11:23:44 +00:00
tool-display.ts fix(build): import tool-display.json instead of fs.readFileSync (#312) 2026-01-06 10:55:02 -06:00
tool-images.test.ts fix: resolve camera tool handling 2026-01-02 17:44:25 +00:00
tool-images.ts chore: rename project to clawdbot 2026-01-04 14:38:51 +00:00
tool-summaries.ts Move provider to a plugin-architecture (#661) 2026-01-11 11:45:25 +00:00
usage.test.ts fix: restore Anthropic token accounting 2026-01-06 18:52:01 +00:00
usage.ts style(agents): format usage helper 2026-01-06 19:54:50 +01:00
workspace.test.ts fix: limit subagent bootstrap context 2026-01-10 00:01:16 +00:00
workspace.ts fix: limit subagent bootstrap context 2026-01-10 00:01:16 +00:00
zai.live.test.ts chore: apply biome formatting 2026-01-01 17:30:15 +01:00