Skip to content

fix(resource): return from on_resource_added once the reason commit is queued - #6077

Merged
fujiajie666 merged 1 commit into
volcengine:mainfrom
OnePerson2020:fix/resource-reason-no-wait
Oct 16, 2026
Merged

fujiajie666 merged 1 commit into
volcengine:mainfrom
OnePerson2020:fix/resource-reason-no-wait

Conversation

@OnePerson2020

Copy link
Copy Markdown
Contributor

Description

on_resource_added committed the reason into the shared session __openviking_resource_reason__ and then waited (up to 30 min) for that commit task. Reason commits are processed in order on that one session, so every add_resource with a reason waited behind all earlier reason commits; one stalled commit blocked resource processing (about 12 h in our deployment). It now returns once the commit is queued, with commit_task_id, like a normal async commit.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

Fixes #6076

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • on_resource_added: no _wait_for_commit_task; the result drops commit_task (its only caller stores the dict in result["memory_linking"]). The deletion path still waits, since there the unlink must follow the memory update.
  • New test test_on_resource_added_returns_once_reason_commit_is_queued (commit task whose wait never finishes).

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows
OPENVIKING_CONFIG_FILE=/dev/null uv run --extra test pytest tests/service/test_resource_memory_link_service.py tests/service/test_resource_service*.py -q --no-cov
uv run --extra dev ruff check openviking/service/resource_memory_link_service.py tests/service/test_resource_memory_link_service.py
git diff --check

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes

No API or data-format change; no new dependency.

🤖 Generated with Claude Code

@ZaynJarvis ZaynJarvis added the kernel Core server, runtime, storage, retrieval, SDK, and CLI. label Oct 15, 2026

@fujiajie666 fujiajie666 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

One small suggestion when you have time: since the reason commit now runs asynchronously, could memory_linking.status use accepted or queued, and could the docs mention polling commit_task_id for the final result? This would make it clear that the returned status confirms submission while memory extraction may still be pending or may later fail.

Also, add-resource --reason calls for the same user currently share one session. Isolating sessions by resource would let commits for different resources proceed independently and improve session.commit throughput.

Both points can be handled in a follow-up PR when convenient. I'll merge this PR shortly. Thanks for the contribution!

@fujiajie666
fujiajie666 dismissed their stale review October 16, 2026 03:39

Withdrawing my previous change request. The remaining suggestions are optional follow-ups and do not block merging this PR.

@fujiajie666 fujiajie666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small suggestions that can be follow up on these later.

@fujiajie666
fujiajie666 merged commit 0230cc1 into volcengine:main Oct 16, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Oct 16, 2026
OnePerson2020 pushed a commit to OnePerson2020/OpenViking that referenced this pull request Oct 16, 2026
…ne#6153, upgrade notes for main 2026-10-16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fujiajie666 pushed a commit that referenced this pull request Oct 16, 2026
Since #6077 on_resource_added returns once the reason commit is queued, but
memory_linking.status still said "success", which reads as a finished link.
It now says "accepted" (the word connector submissions already use), and the
API docs say to poll commit_task_id for the result. Follow-up to the #6077
review.

Co-authored-by: mayunxiang.26 <mayunxiang.26@bytedance.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Core server, runtime, storage, retrieval, SDK, and CLI.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: add_resource with a reason waits up to 30 min for the shared reason-session commit

3 participants