Skip to content

fix(pages): make pages discoverable to agents — org-wide CLI list, search, recall guidance - #7590

Open
AviPeltz wants to merge 1 commit into
mainfrom
investigate-pages-memory
Open

AviPeltz wants to merge 1 commit into
mainfrom
investigate-pages-memory

Conversation

@AviPeltz

@AviPeltz AviPeltz commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

A user published Superset Pages expecting a later agent session to read them back, and the agent could not find them.

Root causes (discovery path only; publish and permissions were fine)

  1. CLI pages list was silently workspace-scoped. packages/cli/src/commands/pages/list/command.ts defaulted --workspace to $SUPERSET_WORKSPACE_ID, which every Superset terminal sets (apps/desktop/src/main/lib/terminal/env.ts:485, packages/host-service/src/terminal/env.ts:265). Inside a workspace the agent only ever saw pages published from that workspace. The desktop Pages tab (PagesView.tsx:54, page.list.useQuery({})), the MCP pages_list tool, and the page skill all treat "no workspace" as the whole org, and the skill literally said # or omit --workspace for the whole org. So the user saw the page in the Pages tab and the agent's list came back without it.
  2. Slugs cannot be guessed. mintPageSlug appends a random 6-char suffix (packages/shared/src/page-slug.ts), so pages get <title-slug> returns "Page not found" for a page that exists. No tool description or skill text said to list first.
  3. No search on page.list. Recall meant scanning the whole org list.

