Skip to content

fix(api): enforce scope-safe viewer and CLI memory access#1036

Merged
kunickiaj merged 1 commit into
mainfrom
05-04-fix_api_enforce_scope-safe_viewer_and_cli_memory_access
May 5, 2026
Merged

fix(api): enforce scope-safe viewer and CLI memory access#1036
kunickiaj merged 1 commit into
mainfrom
05-04-fix_api_enforce_scope-safe_viewer_and_cli_memory_access

Conversation

@kunickiaj
Copy link
Copy Markdown
Owner

@kunickiaj kunickiaj commented May 5, 2026

Description

Threads the central scope-visibility gate through every viewer-server route and CLI command that exposes memory content:

  • Viewer routes (`/api/memory`, `/api/observations`, `/api/summaries`, `/api/sessions`, `/api/projects`, `/api/session`, `/api/artifacts`, `/api/usage`, `/api/memories/*`) gate by visible memory scopes.
  • `/api/usage` is filtered as a memory-exposure surface; aggregates are recomputed from visible rows and memory-id metadata is sanitized.
  • `/api/artifacts` requires every active memory in a session to be visible before returning artifact data.
  • `MemoryStore.stats()` scopes memory-related counters (sessions, memory items, vector rows, tag coverage).
  • CLI `memory forget` and `memory remember` go through scope-filtered store paths; manual remember rolls back (memory + vectors + ops) and only after scope visibility is confirmed.

Implements codemem-ov4g.5.5.

Type of Change

  • 🐛 Bug fix (fixes an issue)

Testing

  • Relevant checks pass locally (`pnpm run tsc`, `pnpm run lint`, `pnpm run test`)
  • Added/updated tests for changes
  • Manually verified changes work as expected

Coverage: viewer route integration tests, CLI memory remember/forget scope safety, stats counters scoped, manual remember stores vectors and rolls back cleanly on unauthorized scope.

Checklist

  • Code follows project style (`pnpm run lint` passes for touched files)
  • Self-review completed
  • Documentation updated (if needed)
  • No new warnings introduced

Copy link
Copy Markdown

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

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: cb2c44b2fe

ℹ️ 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 packages/cli/src/commands/memory.ts Outdated
@kunickiaj kunickiaj force-pushed the 05-04-fix_api_enforce_scope-safe_viewer_and_cli_memory_access branch from cb2c44b to f6b5722 Compare May 5, 2026 14:36
@kunickiaj kunickiaj force-pushed the 05-04-fix_mcp_enforce_scope_safe_memory_tools branch 2 times, most recently from 37559a6 to 88c60eb Compare May 5, 2026 14:46
@kunickiaj kunickiaj force-pushed the 05-04-fix_api_enforce_scope-safe_viewer_and_cli_memory_access branch from f6b5722 to 3cf4486 Compare May 5, 2026 14:46
Copy link
Copy Markdown
Owner Author

kunickiaj commented May 5, 2026

Merge activity

  • May 5, 2:59 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 5, 3:15 PM UTC: Graphite rebased this pull request as part of a merge.
  • May 5, 3:16 PM UTC: @kunickiaj merged this pull request with Graphite.

@kunickiaj kunickiaj changed the base branch from 05-04-fix_mcp_enforce_scope_safe_memory_tools to graphite-base/1036 May 5, 2026 15:11
@kunickiaj kunickiaj changed the base branch from graphite-base/1036 to main May 5, 2026 15:13
@kunickiaj kunickiaj force-pushed the 05-04-fix_api_enforce_scope-safe_viewer_and_cli_memory_access branch from 3cf4486 to 7977a0a Compare May 5, 2026 15:14
@kunickiaj kunickiaj merged commit 91a8cec into main May 5, 2026
8 checks passed
@kunickiaj kunickiaj deleted the 05-04-fix_api_enforce_scope-safe_viewer_and_cli_memory_access branch May 5, 2026 15:16
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