Skip to content

fix(mcp): require confirmation before forgetting similar memories#1345

Open
DisturbedCrow wants to merge 3 commits into
supermemoryai:mainfrom
DisturbedCrow:fix/mcp-safe-forget
Open

fix(mcp): require confirmation before forgetting similar memories#1345
DisturbedCrow wants to merge 3 commits into
supermemoryai:mainfrom
DisturbedCrow:fix/mcp-safe-forget

Conversation

@DisturbedCrow

@DisturbedCrow DisturbedCrow commented Jul 23, 2026

Copy link
Copy Markdown

Stops forget from immediately deleting a semantic near-match. It now previews the candidate and requires a short-lived signed confirmation.

Focused tests and the Worker dry-run build pass.

Comment thread apps/mcp/src/client.ts Outdated
Comment on lines +255 to +257
const confirmation = JSON.parse(
textDecoder.decode(this.fromBase64Url(payload)),
) as Record<string, unknown>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The rule 'Avoid unnecessary type assertions' and 'Use type annotations instead of assertions for object literals' is violated here. The code uses as Record<string, unknown> to cast the result of JSON.parse(...). While JSON.parse returns any, the preferred approach is to use a type annotation on the variable rather than a type assertion:

const confirmation: Record<string, unknown> = JSON.parse(
  textDecoder.decode(this.fromBase64Url(payload)),
)
Suggested change
const confirmation = JSON.parse(
textDecoder.decode(this.fromBase64Url(payload)),
) as Record<string, unknown>
const confirmation: Record<string, unknown> = JSON.parse(
textDecoder.decode(this.fromBase64Url(payload)),
)

Spotted by Graphite (based on custom rule: TypeScript style guide (Google))

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment thread apps/mcp/e2e/memory.test.ts Outdated
Comment on lines +147 to +148
documentId = ((await created.json()) as { documentId?: string })
.documentId

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The rule 'Use type annotations instead of assertions for object literals' is violated. The code uses as { documentId?: string } as a type assertion on the result of created.json(). Instead, a type annotation should be used:

const body: { documentId?: string } = await created.json()
documentId = body.documentId
Suggested change
documentId = ((await created.json()) as { documentId?: string })
.documentId
const body: { documentId?: string } = await created.json()
documentId = body.documentId

Spotted by Graphite (based on custom rule: TypeScript style guide (Google))

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

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.

1 participant