Skip to content

fix: support explicit active-memory chat types - #66285

Merged
Takhoffman merged 2 commits into
openclaw:mainfrom
Lidang-Jiang:fix/65775-active-memory-explicit
Apr 28, 2026
Merged

Takhoffman merged 2 commits into
openclaw:mainfrom
Lidang-Jiang:fix/65775-active-memory-explicit

Conversation

@Lidang-Jiang

Copy link
Copy Markdown
Contributor

Summary

  • allow allowedChatTypes to accept "explicit" in the active-memory plugin schema and runtime config normalization
  • treat agent:...:explicit:... sessions as an explicit chat type during gating
  • add regression coverage for schema validation and explicit-session execution

Closes #65775.

AI Assistance

  • AI-assisted: Codex
  • Testing: fully tested locally on targeted lanes
Before
$ node --import tsx -e "import fs from 'node:fs'; import { validateJsonSchemaValue } from './src/plugins/schema-validator.js'; const manifest=JSON.parse(fs.readFileSync('./extensions/active-memory/openclaw.plugin.json','utf-8')); const result=validateJsonSchemaValue({schema:manifest.configSchema,cacheKey:'active-memory-before',value:{enabled:true,agents:['main'],allowedChatTypes:['direct','explicit']}}); console.log(JSON.stringify({ok:result.ok, errors:result.errors?.map((e)=>e.message)}, null, 2));"
{
  "ok": false,
  "errors": [
    "must be equal to one of the allowed values (allowed: \"direct\", \"group\", \"channel\")"
  ]
}
After
$ node --import tsx -e "import fs from 'node:fs'; import { validateJsonSchemaValue } from './src/plugins/schema-validator.js'; const manifest=JSON.parse(fs.readFileSync('./extensions/active-memory/openclaw.plugin.json','utf-8')); const result=validateJsonSchemaValue({schema:manifest.configSchema,cacheKey:'active-memory-after',value:{enabled:true,agents:['main'],allowedChatTypes:['direct','explicit']}}); console.log(JSON.stringify({ok:result.ok, errors:result.errors?.map((e)=>e.message)}, null, 2));"
{
  "ok": true
}

$ node scripts/run-vitest.mjs run --config test/vitest/vitest.extensions.config.ts extensions/active-memory/index.test.ts extensions/active-memory/config.test.ts
EXIT:0

Test plan

  • targeted schema validation for allowedChatTypes: ["direct", "explicit"]
  • targeted active-memory extension tests

@greptile-apps

greptile-apps Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds "explicit" as a valid value in the allowedChatTypes field of the active-memory plugin, fixing a schema validation error and adding runtime recognition of agent:...:explicit:... session keys as an "explicit" chat type. Changes are self-contained to the extensions/active-memory/ package.

Confidence Score: 5/5

This PR is safe to merge — changes are strictly additive, scoped to a single extension package, and well-covered by targeted tests.

All changes are in the active-memory extension. The schema, TypeScript types, normalization filter, and session-key detector are all updated consistently. The positive test cases cover both the schema validation path and the runtime execution path. No logic regressions or P1 issues were found.

No files require special attention.

