fleet-memory/hindsight-api-slim/hindsight_api
Chris Bartholomew d38ecdb9ec
fix(billing): mark reflect's internal recall calls as internal (#972)
Reflect's tool functions (tool_search_observations, tool_recall) call
recall_async with the user's original request_context, which has
internal=False. The usage metering extension sees these as user-facing
recall operations and bills them separately — double-charging the
customer for recalls that are already included in the reflect operation
cost.

Fix: wrap request_context with dataclasses.replace(internal=True) before
passing to recall_async. This matches the pattern used by consolidation,
which already creates an internal RequestContext for its sub-operations.

The internal flag causes the metering extension to:
- Record the usage as "internal_recall" (tracked but not billed)
- Skip credit deduction entirely

Observed impact: a single reflect call was generating 2 extra billed
recall entries (one from tool_search_observations, one from tool_recall),
inflating the customer's recall token count by ~26 tokens per reflect.
2026-04-10 14:45:20 -04:00
..
admin fix(migrations): bypass PgBouncer for advisory locks via MIGRATION_DATABASE_URL (#726) 2026-03-27 16:01:38 +01:00
alembic fix(recall): cap entity fanout in graph expansion (#911) 2026-04-07 18:59:50 +02:00
api feat: add HINDSIGHT_API_DEFAULT_BANK_TEMPLATE env var (#966) 2026-04-10 16:41:28 +02:00
engine fix(billing): mark reflect's internal recall calls as internal (#972) 2026-04-10 14:45:20 -04:00
extensions fix(retain): preserve normalized experience fact types (#848) 2026-04-02 12:20:37 +02:00
webhooks feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
worker Fix orphaned batch_retain parents when child fails via unhandled exception (#618) 2026-03-19 14:55:26 +01:00
__init__.py Release v0.5.0 2026-04-08 17:56:47 +02:00
banner.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
config.py feat: add HINDSIGHT_API_DEFAULT_BANK_TEMPLATE env var (#966) 2026-04-10 16:41:28 +02:00
config_resolver.py fix(config): validate entity_labels structure on PATCH (#902) 2026-04-07 11:58:02 +02:00
daemon.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
main.py docs: add supported platforms and Windows installation guide (#700) 2026-03-26 12:01:30 +01:00
mcp_local.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
mcp_tools.py feat: add retain update_mode='append' for document content concatenation (#932) 2026-04-08 14:39:16 +02:00
metrics.py fix: make bank_id metric label opt-in to prevent OTel memory leak (#898) 2026-04-07 09:42:59 +02:00
migrations.py fix(migrations): bypass PgBouncer for advisory locks via MIGRATION_DATABASE_URL (#726) 2026-03-27 16:01:38 +01:00
models.py fix(retain): preserve normalized experience fact types (#848) 2026-04-02 12:20:37 +02:00
pg0.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
server.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
tracing.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
utils.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00