Skip to content

fix(tools): community fixes for 3.1.2 - #1798

Merged
MaheshtheDev merged 11 commits into
mainfrom
mtd/tools-3-community-fixes
Oct 12, 2026
Merged

MaheshtheDev merged 11 commits into
mainfrom
mtd/tools-3-community-fixes

Conversation

@MaheshtheDev

@MaheshtheDev MaheshtheDev commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Bundles 8 community fixes for @supermemory/tools, cherry-picked with their original authors, and adapts them to v5. Ships as 3.1.2.

Co-Authored-By: abhinav7x94 204053250+abhinav7x94@users.noreply.github.com
Co-Authored-By: rohitsux 71192000+rohitsux@users.noreply.github.com
Co-Authored-By: aniruddhaadak80 127435065+aniruddhaadak80@users.noreply.github.com
Co-Authored-By: Adityakk9031 143548997+Adityakk9031@users.noreply.github.com
Co-Authored-By: Rikinshah787 87516554+Rikinshah787@users.noreply.github.com
Co-Authored-By: Agnik47 140933190+Agnik47@users.noreply.github.com

abhinav7x94 and others added 9 commits October 12, 2026 13:43
…ntics

Anthropic's memory_20250818 spec defines insert as: insert_text is inserted
AFTER line insert_line, 0 inserts at the beginning of the file, and the valid
range is [0, n_lines]. The implementation treated insert_line as a 1-based
insert-BEFORE index with range [1, n_lines + 1].

Since the caller of this tool is Claude itself, which is trained on the spec
semantics, every model-driven insert landed one line earlier than intended,
insert_line: 0 (insert at top of file) was rejected as invalid, and
insert_line: n_lines (append) inserted before the last line instead of after
it.

Fix the validation range to [0, n_lines], splice at insert_line directly
(0-based insert-after), and update the error and success messages to match.
One existing tool-operations test encoded the old insert-before behavior; its
insert_line is adjusted so its expected output is unchanged under spec
semantics. Adds four regression tests covering top-of-file, middle,
append, and both out-of-range directions.
Three places where ClaudeMemoryTool diverges from the documented
memory_20250818 wire format:

- rename sends old_path/new_path, not path. handleCommand validated
  command.path, so every rename coming from a real model died with
  "Cannot read properties of undefined (reading 'startsWith')".
  path is still accepted as the source for existing callers.
- insert_line means "insert after this line" (0 = top of file), but we
  spliced at insertLine - 1 and rejected 0, so every insert landed one
  line above where Claude asked and inserting at the top was impossible.
- str_replace with new_str omitted is a deletion per the spec; we
  rejected it.

The new tests mock the supermemory client so they run without an API
key. Also fixed the rename example in the docs, which showed the same
path shape the code expected.
…ect args

`getProfile`, `documentList` and `memoryForget` all declare `required: []`,
so a model may legitimately call them with no arguments at all. The OpenAI
API serialises that as `arguments: ""`, and `parseToolArguments` handed the
empty string straight to `JSON.parse`, so every no-argument call came back as

    {"success":false,"error":"Invalid JSON arguments for getProfile"}

Those three tools were unreachable in their documented no-argument form.

The same gate also lets non-object JSON through. `"null"` parses cleanly and
then rejects in the destructuring parameter of every tool function --
`TypeError: Cannot destructure property 'containerTag' of 'object null'` --
which escapes `executeToolCall`, since it has no catch, and fails the whole
request. That is precisely the throw #1488 added this gate to contain. `"5"`
and `"\"text\""` are quieter but worse: they destructure to `undefined` and
call the API with no container tag at all.

Treat blank arguments as `{}`, and require the parsed value to be a non-null,
non-array object. Malformed JSON still returns the tool error #1488 added.

Adds eight regression tests. Six of them fail against the current
implementation -- two on the blank-argument path and four on the non-object
path, one carrying the raw TypeError. The two guard tests, malformed JSON and
an ordinary well-formed call, pass both before and after, so the behaviour
Ports the #1676 collision fix to v5 with a reversible path ID and a legacy-ID fallback, so files written by 3.1.1 still open and get overwritten in place (also while their content is still processing). Keeps new_str required for str_replace and moves the PR tests onto the v5 mocks.
@mintlify