Reviews (1): Last reviewed commit: "fix: support explicit active-memory chat..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88aff48335

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread extensions/active-memory/index.ts Outdated
Comment on lines +885 to +889
if (sessionKey.includes(":channel:")) {
return "channel";
}
if (sessionKey.includes(":explicit:")) {
return "explicit";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Parse explicit sessions before other chat-type markers

resolveChatType scans sessionKey with broad includes checks, and :channel: is checked before :explicit:. Because explicit session ids are passed through verbatim in src/agents/command/session.ts (buildExplicitSessionIdSessionKey just appends sessionId.trim()), an explicit key like agent:main:explicit:foo:channel:bar is misclassified as channel instead of explicit. In that case, allowedChatTypes: ["explicit"] will incorrectly block active memory for a valid explicit session id containing :channel:/:group:/:direct: segments.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.

Keep this PR open. Current main still rejects and strips the explicit Active Memory chat type and cannot classify agent:...:explicit:... session keys as explicit. The current PR head is still a useful implementation candidate for linked bug #65775 and appears to address the earlier resolver-review concern by checking structured explicit keys before broad marker checks.

Best possible solution:

Keep this PR open as the active implementation candidate for linked bug #65775. Add or confirm the public Active Memory docs coverage for allowedChatTypes: ["explicit"], then review and land the focused schema, runtime resolver, normalization, changelog, and regression-test changes after normal CI.

What I checked:

  • Current manifest rejects explicit: The Active Memory manifest schema still limits allowedChatTypes to direct, group, and channel; explicit is not in the enum on current main. (extensions/active-memory/openclaw.plugin.json:23, 12aaef9035ea)
  • Current runtime strips explicit: The runtime config types and normalization filter still accept only direct | group | channel, so explicit would be removed before gating. (extensions/active-memory/index.ts:70, 12aaef9035ea)
  • Current resolver cannot return explicit: resolveChatType checks group, channel, direct/dm, and a webchat fallback, but has no explicit branch; isAllowedChatType then gates only on that resolver output. (extensions/active-memory/index.ts:878, 12aaef9035ea)
  • Explicit session keys are current behavior: Agent session-id routing builds keys in the form agent:<agentId>:explicit:<sessionId>, which is the session shape the PR needs to classify. (src/agents/command/session.ts:57, 12aaef9035ea)
  • Current docs and tests lack explicit coverage: The public Active Memory docs still show only direct, group, and channel examples, and current Active Memory config/runtime tests do not include an explicit allowedChatTypes or explicit-session regression case. Public docs: docs/concepts/active-memory.md. (docs/concepts/active-memory.md:233, 12aaef9035ea)
  • PR head addresses prior review concern: The provided current PR diff adds explicit to the schema/types/filter, classifies structured agent:...:explicit:... keys before marker checks, and adds regression coverage for explicit sessions whose opaque id contains group/channel-like tokens. (extensions/active-memory/index.ts:883, c51b4dc5d2a9)

Remaining risk / open question:

  • Closing this PR now would leave the linked Active Memory bug unresolved on current main.
  • The public Active Memory docs still do not mention explicit; landing should include a docs update or an intentional maintainer decision that manifest help and changelog coverage are enough.
  • Normal maintainer CI/review is still needed before merge; this review was read-only and did not run tests.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 12aaef9035ea.

@Takhoffman
Takhoffman force-pushed the fix/65775-active-memory-explicit branch from 88aff48 to c51b4dc Compare April 28, 2026 13:36
@Takhoffman
Takhoffman force-pushed the fix/65775-active-memory-explicit branch from c51b4dc to c5b0e80 Compare April 28, 2026 13:41
@Takhoffman
Takhoffman merged commit 6d539db into openclaw:main Apr 28, 2026
56 of 58 checks passed
@Takhoffman

Copy link
Copy Markdown
Contributor

Merged in 6d539db after representative verification with the active-memory config/runtime tests, targeted formatting, and diff checks. I also resolved the stale-base overlap with the newly landed chat-id filters, added the Unreleased changelog entry, and kept explicit session keys classified before opaque session-id tokens can shadow the chat type.

@Ziy1-Tan

Copy link
Copy Markdown
Contributor

This looks like it is blocking unrelated PRs in CI.

After this landed, lint:extensions:bundled / extensions oxlint started failing on extensions/active-memory/index.test.ts typescript-eslint(await-thenable) because plugin.register(...) is being awaited even though it is sync there.

I hit this from another PR that does not touch active-memory, so this seems like a cross-PR regression from #73563 rather than a failure in downstream branches.

cc @Lidang-Jiang @Takhoffman

@Lidang-Jiang

Copy link
Copy Markdown
Contributor Author

@Ziy1-Tan Thanks for flagging this. I checked current main, and the extensions/active-memory/index.test.ts regression is already fixed there: the active-memory plugin.register(...) call sites are no longer awaited.

The cleanup landed after this PR via 891c7d9f1c1f5e0f52935fadfeacf695b0ef1eb8, and check-lint / check-additional-extension-bundled are green on #73563 now. I am not opening a duplicate PR for the active-memory lint issue since there is no remaining diff to submit on main.

The remaining #73563 failures I see are separate: a checks-node-extensions-shard-5 timeout in extensions/codex/src/app-server/run-attempt.test.ts plus the parity gate, not the active-memory await-thenable lint regression.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Verified:
- pnpm install --frozen-lockfile
- pnpm test extensions/active-memory/config.test.ts extensions/active-memory/index.test.ts
- pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/active-memory/index.ts extensions/active-memory/index.test.ts extensions/active-memory/config.test.ts extensions/active-memory/openclaw.plugin.json
- git diff --check

Co-authored-by: Lidang-Jiang <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Verified:
- pnpm install --frozen-lockfile
- pnpm test extensions/active-memory/config.test.ts extensions/active-memory/index.test.ts
- pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/active-memory/index.ts extensions/active-memory/index.test.ts extensions/active-memory/config.test.ts extensions/active-memory/openclaw.plugin.json
- git diff --check

Co-authored-by: Lidang-Jiang <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Verified:
- pnpm install --frozen-lockfile
- pnpm test extensions/active-memory/config.test.ts extensions/active-memory/index.test.ts
- pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/active-memory/index.ts extensions/active-memory/index.test.ts extensions/active-memory/config.test.ts extensions/active-memory/openclaw.plugin.json
- git diff --check

Co-authored-by: Lidang-Jiang <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
Verified:
- pnpm install --frozen-lockfile
- pnpm test extensions/active-memory/config.test.ts extensions/active-memory/index.test.ts
- pnpm exec oxfmt --check --threads=1 CHANGELOG.md extensions/active-memory/index.ts extensions/active-memory/index.test.ts extensions/active-memory/config.test.ts extensions/active-memory/openclaw.plugin.json
- git diff --check

Co-authored-by: Lidang-Jiang <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

active-memory: allowedChatTypes silently strips "explicit" sessions

3 participants