Not a cause, but checked: visibility defaults to org at the app layer (publish.ts:551, page.ts:173; the DB-level just_me default in schema.ts:1385 is only reachable by rows created before #6932). The list's visibility filter includes the caller's own just_me pages, so a same-user agent always sees its user's private pages. Org scoping is correct: MCP API keys and host-service terminals are pinned to one org, so a multi-org user whose page lives in another org gets a FORBIDDEN "belongs to X" on get, and a list that simply lacks it.

Fix

  • CLI pages list: whole org by default, --workspace only when passed; new --search/-s; UPDATED column. Test added.
  • tRPC page.list: optional search, case-insensitive contains over title/description/slug, LIKE metacharacters escaped (search.ts + test).
  • MCP pages_list: search param, description says it is the only way to discover a page and to omit workspaceId when looking one up. pages_get/pages_pull/pages_versions now say slugs cannot be guessed and point at pages_list.
  • Skill superset:page: "Find a page and read it back" section replaces the incorrect comment; troubleshooting row for the guessed-slug symptom.
  • Docs: "Find a Page Later" section in pages.mdx; pages_list row in mcp-server.mdx.

Verification

  • bun test over packages/trpc/src/router/page, packages/mcp, packages/cli/src/commands/pages: 88 pass.
  • tsc --noEmit clean in packages/trpc, packages/mcp, packages/cli.
  • bun run check:plugins passes (the superset plugin is bundled, not marketplace-published, so no version bump applies).
  • Biome clean on changed files.

Follow-ups not in this PR

  • The Slack agent allows pages_list but its system prompt says nothing about pages; the improved tool description is what it will see.
  • page.list still returns every row with signed view/thumbnail tickets and no limit; fine for current org sizes, worth a limit when the list grows.

Summary by cubic

Fixes agent recall of published pages by making pages list discover all pages the agent can read and by guiding agents to list before fetching. Previously the CLI silently scoped to $SUPERSET_WORKSPACE_ID, so pages published from another workspace, machine, or session were invisible to agents while visible to the user. Now the command is org-wide by default, supports --search, and only scopes to a workspace when --workspace is passed. Search (case-insensitive, escaped LIKE) was added to page.list and the MCP pages_list tool, and MCP, skill, and docs guidance now instructs agents to find pages by name via list because slugs end in a random suffix and can't be guessed.

Migration

  • Scripts that relied on the old default workspace scoping must pass --workspace explicitly.

Written for commit c9a4847. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added page search across titles, descriptions, and slugs using the CLI and MCP tools.
    • Added optional workspace filtering and organization-wide page listing.
    • CLI results now show when pages were last updated.
  • Documentation

    • Clarified how to find pages by name, retrieve their IDs or slugs, and use pages across workspaces and sessions.
    • Documented that slugs include random suffixes and should not be guessed.

…arch, and recall guidance

A user published pages as a durable memory store and a later agent session
could not find them. Three causes, all on the discovery path:

1. `superset pages list` silently defaulted `--workspace` to
   `$SUPERSET_WORKSPACE_ID`, which every Superset terminal sets. Inside a
   workspace the command only ever listed pages published from that one
   workspace, while the desktop Pages tab, the MCP `pages_list` tool, and the
   page skill all treat "no workspace" as the whole organization. The skill
   even documented `# or omit --workspace for the whole org`, which the CLI
   did not do. A page published from any other workspace, machine, or
   session was invisible to the agent and visible to the user.

2. Slugs are minted as `<title-slug>-<6 random chars>`, so an agent that
   tries `pages get <title-slug>` gets "Page not found" for a page that
   exists. Nothing told agents to list first, and there was no way to filter
   the list by title.

3. `page.list` had no search, so recall meant scanning the entire org list
   and hoping the client did not truncate it.

Fix:
- CLI `pages list` lists the whole org unless `--workspace` is passed
  explicitly; adds `--search` and an UPDATED column.
- `page.list` accepts an optional `search` (case-insensitive contains over
  title, description, slug; LIKE metacharacters escaped).
- MCP `pages_list` exposes `search`; `pages_get`/`pages_pull`/`pages_versions`
  say slugs cannot be guessed and point at `pages_list`.
- Page skill gains a "Find a page and read it back" section and a
  troubleshooting row for the guessed-slug failure; docs get a
  "Find a Page Later" section.
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 36d7b50b-278e-49f1-8ec3-a892037d1761

📥 Commits

Reviewing files that changed from the base of the PR and between d3eeb33 and c9a4847.

📒 Files selected for processing (13)
  • apps/docs/content/docs/mcp-server.mdx
  • apps/docs/content/docs/pages.mdx
  • packages/cli/src/commands/pages/list/command.test.ts
  • packages/cli/src/commands/pages/list/command.ts
  • packages/mcp/src/tools/pages/get.ts
  • packages/mcp/src/tools/pages/list.ts
  • packages/mcp/src/tools/pages/pull.ts
  • packages/mcp/src/tools/pages/versions.ts
  • packages/trpc/src/router/page/page.ts
  • packages/trpc/src/router/page/schema.ts
  • packages/trpc/src/router/page/search.test.ts
  • packages/trpc/src/router/page/search.ts
  • plugins/superset/skills/page/SKILL.md

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds page search across the page API, CLI, and MCP tools. It removes the CLI workspace environment fallback, displays page update times, and documents listing pages before using IDs or slugs.

Changes

Page Discovery

Layer / File(s) Summary
Page search contract and query
packages/trpc/src/router/page/schema.ts, packages/trpc/src/router/page/search.ts, packages/trpc/src/router/page/page.ts, packages/trpc/src/router/page/search.test.ts
The page list schema accepts a trimmed 1–200 character search term. Queries match title, description, or slug with escaped partial-match patterns in both workspace and organization scopes.
CLI page listing
packages/cli/src/commands/pages/list/command.ts, packages/cli/src/commands/pages/list/command.test.ts
pages list adds --search/-s, uses only explicit workspace selection, displays updatedAt, and tests query payloads.
MCP page discovery guidance
packages/mcp/src/tools/pages/list.ts, packages/mcp/src/tools/pages/get.ts, packages/mcp/src/tools/pages/pull.ts, packages/mcp/src/tools/pages/versions.ts
pages_list passes optional search and workspace filters. Page tools explain that slugs must come from pages_list or a user-provided URL.
Page discovery documentation
apps/docs/content/docs/mcp-server.mdx, apps/docs/content/docs/pages.mdx, plugins/superset/skills/page/SKILL.md
Documentation describes organization-wide search, optional workspace filtering, random slug suffixes, and using returned IDs or slugs to read pages.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant PageListAPI
  participant PageSearchFilter
  participant Database
  Caller->>PageListAPI: Submit optional search and workspaceId
  PageListAPI->>PageSearchFilter: Build search condition
  PageSearchFilter->>PageListAPI: Return field filters
  PageListAPI->>Database: Query matching pages
  Database-->>Caller: Return page list
Loading

Suggested reviewers: saddlepaddle

Merge Risk: ⚪ Minimal · up to c9a48

The page discovery changes align across API, CLI, MCP, and documentation, with no actionable merge-blocking issue identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 10 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses conventional commit format and clearly summarizes the main change: improving page discovery for agents through organization-wide listing, search, and recall guidance.
Description check ✅ Passed The description explains the problem, root causes, implementation changes, testing, and follow-ups. It does not use the template headings or include the checklist, but it provides the required informa…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 10 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch investigate-pages-memory

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@expo

expo Bot commented Sep 16, 2026

Copy link
Copy Markdown

No installed development build can load this pull request as an update: its native fingerprint is 59c8ca563d5c and no development build has it. Add the mobile-build label to build one.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) ✅ View Branch
Vercel API (Vercel) ✅ Open Preview
Vercel Web (Vercel) ✅ Open Preview
Vercel Marketing (Vercel) ✅ Open Preview
Vercel Admin (Vercel) ✅ Open Preview
Vercel Docs (Vercel) ✅ Open Preview

Preview updates automatically with new commits

This branch was previously deployed

1 inactive deployment
preview — c9a48475 Deployed Sep 16, 2026 by AviPeltz via Deploy Admin #9943
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