Skip to content

fix(memory): track injected skill experiences - #5475

Open
fukalous wants to merge 1 commit into
volcengine:mainfrom
fukalous:fix/skill-experience-lineage
Open

fukalous wants to merge 1 commit into
volcengine:mainfrom
fukalous:fix/skill-experience-lineage

Conversation

@fukalous

Copy link
Copy Markdown

Description

The trajectory lineage pipeline only credited successful explicit read/multi_read calls. The Claude Code skill-experience hook injects retrieved Experience digests as text instead, so trajectories created from those sessions never carried source-experience tags and application statistics remained empty.

This change recognizes the exact envelope and bullet format emitted by the bundled hook, then sends each candidate through the existing current-user Experience URI validation before adding it to lineage. Explicit reads and injected URIs share the existing ordered de-duplication path.

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 #5405

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 causes existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Test update

Changes Made

  • Parse Experience URIs only inside the canonical skill-experience / experience-digest context envelope.
  • Reuse canonical_experience_uri() to reject other-user and non-Experience paths.
  • Preserve message order and deduplicate an injected URI that is also explicitly read.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing relevant unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Commands run:

.venv/bin/python -m pytest -q --no-cov tests/session/train/test_trajectory_analyzer_component.py tests/unit/session/memory/test_experience_lineage.py
21 passed

.venv/bin/ruff format --check openviking/session/memory/experience_lineage.py tests/unit/session/memory/test_experience_lineage.py
2 files already formatted

.venv/bin/ruff check openviking/session/memory/experience_lineage.py tests/unit/session/memory/test_experience_lineage.py
All checks passed

The focused mypy invocation traverses the repository and reports the existing main-branch type-error baseline; it reports no error in the changed lineage module.

Checklist

  • My code follows the project coding style
  • I have performed a human self-review of the code
  • The narrow parsing boundary and existing canonical URI validation were reviewed by the AI agent
  • Documentation updated (not applicable; no public API or configuration change)
  • No dependency or generated-file changes

Additional Notes

The parser intentionally accepts only the exact envelope and generated list-item shape owned by skill-experience.mjs; ordinary auto-recall context and lookalike text outside that envelope are ignored. No claim of independent human review is made.

@ZaynJarvis ZaynJarvis added agent-plugins Agent harness and plugin integrations kernel Core server, runtime, storage, retrieval, SDK, and CLI. labels Sep 30, 2026
@fukalous

fukalous commented Oct 9, 2026

Copy link
Copy Markdown
Author

Following up on the injected skill-experience lineage fix. Both current-head workflows are awaiting approval (action_required). Could a maintainer approve the runs and review the change when convenient? The parser is limited to the bundled hook's canonical envelope and retains the existing current-user Experience URI validation.

@fukalous
fukalous force-pushed the fix/skill-experience-lineage branch from c385397 to 4a31b4b Compare October 10, 2026 16:16
@fukalous

Copy link
Copy Markdown
Author

Rebased cleanly onto current main (4c9a755) in 4a31b4b; no implementation conflict or follow-up code change was needed.

Fresh validation:

  • trajectory analyzer + Experience lineage tests: 21 passed
  • Ruff check passed
  • Ruff format check passed
  • git diff --check passed

@fukalous

Copy link
Copy Markdown
Author

@heaoxiang-ai this adjusts Experience trajectory lineage for injected skill memories in the area you originally implemented. The current head is mergeable and all applicable plugin and API/CLI checks are green. Could you review the lineage behavior when convenient?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-plugins Agent harness and plugin integrations kernel Core server, runtime, storage, retrieval, SDK, and CLI.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Bug] skill-experience hook injections never count toward Agent Experience application stats

2 participants