Repository navigation
fix(mcp): offer first-note onboarding in recent only for empty projects - #1994
Conversation
…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>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
| 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} |
There was a problem hiding this comment.
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 👍 / 👎.
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
left a comment
There was a problem hiding this comment.
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 --checkreports 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.
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: addproject_index_status(fetches the status).project_index_requiredtakes an optionalstatusso a caller that already has it makes no second request.recent_activity.py: on an empty result, fetch status once, deriveproject_has_notesfromreadiness.indexed_entities, and pass it to_format_project_output, which gates the onboarding text andbm_writeexample on it. The code comment is updated.Tests
tests/mcp/test_tool_bm_project_recent.py).since="30d"andbm_search(hints, routed by external id.get_statuscall.test_recent_activity_empty_project_offers_first_notepasses unchanged. The two touched test files plustests/test_remedy_emission_sites.pypass (45 tests).Notes
indexed_entitiescounts all entity rows, so an attachments-only project gets the hint, not onboarding. Acceptable: that user is not new.just fast-checkfails only in typecheck on unresolvedpymilvusimports (optional dependency not installed here), in files this PR does not touch.🤖 Generated with Claude Code