mintlify Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
supermemory 🟢 Ready View Preview Oct 12, 2026, 9:05 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add the label Main to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@MaheshtheDev MaheshtheDev changed the title fix(tools): isolate OpenAI middleware clients fix(tools): community fixes for 3.1.2 Oct 12, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app 92508cc Commit Preview URL

Branch Preview URL
Oct 12 2026, 11:02 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp 92508cc Oct 12 2026, 11:02 PM

@MaheshtheDev
MaheshtheDev marked this pull request as ready for review October 12, 2026 21:07
@polylane

polylane Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Expected to resolve the linked issue.

Linked issue: TOOLS-3 — community fixes shipped as @supermemory/tools 3.1.2 (rename via old_path, zero-argument OpenAI tool calls, insert_line semantics)

Neither apps/mcp nor apps/web depends on @supermemory/tools — only the private dev playground and docs-test do, so no deployed resource runs this code. supermemory-mcp served 29k–78k req/h with 0 errors across 128 hourly buckets.

View the full analysis →

Also considered · 6 refuted
  • Refuted · 3.1.2 claude-memory IDs orphan files that 3.1.1 wrote · The resulting tree keeps a working legacy read and in-place write path, so 3.1.2 does not orphan earlier files.
  • Refuted · New blank-argument gate rejects tool calls that used to succeed · Every schema carries a required array and every required field is a string, so the filter cannot throw and cannot refuse a schema-compliant call.
  • Refuted · Insert-line rewrite silently changes stored file content for existing callers · The change is a producer-side correction of the semantics the calling model already uses, not a silent transform of live data.
  • Refuted · withSupermemory clone breaks consumers that relied on the mutated client · The previous behaviour mutated a shared base client, which is the defect the change removes, and the clone answers every call through the same prototype, so instanceof and the resource methods survive.
  • Refuted · Merge triggers an npm publish that reaches production consumers · The deploy that follows the merge is an npm release.
  • Refuted · Object.hasOwn on an es2020 build target breaks older consumer runtimes · The API is present on every runtime this package's CI and workspace use, and it is a runtime function rather than syntax, so the es2020 target is not evidence of a missing dependency.

supermemory-mcp · requests per hour

Analysed against 2 Cloudflare Workers and 1 repository

View in Polylane Disable reviews

Polylane analysed 92508cc for production impact. You can ask follow-ups by mentioning @polylane in a comment.

Did this help? React 👍 or 👎 so the next review is sharper.

Previous verdicts (2)
Head Verdict Analysis
8fdb2d4 Expected to resolve the linked issue analysis
8d12b4b Expected to resolve the linked issue analysis

- New claude-memory IDs use a cm_ prefix so they can never match a legacy ID, and a write refuses an ID held by another document.
- rename overwrites an existing destination (including a legacy ID) instead of leaving a stale copy.
- Non-404 lookup failures return an error instead of allowing a write; delete works while content is still processing.
- OpenAI executor rejects blank or missing required arguments, and documentDelete requires a documentId.
- MemoryCommand.path is required again for every command except rename.
…utor

Names like constructor, toString and __proto__ resolved Object.prototype members as schemas and threw on parameters.required, failing the whole tool batch. The schema lookup now uses Object.hasOwn, so they return the usual unknown-function error.

@capy-ai capy-ai 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.

Independently verified exact commit 92508cc. The own-property schema guard restores structured errors for constructor, toString, proto, hasOwnProperty, valueOf and ordinary unknown names on fresh source and packed consumers, without fetches or whole-batch rejection; mixed registered/unknown calls retain per-call attribution. Frozen build/pack, 153 scoped tests, scoped lint and strict public types pass; focused packed contracts also pass on Node 20. Prior migration, required-input, facade and SDK/image evidence is reused only for verified unchanged code. No remaining independently confirmed blocker in this scoped review. Approval does not authorize merge or publication.

@MaheshtheDev
MaheshtheDev merged commit 570bc1b into main Oct 12, 2026
11 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.

7 participants