mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 13:29:19 +08:00
feat/https-compose-caddy
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c4ea31b156 |
fix(memory): resolve partial IDs beyond the first 1000 records (#4389)
## Description
`headroom memory show` tries a full ID first, then searches by prefix.
The fallback only examined the newest 1,000 memories. That could report
an older memory as missing or silently select a newer memory when
another matching ID existed outside that first page.
Use the existing unlimited `MemoryFilter()` query for this fallback.
Exact-ID lookup, literal prefix matching, superseded-memory filtering,
and the existing missing/ambiguous-ID errors stay the same.
## Type of Change
- [x] Bug fix
## Changes Made
- Remove the 1,000-row cap from the partial-ID fallback.
- Add real SQLite CLI regressions for an older unique match and
ambiguity across that boundary.
## Testing
- [x] Focused and affected integration tests pass.
- [x] Lint, format, type, and repository pre-push checks pass.
- [x] Actual CLI behavior verified with a synthetic SQLite database.
- Before the correction, `TestMemoryShow` had 4 passing tests and both
new regressions failed.
- Afterward, all 6 show tests passed.
- All 77 affected CLI, index-sync, query-filter, and SQLite-store tests
passed.
- Whole-project Ruff check and format check passed (1,812 files already
formatted).
- Repository pre-commit checks, including mypy and commitlint, passed.
- The full repository pre-push gate passed under pinned Rust 1.95.0 and
Node 22.20.0: Rust formatting, workspace Clippy/tests, extension
rebuild/import verification, 177 Python tests (4 skipped), and
commitlint. No hooks were bypassed.
- Independent review found no blocking findings.
```text
77 passed, 274 warnings in 2.21s
```
The warnings are existing `datetime.utcnow()` deprecations.
## Real Behavior Proof
- Environment: macOS arm64, Python 3.12.15, Rust 1.95.0, editable
checkout with its native extension built locally. The 77 affected tests
and CLI proof were repeated after the pinned extension rebuild. No
provider/model was used for this proof. All proof data was synthetic,
with offline mode enabled and telemetry disabled.
- Exact command / steps: Create a temporary `SQLiteMemoryStore`, use
`save_batch` to add 1,000 filler memories dated 2022-01-01 and
`target-memory-old` dated 2021-01-01. Run the actual installed CLI
against that database:
```sh
headroom memory show --db-path "$repro_db" target-memory-old --json
headroom memory show --db-path "$repro_db" target- --json
headroom memory show --db-path "$repro_db" absent- --json
```
- Observed result: The unique older prefix resolves, the missing ID is
rejected, and adding a newer match makes the shared prefix ambiguous:
```text
target-memory-old: exit 0, id=target-memory-old
target-: exit 0, id=target-memory-old
absent-: exit 1, Error: Memory not found: absent-
```
Then add `target-memory-new` dated 2023-01-01 and repeat the `target-`
command:
```text
exit 1, Error: Ambiguous ID 'target-'. Matches: ['target-m', 'target-m']
```
On the unchanged baseline, the unique older prefix instead returned
`Memory not found`; after adding the newer match, the same prefix
incorrectly exited 0 and selected `target-memory-new`. Full-ID and
missing-ID controls behaved correctly before and after. The temporary
database and all CLI child processes were cleaned up.
- Not tested: The complete Python suite, external providers or embedding
models, Windows, or Linux. The prefix fallback still materializes the
matching store's full query result; full IDs retain the direct lookup
path.
## Runtime Rollout Safety
- Rollout-managed feature(s): None. This is a local SQLite CLI
correction.
- Minimum rollout channel: Not applicable; no rollout-managed feature or
channel changes.
- Stable/default behavior changed: Yes. Partial-ID lookup searches all
eligible memories and rejects ambiguous prefixes across the former
1,000-row boundary.
- Kill switch / disable path: No new switch. Full IDs retain the direct
lookup path.
- Unsafe override required: No.
- Qualification impact: No schema, configuration, dependency, provider,
or rollout-qualification changes.
- Rollback path: Revert commit
|
||
|
|
fb4117f3a6 |
Add Click-based CLI with memory management commands
Refactor CLI from argparse to Click for better extensibility: - New headroom/cli/ package with modular command structure - Memory commands: list, show, stats, edit, delete, prune, purge, export, import - Rich terminal output with tables, colors, and formatted stats - Duration parsing for --older-than and --since flags (7d, 2w, 1m) - Comprehensive tests using Click's CliRunner (55 tests, no mocks) CLI structure: headroom proxy - Start optimization proxy (migrated from argparse) headroom memory ... - Memory management (new) headroom evals ... - Evaluation commands (migrated, now under evals group) Backwards compatibility maintained via headroom/cli.py shim. |