Skip to content

refactor(memory): clean up OC-40 diagnostic probes#3

Merged
rzyns merged 2 commits into
fix/memory-capability-workspace-scopefrom
fix/oc-40-followups
Apr 21, 2026
Merged

refactor(memory): clean up OC-40 diagnostic probes#3
rzyns merged 2 commits into
fix/memory-capability-workspace-scopefrom
fix/oc-40-followups

Conversation

@rzyns

@rzyns rzyns commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to openclaw#69458 addressing three review suggestions. Stacked on fix/memory-capability-workspace-scope; this PR lives on the fork and will be retargeted to openclaw:main once openclaw#69458 lands (or cherry-picked onto a new branch off main).

  • Strip temporary debug probes from the OC-40 investigation:
    • [memory-core-register-probe] step-wrapper in extensions/memory-core/index.ts — also removes the surrounding try/catch that existed only to report rethrows.
    • [memory-core-artifacts-probe] in extensions/memory-core/src/public-artifacts.ts.
    • [memory-bridge-probe] in src/plugins/memory-state.ts#listActiveMemoryPublicArtifacts.
  • Restore strict publicArtifacts predicate via a local bind. listArtifacts is read into a const before the optional call, so the oxlint unbound-method warning that drove the earlier !== undefined workaround no longer fires — and the call reverts to the original narrower form.
  • Kept [plugin-scope-debug] in src/plugins/loader.ts: that one has sanitization, its own regression tests, and is the long-term diagnostic entry point — not OC-40 scratch instrumentation.

Why a separate PR

The probes paid their rent (pinpointed the scope-swap bug), but they're not part of the fix. Keeping openclaw#69458 focused on the capability-scope lifecycle change and landing the cleanup in a smaller PR makes each diff easier to review and revert in isolation.

Verification

Test plan

🤖 Generated with Claude Code

Addresses follow-ups from PR openclaw#69458 code review:

- Strip temporary `[memory-core-register-probe]` step wrapper in
  `extensions/memory-core/index.ts` (removes try/catch control-flow
  change that existed purely for debug).
- Strip `[memory-core-artifacts-probe]` in
  `extensions/memory-core/src/public-artifacts.ts`.
- Strip `[memory-bridge-probe]` in
  `src/plugins/memory-state.ts#listActiveMemoryPublicArtifacts`.
- Restore strict `publicArtifacts.listArtifacts` invocation via a
  local bind — narrower than `cap?.capability.publicArtifacts !== undefined`
  and satisfies oxlint `unbound-method` because the reference is read
  into a const before the optional call.

The structured `[plugin-scope-debug]` diagnostic in `src/plugins/loader.ts`
stays — it has its own sanitization, tests, and is the long-term entry
point for scope diagnostics.

Co-Authored-By: Claude Opus 4.7 <[email protected]>

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

Copy link
Copy Markdown

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: 69bf1427ec

ℹ️ 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 src/plugins/memory-state.ts Outdated
Comment on lines +287 to +288
const listArtifacts = activeMemoryCapability?.capability.publicArtifacts?.listArtifacts;
const artifacts = (await listArtifacts?.(params)) ?? [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve receiver when invoking listArtifacts

Calling listArtifacts through a local function variable drops the original receiver (this), while the previous call form invoked it as an object method. Any memory plugin that implements publicArtifacts.listArtifacts using instance/object state via this will now run with this === undefined, which can throw at runtime or return incorrect artifacts. Keep the method bound to publicArtifacts (or call it via the object) to avoid breaking plugin implementations that rely on method semantics.

Useful? React with 👍 / 👎.

…eiver

Extracting listArtifacts into a local const stripped the `this` binding;
plugins implementing the method-shorthand type with `this`-bound state
would have run with `this === undefined`. Calling via `provider?.listArtifacts(params)`
keeps the receiver bound while still satisfying oxlint's unbound-method rule.

Flagged by Codex review on PR #3.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@rzyns
rzyns merged commit 4bfed62 into fix/memory-capability-workspace-scope Apr 21, 2026
2 of 9 checks passed
@rzyns
rzyns deleted the fix/oc-40-followups branch April 21, 2026 10:51
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.

2 participants