Repository navigation
Fix AsyncResponse.log_to_db - #1668
Merged
Merged
Conversation
roli-lpci
force-pushed
the
fix/async-response-log-to-db
branch
from
September 6, 2026 06:07
a0207a0 to
967bf6b
Compare
roli-lpci
marked this pull request as draft
September 6, 2026 06:08
roli-lpci
marked this pull request as ready for review
September 6, 2026 06:12
anandfresh
approved these changes
Sep 9, 2026
This was referenced Oct 1, 2026
simonw
pushed a commit
that referenced
this pull request
Oct 18, 2026
…#1727 (#1734) _BaseChainResponse.log_to_db() converted each AsyncResponse with asyncio.run(), which raises RuntimeError inside a running event loop, for example straight after await chain.text(). Since #1668 both Response.log_to_db() and AsyncResponse.log_to_db() write synchronously, so the chain now calls each response's own method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
AsyncResponseinherited the synchronouslog_to_db()implementation, which passed its awaitableduration_ms()anddatetime_utc()results to SQLite after completion and raisedsqlite3.ProgrammingError.This preserves the synchronous
log_to_db()call shape after awaiting the response, reuses the existing completed-response conversion used by the CLI, and raises the established await-requiredValueErrorbefore completion.The regression covers persisted response and conversation IDs, structured reasoning parts, and the precompletion guard.
Tests:
pytest tests/test_logs_store.py::TestAsyncLogging tests/test_async_parity.py -q; offline echo persistence; Ruff; Black; MyPy; cog --check docs/logging.md.