Skip to content

fix(mcp): offer first-note onboarding in recent only for empty projects - #1994

Merged
groksrc merged 3 commits into
mainfrom
shipright/BMEM-70
Oct 30, 2026
Merged

groksrc merged 3 commits into
mainfrom
shipright/BMEM-70

Conversation

@groksrc

@groksrc groksrc commented Oct 30, 2026

Copy link
Copy Markdown
Member

Summary

bm_project(command="recent") now offers first-note onboarding only when the project has zero indexed entities. A project with notes but a quiet time window gets just the "widen the window or search" hint. Fixes #1986.

Changes

  • index_readiness.py: add project_index_status (fetches the status). project_index_required takes an optional status so a caller that already has it makes no second request.
  • recent_activity.py: on an empty result, fetch status once, derive project_has_notes from readiness.indexed_entities, and pass it to _format_project_output, which gates the onboarding text and bm_write example on it. The code comment is updated.

Tests

  • Formatter unit tests for both cases (tests/mcp/test_tool_bm_project_recent.py).
  • Integration test: a note backdated out of the window gets no onboarding but keeps the since="30d" and bm_search( hints, routed by external id.
  • A test that the empty path makes exactly one get_status call.
  • Existing test_recent_activity_empty_project_offers_first_note passes unchanged. The two touched test files plus tests/test_remedy_emission_sites.py pass (45 tests).

Notes

  • indexed_entities counts all entity rows, so an attachments-only project gets the hint, not onboarding. Acceptable: that user is not new.
  • Locally, just fast-check fails only in typecheck on unresolved pymilvus imports (optional dependency not installed here), in files this PR does not touch.

🤖 Generated with Claude Code

…h no notes

bm_project(command="recent") printed the first-note offer on every empty,
unfiltered first page, so a model told an established user with a quiet
window to save their "first note" (#1986).

The empty path already fetches the project status for the never-indexed
check. Reuse that single response: readiness.indexed_entities > 0 now
selects the widen-or-search hint alone; zero keeps the onboarding text.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T04:42:55.932088Z ad8c81a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

Copy link
Copy Markdown

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

ℹ️ 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 on lines +73 to +76
old = "2020-01-01T00:00:00+00:00"
async with session_maker() as session:
await session.execute(
text("UPDATE entity SET created_at = :old, updated_at = :old"), {"old": old}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bind datetime values when backdating PostgreSQL timestamps

When this test runs against the PostgreSQL backend, old is a string bound directly to timestamp columns through an untyped text() statement. PostgreSQL infers a timestamp parameter, and asyncpg requires a Python datetime rather than an ISO string, so the update raises a bind-parameter error before the onboarding assertions run. This breaks the PostgreSQL unit-test job in .github/workflows/test.yml. Use appropriately typed datetime bindings for PostgreSQL while preserving SQLite-compatible timestamp storage in both updates. The repository explicitly requires coverage on both backends.

AGENTS.md reference: AGENTS.md:L300-L303

Useful? React with 👍 / 👎.

groksrc and others added 2 commits October 29, 2026 23:59
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Drew Cain <groksrc@gmail.com>
I, Drew Cain <groksrc@gmail.com>, hereby add my Signed-off-by to this commit: ad8c81a

Signed-off-by: Drew Cain <groksrc@gmail.com>

@groksrc groksrc left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No blocking findings.

This change fixes issue #1986 without expanding the affected behavior. recent_activity_page fetches project status once on an empty result, reuses that response for index-readiness guidance, and passes indexed_entities > 0 into the formatter. _format_project_output uses the value only for the empty, unfiltered first page. Populated pages, filtered results, later pages, JSON output, and never-indexed guidance keep their existing behavior.

Security and failure behavior are unchanged. The code uses the existing project-scoped status endpoint, adds no permissions or data access, and still propagates status failures.

Verified at PR head 04faeb1f:

  • uv run pytest tests/mcp/test_first_connect_onboarding.py tests/mcp/test_tool_bm_project_recent.py tests/test_remedy_emission_sites.py -q — 45 passed.
  • Ruff reports no findings on all four changed files, and ruff format --check reports them formatted.
  • GitHub CI passes across SQLite, PostgreSQL, semantic, Milvus, Windows, static, CodeQL, DCO, and CLA checks.

Next step: a maintainer can merge this PR after the repository's normal review policy is satisfied.

@groksrc groksrc added the review:done Automated review found no blocking issues label Oct 30, 2026
@groksrc
groksrc merged commit 8574e45 into main Oct 30, 2026
44 checks passed
@groksrc
groksrc deleted the shipright/BMEM-70 branch October 30, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:done Automated review found no blocking issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

recent activity shows first-note onboarding for projects that already have notes

1 participant