Skip to content

fix(reflect): preserve bank attribution in provider calls#2764

Merged
benfrank241 merged 1 commit into
vectorize-io:mainfrom
Jordan-Jarvis:upstream/fix-reflect-bank-context-standalone-20260717
Jul 17, 2026
Merged

fix(reflect): preserve bank attribution in provider calls#2764
benfrank241 merged 1 commit into
vectorize-io:mainfrom
Jordan-Jarvis:upstream/fix-reflect-bank-context-standalone-20260717

Conversation

@Jordan-Jarvis

Copy link
Copy Markdown
Contributor

Summary

  • bind MemoryEngine.reflect_async to the existing per-bank provider-attribution context
  • preserve the bank for Reflect tool calls and final synthesis
  • verify the bank is bound during Reflect and reset after failure
  • replace two lower-value direct ContextVar implementation tests with one integrated Reflect regression

Without this binding, retain and recall attribute provider usage correctly but Reflect is the only bank-scoped engine operation that loses the bank before its LLM/tool loop.

Validation

  • uv run pytest tests/test_bank_attribution.py -q — 15 passed
  • uv run ruff check hindsight_api/engine/memory_engine.py tests/test_bank_attribution.py
  • uv run ruff format --check hindsight_api/engine/memory_engine.py tests/test_bank_attribution.py
  • patch applies cleanly to current upstream main (9676fc1699c199175809285ea0e1095ab71115d0)

Bind Reflect to the existing per-bank ContextVar so its tool loop and final synthesis preserve provider cost attribution. Replace two direct ContextVar implementation tests with one integrated Reflect binding/reset regression.
@Jordan-Jarvis

Copy link
Copy Markdown
Contributor Author

Additional integration evidence from the corresponding Will qualification branch:

  • the same bank-binding correction merged in Will-Augmented-Thought/hindsight as d693efd0f644ce75c5be93f26e73e19d318d9cc7;
  • exact-main image run 29551436887 published, scanned, signed, and verified both API and control-plane artifacts;
  • GitOps promotion 29554113973 passed dev retain, recall, and canonical per-bank provider attribution through native Reflect. The later failure was the independent noncanonical OpenAI tool-result message shape addressed by fix(reflect): emit canonical OpenAI tool result messages #2766, not bank attribution.

This validates that binding reflect_async through the existing bank ContextVar boundary preserves one bank-owned routing contract without adding provider-specific inference downstream.

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.

2 participants