Skip to content

fix(openclaw): make identity skip filters config-aware for per-agent banking#1054

Merged
nicoloboschi merged 4 commits intomainfrom
fix/openclaw-agent-banking-skip-reasons
Apr 14, 2026
Merged

fix(openclaw): make identity skip filters config-aware for per-agent banking#1054
nicoloboschi merged 4 commits intomainfrom
fix/openclaw-agent-banking-skip-reasons

Conversation

@nicoloboschi
Copy link
Copy Markdown
Collaborator

Summary

  • Thread pluginConfig through resolveAndCacheIdentitygetIdentitySkipReason so the skip filters know whether per-agent banking is enabled.
  • When dynamicBankGranularity includes 'agent': allow agent:*:main sessions, allow provider main (still skip cron/heartbeat/subagent), and synthesize agent-user:<agentId> for anonymous CLI sessions. Default behavior is unchanged otherwise.
  • Adds tests covering each new path and confirms the default skip behavior is preserved.

Fixes #1046

Test plan

  • npx vitest run src/index.test.ts (74/74 pass, including 5 new cases)
  • ./scripts/hooks/lint.sh

…banking

When dynamicBankGranularity includes 'agent', each agent should get its own
bank — including 'main' and CLI sessions. The existing filters in
getIdentitySkipReason() unconditionally rejected agent:*:main sessions,
provider 'main', and anonymous senderIds, which prevented per-agent banks
from ever being created for the main agent or any CLI-accessed agent.

Thread pluginConfig through resolveAndCacheIdentity to getIdentitySkipReason,
and when per-agent banking is enabled:
- allow agent:*:main sessions through
- allow provider 'main' (still skip cron/heartbeat/subagent)
- synthesize agent-user:<agentId> for anonymous CLI sessions

Default behavior is unchanged when dynamicBankGranularity does not include
'agent'.

Fixes #1046
Broaden the carve-out so the same skip-bypass behavior fires when the user
has explicitly opted into a single named bank via dynamicBankId=false +
bankId. In that mode every session — including agent:*:main, provider 'main',
and anonymous senders — should retain into the configured bank.

The carve-out still requires a non-empty bankId; dynamicBankId=false alone
doesn't trigger it (the bank would be unresolvable).
extractStructuredBlocks was calling stripMemoryTags + stripMetadataEnvelopes
but not stripInlineRetainTags, so <retain_tags>...</retain_tags> directives
survived into the retained JSON transcript on the default
retainFormat=json + retainToolCalls=true path.
…format

The two transcript-format assertions still expected the legacy text markers
(`[role: user] ... [user:end]`), but the default retainFormat is now 'json'
with Anthropic-shaped typed blocks. Parse the JSON and assert against the
structured shape instead.
@nicoloboschi nicoloboschi merged commit 90a2201 into main Apr 14, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make getIdentitySkipReason() config-aware for dynamicBankGranularity: ["agent"]

1 participant