Skip to content

build_context returns digest-less observation permalinks that diverge from the search index #929

Description

@phernandez

Found during review of the #909 fix.

`src/basic_memory/services/context_service.py:249` builds observation permalinks inline:

```python
generate_permalink(f"{primary_item.permalink}/observations/{obs.category}/{obs.content}")
```

with no 200-char truncation and (after #909 lands) no content digest, so `build_context` returns permalinks that don't match the search index for observations longer than 200 chars. The divergence pre-dates #909 (truncation was added in #446 without updating this call site).

Fix: `obs` is an `Observation` model here — use `obs.permalink` instead of rebuilding the string inline, so there is exactly one place that defines the synthetic observation permalink format.

Also (release-notes task, same area): existing `search_index` rows for >200-char observations keep their old digest-less permalinks until the entity is re-synced or `bm reindex --search` runs. The release notes for the version shipping #909 should mention the reindex.

Refs #909

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions