Skip to content

Pre release - #1

Merged
phernandez merged 39 commits into
mainfrom
pre-release
Feb 4, 2025
Merged

phernandez merged 39 commits into
mainfrom
pre-release

Conversation

@phernandez

Copy link
Copy Markdown
Member

No description provided.

phernandez added 30 commits January 21, 2025 16:24
Replace frontmatter properties with top-level attributes for `created` and `modified` to simplify handling and ensure consistent attribute usage. Added a utility function for schema-to-markdown conversion and updated related tests and code to reflect these changes.
phernandez added a commit that referenced this pull request May 29, 2026
Resolves the 8 self-review findings on PR #865:

session-start.sh:
- Wire recallTimeframe into a new "Recent sessions" query (--after_date) — it was
  parsed but unused after the Phase 4 rewrite. The brief now surfaces recent
  session checkpoints (the resume cursor), which is the one query the recency
  window legitimately applies to. (#1)
- Guard secondaryProjects/teamProjects JSON types — a string value was iterated
  character-by-character into bogus per-char queries. (#3)
- A configured-but-unreachable/misnamed primaryProject now emits a one-line
  "couldn't read" signal instead of a silent blank brief. (#7)

pre-compact.sh:
- Filter transcript turns by the `isMeta` and `toolUseResult` flags instead of a
  `text.startswith("<")` heuristic. This stops dropping legitimate user messages
  that start with "<" (#4) and stops capturing tool-result/meta frames as human
  turns (#8) — verified against a real transcript (25 human turns cleanly
  separated from 8 meta + 288 tool-result frames).
- Title now uses second precision so rapid same-minute compactions don't collide
  and silently drop/overwrite a checkpoint; removed the unused stamp/slug. (#2)
- Empty-checkpoint guard now requires at least one real user turn, not just any
  turn, so an assistant-only transcript can't produce a dangling-title note. (#5)

validate_skills.py:
- parse_frontmatter now skips indented lines, capturing only top-level keys, so a
  schema note's nested schema:/settings: children can't overwrite a top-level
  type/entity via last-write-wins. Documented its single-line-only limitation. (#6)

All verified end-to-end; `just package-check-claude-code` and
`package-check-skills` pass; ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
phernandez added a commit that referenced this pull request May 30, 2026
Resolves the 8 self-review findings on PR #865:

session-start.sh:
- Wire recallTimeframe into a new "Recent sessions" query (--after_date) — it was
  parsed but unused after the Phase 4 rewrite. The brief now surfaces recent
  session checkpoints (the resume cursor), which is the one query the recency
  window legitimately applies to. (#1)
- Guard secondaryProjects/teamProjects JSON types — a string value was iterated
  character-by-character into bogus per-char queries. (#3)
- A configured-but-unreachable/misnamed primaryProject now emits a one-line
  "couldn't read" signal instead of a silent blank brief. (#7)

pre-compact.sh:
- Filter transcript turns by the `isMeta` and `toolUseResult` flags instead of a
  `text.startswith("<")` heuristic. This stops dropping legitimate user messages
  that start with "<" (#4) and stops capturing tool-result/meta frames as human
  turns (#8) — verified against a real transcript (25 human turns cleanly
  separated from 8 meta + 288 tool-result frames).
- Title now uses second precision so rapid same-minute compactions don't collide
  and silently drop/overwrite a checkpoint; removed the unused stamp/slug. (#2)
- Empty-checkpoint guard now requires at least one real user turn, not just any
  turn, so an assistant-only transcript can't produce a dangling-title note. (#5)

validate_skills.py:
- parse_frontmatter now skips indented lines, capturing only top-level keys, so a
  schema note's nested schema:/settings: children can't overwrite a top-level
  type/entity via last-write-wins. Documented its single-line-only limitation. (#6)

All verified end-to-end; `just package-check-claude-code` and
`package-check-skills` pass; ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
phernandez added a commit that referenced this pull request May 31, 2026
Resolves the 8 self-review findings on PR #865:

session-start.sh:
- Wire recallTimeframe into a new "Recent sessions" query (--after_date) — it was
  parsed but unused after the Phase 4 rewrite. The brief now surfaces recent
  session checkpoints (the resume cursor), which is the one query the recency
  window legitimately applies to. (#1)
- Guard secondaryProjects/teamProjects JSON types — a string value was iterated
  character-by-character into bogus per-char queries. (#3)
- A configured-but-unreachable/misnamed primaryProject now emits a one-line
  "couldn't read" signal instead of a silent blank brief. (#7)

pre-compact.sh:
- Filter transcript turns by the `isMeta` and `toolUseResult` flags instead of a
  `text.startswith("<")` heuristic. This stops dropping legitimate user messages
  that start with "<" (#4) and stops capturing tool-result/meta frames as human
  turns (#8) — verified against a real transcript (25 human turns cleanly
  separated from 8 meta + 288 tool-result frames).
- Title now uses second precision so rapid same-minute compactions don't collide
  and silently drop/overwrite a checkpoint; removed the unused stamp/slug. (#2)
- Empty-checkpoint guard now requires at least one real user turn, not just any
  turn, so an assistant-only transcript can't produce a dangling-title note. (#5)

validate_skills.py:
- parse_frontmatter now skips indented lines, capturing only top-level keys, so a
  schema note's nested schema:/settings: children can't overwrite a top-level
  type/entity via last-write-wins. Documented its single-line-only limitation. (#6)

All verified end-to-end; `just package-check-claude-code` and
`package-check-skills` pass; ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
phernandez added a commit that referenced this pull request Jun 7, 2026
… path

The self-heal introduced in this PR misclassified cold/transient model load
failures as cache corruption, purged the in-progress download, and left the
model unloadable for the whole session — breaking ~20 unrelated search
integration tests in CI (cold model cache).

Root cause: purge was driven purely by exception-text matching plus a bare
subdir.exists() check, so a normal not-yet-downloaded model (or a transient
'from any source' download error) could trigger a destructive purge.

Fixes:
- Gate the purge on positive filesystem confirmation: the HF snapshot dir
  exists but the model artifact file (model_optimized.onnx) is missing from
  every snapshot. A cold load (no snapshot dir) is never treated as corrupt
  and never purges; the original error re-raises unchanged.
- After a purge+retry that still fails, re-raise the ORIGINAL exception.
- (Codex P2) Resolve the HF cache subdir case-insensitively, mirroring
  FastEmbed, so model='baai/bge-small-en-v1.5' still resolves correctly.
- (claude-review #1) _purge_model_subdirs sets removed=True only when the
  subdir actually disappears after rmtree (Windows locked-file no-op safety).
- (claude-review #2) Tighten the search error formatter ONNX marker from the
  broad 'load model' to the exact 'load model from' phrasing.
- (minor) Document that TextEmbedding._list_supported_models() is an
  intentional undocumented-API use with a defensive fallback.

Verified locally with the real model: a cold load downloads cleanly with no
purge; a genuinely corrupt cache (snapshot present, artifact deleted) is
detected, purged, and re-downloaded. Added regression tests for cold load,
artifact-present non-purge, case-insensitive resolution, and locked-file
rmtree no-op.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
phernandez added a commit that referenced this pull request Jun 8, 2026
…ests)

From the Codex and claude-review automated reviews on PR #917:

- project_diff: fail fast on fatal `rclone check` errors. A non-zero exit with
  no combined listing (auth/network/missing-remote) previously produced an empty
  plan, so the transfer ran as a no-op and reported success. Now raises
  RcloneError with rclone's stderr. (Codex P2 / claude-review #2)
- sync-setup "Next steps": stop pointing every user at the now-Personal-only
  `bm cloud sync`; lead with the Team-safe `pull`/`push` and note bisync is
  Personal-only. (claude-review #1)
- Cosmetic: capitalize the push/pull abort headlines for consistency; document
  the two ConflictStrategy definitions (Typer enum vs engine Literal). (nits)
- Tests: cover keep-local+pull and keep-cloud+push (preserve-destination cases),
  project_transfer aborting on a mid-loop conflict-copy failure, and project_diff
  raising on a fatal check error vs not raising on a normal differences exit.

Signed-off-by: phernandez <paul@basicmachines.co>
DonaldoDes added a commit to DonaldoDes/basic-memory that referenced this pull request Jun 23, 2026
…S-1)

Body relations (part_of/member_of/attendee/…) live in the note body, not
the frontmatter, so a filter like `part_of.contains(this.file)` rendered 0:
the provider only exposed frontmatter fields plus a flat `file.outlinks`,
never the relations as named per-type keys.

ADR-006 §Gap basicmachines-co#1 (Option A):
- knowledge_router.list_entities_for_dataview now groups outgoing_relations
  by relation_type and exposes each type as a list-of-links key (identities
  consistent with _HostRef: target permalink + to_name/title). file.outlinks
  (union) is unchanged — the per-type keys are additive.
- formula_eval._member_contains is now identity-aware membership on a
  list-of-links receiver (NC-1), substring on a string (non-regression).
- Collision frontmatter↔relation: body relation canonical, union of
  non-redundant frontmatter links (NC-2).
- Cardinality bounded (_MAX_RELATION_LINKS_PER_TYPE = 500, provisional NC-4).
- No frontmatter promotion at sync; read-time exposure only (vault unmuted).

Proven on the real MCP render path (process_note → executor via a provider
mirror), not a synthetic dataset (ADR-006 verification strategy). No new
eval/exec/getattr/__import__; relations read from the resolved dataset only.

Confined to bases/ + knowledge_router.py; zero core upstream change.
Bases suite 525 → 542 green (6 body-relations + 11 adversarial).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
groksrc added a commit that referenced this pull request Nov 29, 2026
…be (#2169)

## Summary
Fixes the intermittent Windows failure of
`tests/mcp/test_hook_brief_search.py::test_session_start_never_imports_the_mcp_tool_stack`,
which keeps `main` CI red on the Windows SQLite unit shards. The test
was added for GitHub #2101.

**Cause:** a cold first brief search on a loaded Windows runner takes
13–14 s. That is longer than the hook's 10 s budget
(`QUERY_TIMEOUT_SECONDS`). The probe ran the search through `_query`,
which applies that budget and reads any failure as `None`. So the
timeout surfaced only as "the search did not run". The search itself
does not raise.

## Evidence (Windows CI run)
A temporary diagnostic commit (`48238a1e`, reverted in this PR) timed
the search in fresh processes with fresh homes on the `windows-latest`
Python 3.12 job. It ran each case idle, then while `pytest tests/mcp
tests/services -n auto` ran alongside, to match the xdist load of the
unit shards. Job log:
https://github.com/basicmachines-co/basic-memory/actions/runs/46220757232/job/141214705707

```
[idle #1] wall=6.43s rc=0 mode=query import_hook=0.49s search=5.22s outcome=ok
[idle #1] wall=6.55s rc=0 mode=direct import_hook=0.47s search=5.35s outcome=ok
[under xdist load #1] wall=14.51s rc=0 mode=query import_hook=0.47s search=13.31s outcome=returned None
[under xdist load #2] wall=13.97s rc=0 mode=query import_hook=0.55s search=12.84s outcome=returned None
[under xdist load #3] wall=14.38s rc=0 mode=query import_hook=0.48s search=13.18s outcome=returned None
[under xdist load #4] wall=14.74s rc=0 mode=query import_hook=0.57s search=13.59s outcome=returned None
[under xdist load #1] wall=14.74s rc=0 mode=direct import_hook=0.48s search=13.29s outcome=ok
[under xdist load #2] wall=15.23s rc=0 mode=direct import_hook=0.54s search=13.79s outcome=ok
[under xdist load #3] wall=14.67s rc=0 mode=direct import_hook=0.48s search=13.09s outcome=ok
```
- `mode=query` goes through `_query`; `mode=direct` calls
`_search_notes`.
- Idle, all six runs succeeded in about 5.2 s.
- Under load, every `_query` run returned `None`. Every direct run
succeeded, in 6.6–13.8 s.
- No run raised an exception.

## Change
- The probe now calls `hook._search_notes` directly, with no product
timeout. It reports the search's time in stderr and lets any exception
show its traceback. A 300 s subprocess timeout guards against a hang.
- It still asserts that the search returned a result, and that
`basic_memory.mcp.tools`, `basic_memory.mcp.server` and `fastmcp.server`
are not loaded afterwards.
- `.github/workflows/test.yml`: the PR-time `test-windows-platform` job
now runs this test file.
- No product code changes. `QUERY_TIMEOUT_SECONDS` and `_query`'s
best-effort behaviour stay as they are.

## Checks run
- `uv run pytest tests/mcp/test_hook_brief_search.py` on macOS: 3
passed.
- The test still fails when the import boundary breaks. I temporarily
added `import basic_memory.mcp.tools` to `_search_notes`, and the test
failed with `AssertionError: ['basic_memory.mcp.tools',
'basic_memory.mcp.server', 'fastmcp.server']`. Reverted.
- The test still fails when the search doesn't run. I temporarily made
`_search_notes` raise before searching, and the test failed and showed
the `RuntimeError` traceback. Reverted. A `None` or non-dict result also
fails its `isinstance` assertion.
- "Windows path and checksum regressions (Python 3.12)" passed on the
diagnostic push, with this file included (122 passed).

## Not verified yet
The full Windows unit shards run only on `main`. Whether this test
passes in 3 consecutive `main` runs can be checked only after the merge.

Product note: an idle Windows runner needs about 5 s for a cold first
search, which fits the 10 s budget. A heavily loaded Windows machine
could get an empty brief on its first SessionStart. That is the intended
best-effort behaviour, so it is not changed here.

Ticket: BMEM-173.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Drew Cain <groksrc@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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