Skip to content

feat(content): add reindex endpoint for re-embedding after manual edits#631

Merged
zhoujh01 merged 4 commits intovolcengine:mainfrom
deepakdevp:feature/content-reindex-endpoint
Mar 16, 2026
Merged

feat(content): add reindex endpoint for re-embedding after manual edits#631
zhoujh01 merged 4 commits intovolcengine:mainfrom
deepakdevp:feature/content-reindex-endpoint

Conversation

@deepakdevp
Copy link
Contributor

Summary

  • Adds POST /api/v1/content/reindex endpoint that re-embeds existing .abstract.md/.overview.md content into the vector database after manual edits
  • Supports optional regenerate=true mode that regenerates L0/L1 summaries via LLM before re-embedding
  • Includes request validation (URI existence check, schema validation) and tests

Addresses #468

Changes Made

  • openviking/server/routers/content.py: Added ReindexRequest model and POST /reindex endpoint. Uses existing ResourceService.build_index() for re-embed and ResourceService.summarize() for regenerate mode.
  • tests/server/test_api_content.py: Added 3 tests — request validation (missing uri → 422), endpoint registration (GET → 405), and schema validation.

API

# Re-embed existing content (after manual edit to .overview.md)
curl -X POST http://localhost:1933/api/v1/content/reindex \
  -H "Content-Type: application/json" \
  -d '{"uri": "viking://resources/my_project/doc_dir"}'

# Regenerate L0/L1 via LLM + re-embed
curl -X POST http://localhost:1933/api/v1/content/reindex \
  -H "Content-Type: application/json" \
  -d '{"uri": "viking://resources/my_project/doc_dir", "regenerate": true}'

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • Tests added
  • Unit tests pass locally (pytest tests/server/test_api_content.py — 6/6 pass)
  • Tested on macOS

Checklist

  • My code follows the code style of this project (ruff check + format pass)
  • I have performed a self-review of my own code
  • 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

🤖 Generated with Claude Code

deepakdevp and others added 3 commits March 15, 2026 19:34
Adds POST /api/v1/content/reindex that re-embeds existing .abstract.md/.overview.md
content via ResourceService.build_index(), or optionally regenerates L0/L1 via LLM
using ResourceService.summarize(). Addresses volcengine#468.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests cover: request validation (missing uri → 422), endpoint registration
(GET → 405), and schema validation. Integration tests requiring embedding
API credentials are deferred to CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MaojiaSheng
Copy link
Collaborator

reindex should be a transaction and it needs more management

@deepakdevp
Copy link
Contributor Author

Thanks for the feedback @MaojiaSheng! I'll look into wrapping the reindex operation with TransactionManager and adding progress tracking via TaskTracker. Will push an update.

…ndex

- Wrap reindex in TransactionManager for path locking (prevents concurrent
  reindexes on the same URI)
- Add wait=False mode for background execution with TaskTracker
  (poll via GET /api/v1/tasks/{task_id})
- Add conflict detection (CONFLICT error if reindex already in progress)
- Follow session commit pattern from sessions.py

Addresses review feedback from @MaojiaSheng on volcengine#631.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@CLAassistant
Copy link

CLAassistant commented Mar 16, 2026

CLA assistant check
All committers have signed the CLA.

@MaojiaSheng MaojiaSheng marked this pull request as ready for review March 16, 2026 12:44
@MaojiaSheng
Copy link
Collaborator

@deepakdevp That's cool !!

@zhoujh01 zhoujh01 merged commit d8ff452 into volcengine:main Mar 16, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Mar 16, 2026
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.

4 participants