Skip to content

fix(session): replace blocking commit() with commit_async() in bot#728

Merged
qin-ctx merged 2 commits intovolcengine:mainfrom
deepakdevp:fix/commit-blocks-event-loop
Mar 19, 2026
Merged

fix(session): replace blocking commit() with commit_async() in bot#728
qin-ctx merged 2 commits intovolcengine:mainfrom
deepakdevp:fix/commit-blocks-event-loop

Conversation

@deepakdevp
Copy link
Copy Markdown
Contributor

Summary

  • Fixes HTTP endpoint hangs caused by session.commit() blocking the event loop in bot code
  • Replaces session.commit() with await session.commit_async() in ov_server.py
  • Adds a RuntimeWarning to Session.commit() when called from a running event loop to prevent future misuse

Fixes #527

Root Cause

bot/vikingbot/openviking_mount/ov_server.py:426 called session.commit() — a sync method that internally uses run_async(), which blocks the calling thread via t.join(). When the bot runs in the same process as the server (--with-bot), this freezes the shared event loop. All HTTP endpoints become unresponsive (process alive but HTTP dead).

The HTTP server's own session commit endpoint correctly uses commit_async(), but the bot code path used the blocking sync version.

Changes Made

  • bot/vikingbot/openviking_mount/ov_server.py:426: Changed session.commit()await session.commit_async()
  • openviking/session/session.py: Added RuntimeWarning in commit() when called from a running event loop, guiding callers to use commit_async() instead
  • Also fixed: pre-existing lint issues in ov_server.py (import ordering, unused import)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • Unit tests pass locally (11/11 session tests)
  • Tested on macOS

Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • New and existing unit tests pass locally with my changes

ov_server.py called session.commit() (sync, uses run_async() which
blocks via t.join()) from an async context. When the bot runs in the
same process as the server (--with-bot), this freezes the entire event
loop, causing all HTTP endpoints to hang.

Fix: use commit_async() which properly awaits async operations.

Also add a RuntimeWarning to Session.commit() when called from a
running event loop to catch future misuse.

Fixes volcengine#527.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qin-ctx qin-ctx merged commit 87ee875 into volcengine:main Mar 19, 2026
4 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Mar 19, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 19, 2026

CLA assistant check
All committers have signed the CLA.

chethanuk added a commit to chethanuk/OpenViking that referenced this pull request Mar 19, 2026
- Add .pr_agent.toml with 15 repo-specific review rules derived from real
  bug history (PRs volcengine#505, volcengine#728, volcengine#749, volcengine#740/volcengine#745, volcengine#754, volcengine#735, volcengine#767)
- Rules structured as WHEN/THEN/BECAUSE for deterministic enforcement
- Add 8 custom labels (memory-pipeline, async-change, api-breaking, etc.)
- Add ignore patterns for lock files, third_party, build artifacts
- Enable score review, TODO scan, split-PR detection, security audit
- Configure improve tool with quality threshold and extended mode
- Configure describe tool with PR diagrams and semantic file types
- Update workflow: ark-code-latest model, checkout step for .pr_agent.toml,
  move all config from inline YAML to .pr_agent.toml (single source of truth)
qin-ctx pushed a commit that referenced this pull request Mar 19, 2026
…#780)

- Add .pr_agent.toml with 15 repo-specific review rules derived from real
  bug history (PRs #505, #728, #749, #740/#745, #754, #735, #767)
- Rules structured as WHEN/THEN/BECAUSE for deterministic enforcement
- Add 8 custom labels (memory-pipeline, async-change, api-breaking, etc.)
- Add ignore patterns for lock files, third_party, build artifacts
- Enable score review, TODO scan, split-PR detection, security audit
- Configure improve tool with quality threshold and extended mode
- Configure describe tool with PR diagrams and semantic file types
- Update workflow: ark-code-latest model, checkout step for .pr_agent.toml,
  move all config from inline YAML to .pr_agent.toml (single source of truth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bug: process alive but HTTP endpoints hang, causing AbortError in memory_store/auto-capture

4 participants