[Feature]: Unify Resource/Skill semantic execution behind shared plans
Issue Origin
Inferred by an AI agent and not observed or reproduced
This is an AI-assisted refactoring proposal based on contributor-supplied analysis of ce2280a762c8280ce41b0be3f512f7ee4b7f6d80. That commit is the proposal's analysis baseline, not a claim about the latest main. No production observation or reproduction is claimed. The proposal has not been implemented, and the planned validation has not been run. Compatibility statements below describe intended constraints, not verified results.
Problem Statement
According to the supplied baseline analysis, Resource/Skill generation, reuse, aggregation, and indexing decisions are distributed across message producers, processors, executors, and refresh helpers. The maintenance concern is duplicated ownership of those decisions.
The goal is to prepare explicit actions at one shared planning boundary and let execution consume them. Existing entrypoint-specific processing scope, input-reading stages, completion boundaries, and failure consequences are intended to remain unchanged.
This issue requests discussion before implementation because the proposal crosses storage, queue processing, Resource/Skill entrypoints, and asynchronous lifecycle boundaries.
Proposed Solution
Introduce a common Resource/Skill planning boundary, reusing existing SemanticPlan, RNFV/RFV policies, index identities, FieldPatch, scheduling, Task/Work, queues, locks, embedding backends, and native transfer APIs.
The planned production scope is eight modified files and one new file, with accompanying changes to existing tests:
| Change | Repository path | Proposed responsibility |
|---|---|---|
| Modify | openviking/storage/context_update_plan.py |
Pure runtime models and shared validation; relocate FileRefreshRequest with a compatibility re-export from its original module. |
| Add | openviking/storage/semantic_planning.py |
Shared preparation of committed refreshes, execution plans, node inputs, and parent follow-ups. |
| Modify | openviking/storage/queuefs/semantic_msg.py |
Pure factories and normalization using existing serialized fields. |
| Modify | openviking/storage/queuefs/semantic_processor.py |
Route effective Resource/Skill inputs through common planning and execution. |
| Modify | openviking/storage/queuefs/semantic_executor.py |
Execute explicit resolved actions while retaining scheduling and storage primitives. |
| Modify | openviking/utils/summarizer.py |
Preserve interfaces and return meanings through thin adapters. |
| Modify | openviking/storage/content_write.py |
Connect both Resource/Skill refresh exits to common preparation. |
| Modify | openviking/service/fs_service.py |
Adapt delete, copy, and transfer refresh helpers. |
| Modify | openviking/utils/skill_processor.py |
Produce Skill package messages through the common factory. |
The planner would expose prepare_committed_refresh(), resolve_semantic_execution(), prepare_node(), and prepare_parent_followup(). Model calls, enqueueing, task settlement, retries, and lease release would remain with their existing owners. The planner would not depend on whole Processor/Work objects.
The intended compatibility constraints are:
- Preserve existing queue-message encoding, historical fields, plan-over-flags precedence, and per-file parameters. Runtime intents and execution plans remain in memory.
- Preserve persisted plan semantics, existing node-stage input reads, and incremental directory expansion. An existing plan would retain its determined scope, actions, and record identities.
- Preserve
force_refresh=None/False/True, pending accounting, and the distinction between sampled inputs, required maintenance, and ready inputs. Node preparation, follow-ups, and retries must not register the original change again. - Preserve stale-message degradation across retries without restoring discarded aggregation.
- Preserve entrypoint-specific failure/degradation behavior, committed-content retention, and package-level Skill failure accounting.
- Preserve task-local cancellation, lease ownership, lock scope, and message-local embedding waits.
- Preserve Skill definition-root semantics separately from attachment aggregation.
Memory/Session would remain on their existing paths. resource_processor.py, context_update_execution.py, and reindex_executor.py are not planned mandatory production edits.
The intended sequence within one complete PR is behavior characterization, runtime models and planning, entrypoint adaptation, removal of replaced Resource/Skill decision paths, and focused regression validation.
Alternatives Considered
Retaining the existing distributed decision paths is the status-quo alternative; this proposal instead seeks one owner for Resource/Skill action selection.
An earlier optional approach involving a v2 persisted message protocol was removed from the proposal. The proposed scope retains the existing encoding and does not introduce deployment negotiation, a workflow framework, strategy registry, event ledger, or scheduler.
Feature Area
Storage/VectorDB
Also affects Resource/Skill entrypoints, filesystem refresh helpers, and asynchronous task processing.
Use Case
Illustrative scenario — not executed or reproduced:
Consider an indexed Resource directory containing an existing file and directory summary.
- A caller modifies the file while the parent remains below its refresh threshold.
- The file receives its required maintenance independently, while the parent directory body remains unchanged.
- Further changes meet the existing refresh condition.
- Directory aggregation proceeds at its existing node-processing stage.
The refactor intends to preserve these observable outcomes while moving action selection into the common planner. A structural ancestor would not automatically imply an aggregation action. This example describes the compatibility target, not a reported test result.
Example API (Optional)
N/A — no public API addition or behavior change is proposed. The scenario above describes the intended observable contract.
Additional Context
Related work: merged foundations include #5175 (incremental resource ingestion), #5416 (RFV reindex), #5897 (RNFV batch write), #6043 (Task/Work tracking), #6352 (durable content-write workflow), and #7380 (sibling-abstract reuse during pending refresh).
PR #5265 overlaps with the single-file write adapter. This proposal has a broader shared-planning scope and does not assume that PR is superseded.
Duplicate search: bounded Issue/PR searches completed on November 14, 2026 covered semantic plans, shared Resource/Skill execution, and proposed names including semantic_planning, SemanticExecutionPlan, and SemanticRefreshIntent. No Issue or PR covering the complete proposal was identified in those searches. Broad searches reached result limits; follow-up exact-name/title searches returned no matches. Discussions were not exhaustively searched.
Validation plan — NOT RUN: extend assertions in six existing contract-test files and adapt Resource/Skill fixtures in seven others. Planned regressions cover encoding compatibility, file-only/parent-only behavior, threshold accounting, stale results, node-stage reads, failure/cancellation outcomes, lock ownership, and existing production entrypoints.
Representative planned commands (a subset of the proposed focused regressions):
uv run pytest \
tests/storage/test_context_update_plan.py \
tests/storage/test_semantic_executor_incremental.py \
tests/storage/test_semantic_processor_target_preexisting.py \
tests/storage/test_abstract_overview_freshness.py \
tests/storage/test_semantic_msg_ingest_options.py \
tests/server/test_content_batch_write.py
uv run pytest \
tests/service/test_fs_service.py \
tests/server/test_content_batch_write.py \
tests/server/test_skill_failure_accounting.py \
tests/server/test_api_skills.py
The implementation PR would include actual focused pytest, Ruff, and mypy results, tested HEAD, platform/tool versions, skipped-check reasons, self-review, and applicable documentation/translation follow-up.
Feedback requested before implementation:
- Does the shared planning boundary fit the intended ownership model while lifecycle side effects remain with their existing owners?
- Does retaining the persisted message encoding cover the expected compatibility boundary?
- Are the listed entrypoint-specific behavior constraints and Memory/Session exclusions the appropriate scope?
- Should this contribution coordinate with #5265 or other existing work?
- Are there additional scope constraints or documentation follow-ups to record?
Contribution
- [x] I am willing to contribute to implementing this feature
Implementation has not started. This issue is for pre-implementation scope discussion.
This issue has been resolved in https://github.com/volcengine/OpenViking/pull/7685.