Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat(memory): recall and store memory around chat completions #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
feat(memory): recall and store memory around chat completions #190
Changes from all commits
474872dc2969595a08d632c80c54File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenAI allows system
contentas a list of content parts. Whencontentis a list,f"{existing}\n\n{block}"stringifies the Python list repr into the system prompt. Inherited frominject_purpose_hints, but worth fixing here: guard withisinstance(existing, str)and otherwise insert a separate system message (or append a text part).Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In tool-loop streaming this accumulates content deltas across all tool iterations, so the remembered "assistant reply" concatenates intermediate assistant turns, while the non-streaming path stores only the final message's content. Probably tolerable since the platform's fact extraction is LLM-based, but the inconsistency is worth a deliberate decision (or a note here).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asyncio holds only a weak reference to tasks, so this fire-and-forget write can be garbage-collected mid-flight; the done-callback doesn't prevent that. The existing
_report_platform_usagecalls share the pattern, so low priority, but the standard fix is one line: keep tasks in a module-level set andtask.add_done_callback(_TASKS.discard).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaulting to
Truewhen the resolve response omitsmemory_enabledmakes every hybrid chat completion against a pre-memory platform POST/gateway/memory/recalland get a 404: a wasted hot-path round-trip per request. The stated rationale (never silently stop recalling) only protects a platform that has the memory endpoints but omits the flag, and that platform can't exist: otari-ai#1148 ships the endpoints and the resolve field together, and its response schema always includesmemory_enabled. Default toFalseon absence; it removes the per-request call with no downside. (Applies to the doc paragraph indocs/hybrid-mode-protocol.mdtoo.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8s default on the time-to-first-token path is a lot for a best-effort feature: if the platform hangs (rather than failing fast), every request stalls up to 8s until it recovers, with no circuit breaker. The PR body promises memory never "noticeably slows" a chat; a ~2000ms default fits that much better. Operators who need more can raise
PLATFORM_MEMORY_RECALL_TIMEOUT_MS.Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.