[integrations] OpenClaw plugin: inject schema_version + surface error details in client#278
Conversation
…etails
The Edge Function's recallSchema and writebackSchema both require
schema_version (no default) but client.ts never injected it, so every
call from the plugin to the live API failed validation with
400 "Invalid recall payload" / "Invalid write-back payload" before
reaching any business logic.
Add schema_version to recall() and writeback() request bodies, mirroring
the existing auto-fill pattern for workspace_id and project_id. The
default is placed before the ...input spread so any explicitly-supplied
value still wins (preserves the existing live-smoke.mjs payload shape,
which hardcodes schema_version directly).
Also surface data.details in thrown errors. The Edge Function returns
{ error, details } with details.fieldErrors naming exactly which fields
failed validation, but the original throw used data.error || text and
dropped details on the floor — making payload-shape mismatches opaque
to debug.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Hey @pineapplestrikesback — welcome to Open Brain Source! 👋 Thanks for submitting your first PR. The automated review will run shortly and check things like metadata, folder structure, and README completeness. If anything needs fixing, the review comment will tell you exactly what. Once the automated checks pass, a human admin will review for quality and clarity. Expect a response within a few days. If you have questions, check out CONTRIBUTING.md or open an issue. |
|
Seeing this issue also. Would love to see this merged in as the OpenClaw plugin doesn't appear to be working in current state. @pineapplestrikesback I have another PR that explicitly addresses the |
|
Thanks for the contribution, and welcome. The error-surfacing change is a real improvement — including One thing to fix first, and it is the same issue raised on #290: Two notes for the maintainer. #278 also covers what #290 does (the writeback Recommend author refresh with the reorder. — Alan (community reviewer; non-binding) |
…onfirmed default) Two changes per @alan's community review on PR NateBJones-Projects#280: 1. Remove subfolder LICENSE (MIT) so this dir inherits the repo's FSL-1.1-MIT. The MIT-in-FSL nested-license situation was a real compatibility issue; following the same convention as integrations/openclaw-agent-memory/ which inherits root LICENSE.md. 2. Change include_unconfirmed_recall config fallback from False to True (line 159 of plugin/__init__.py) so it matches the DEFAULTS dict at line 96 and the design intent documented in phase-8 lessons learned. Recall returned 0 with False — pending memories (which is the default for governed writes per require_review_by_default=True) were filtered out before reaching the caller. Edge Function's scoreMemory still ranks pending memories lower so they don't dominate; they just appear. Same governance direction as PR NateBJones-Projects#283 (OpenClaw companion). Whatever the maintainer settles on for the OpenClaw cluster (NateBJones-Projects#278/281/283/309) applies consistently here; current change aligns Hermes-OB1 with the resolved defaults documented in the Hermes-OB1 phase-8 final report. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contribution Type
/integrations) — bug fix to existingintegrations/openclaw-agent-memory/pluginWhat does this do?
Fixes two defects in the OpenClaw plugin's API client (
integrations/openclaw-agent-memory/plugin/src/client.ts):schema_versionnot injected. The Edge Function'srecallSchemaandwritebackSchemaboth requireschema_version(no default), butclient.recall()andclient.writeback()never injected it — so every call from the plugin to the live API failed with400 "Invalid recall payload"(or the writeback equivalent) before reaching any business logic. Adds the default to both methods, mirroring the existing auto-fill pattern forworkspace_idandproject_id. Caller-supplied values still win (preserves the existingagent-memory-api/smoke/live-smoke.mjspayload shape, which hardcodesschema_versiondirectly).data.detailsdropped from thrown errors.request()useddata.error || textand ignoreddata.details, sodetails.fieldErrors(which names exactly which fields failed validation) never reached the caller — making payload-shape mismatches opaque to debug. Includesdetailsin the thrown error message.No changes outside
integrations/openclaw-agent-memory/plugin/.metadata.json,README.md, tool definitions, manifest, and the Edge Function are all unchanged.Repro on current
mainWhy this slipped past existing tests
integrations/agent-memory-api/smoke/live-smoke.mjsvalidates the API directly withschema_versionhardcoded in each request body, bypassing the plugin client. The Edge Function was proven correct end-to-end at deploy, but the plugin → API call path was never exercised.Requirements
None new. Same services as the existing OpenClaw Agent Memory integration:
Checklist
README.mdandmetadata.jsonare unchanged (fix to existing files only)integrations/openclaw-agent-memory/plugin/(rule 12 scope check)Related issue not in this PR (worth flagging)
When debugging the original 400, I found a second defect in the same area this PR does not fix:
openbrain_recallandopenbrain_writebackinplugin/src/index.tsdeclareparameters: Type.Record(Type.String(), Type.Any()), which collapses to a no-args schema at the MCP/LLM tool boundary — the LLM can't supply any arguments through these tools (so even with this PR'sschema_versionfix, the LLM-driven path still 400s on missingquery/memory_payload).Holding that as a separate follow-up PR because it's a larger, more opinionated change (rewriting two parameter schemas to mirror the API's zod schemas) and I didn't want to slow this small fix down. Happy to send the second PR alongside this if you'd prefer them bundled.