Skip to content

fix(openclaw-plugin): clean up ov-healthcheck artifacts#1540

Merged
qin-ctx merged 1 commit intovolcengine:mainfrom
Mijamind719:codex/fix-issue-1462-healthcheck-cleanup
Apr 17, 2026
Merged

fix(openclaw-plugin): clean up ov-healthcheck artifacts#1540
qin-ctx merged 1 commit intovolcengine:mainfrom
Mijamind719:codex/fix-issue-1462-healthcheck-cleanup

Conversation

@Mijamind719
Copy link
Copy Markdown
Collaborator

Summary

  • add default cleanup to ov-healthcheck.py so synthetic sessions and memories created by the healthcheck do not accumulate in OpenViking
  • keep cleanup working even when the healthcheck fails before Phase 2/4 capture finishes by rediscovering the probe session during Phase 5
  • document the new cleanup phase and --keep-artifacts behavior in both English and Chinese docs

Root Cause

Issue #1462 reported that ov-healthcheck.py left synthetic session and memory artifacts behind after repeated runs.

There were two practical gaps:

  • the script exited without any cleanup path, so successful runs always left synthetic data behind
  • when a run failed mid-flight, cleanup could not recover because it only deleted session_id values discovered earlier in the flow
  • memory cleanup could not rely on vector search alone in real environments, because synthetic memories could exist on disk while search/find still returned no hits

What Changed

  • added Phase 5: cleanup and --keep-artifacts
  • added OpenViking inspector helpers for session existence checks, URI reads, URI listing, session deletion, and URI deletion
  • made cleanup rediscover the probe session by marker if the earlier inspection phases never captured session_id
  • made memory cleanup use a filesystem-enumeration fallback under viking://user/default/memories and then verify by content fingerprints before deleting
  • updated HEALTHCHECK.md and HEALTHCHECK-ZH.md to describe the new cleanup behavior

Real E2E Validation

No mocks or stubs were used.

Environment:

  • OpenClaw gateway at http://127.0.0.1:18789
  • OpenViking at http://127.0.0.1:1933
  • repo config: ov.conf

Observed real artifact set from an earlier healthcheck run:

  • synthetic session: c58c486f-26c1-4090-904d-2bb8df26f54b
  • synthetic memories included:
    • viking://user/default/memories/profile.md
    • viking://user/default/memories/entities/project/order platform.md
    • viking://user/default/memories/entities/kafka/order_events_v2.md
    • viking://user/default/memories/entities/service/payment callback.md
    • viking://user/default/memories/preferences/default/communication style.md

Validation result after running the new cleanup logic against the real backend:

  • session_exists_before = true
  • session_exists_after = false
  • all 5 synthetic memory URIs returned uri_exists = false after deletion
  • a final rescan returned:
    • probe_session_after_cleanup = null
    • memory_uris_after_cleanup = []

Verification

  • python3 -m py_compile examples/openclaw-plugin/health_check_tools/ov-healthcheck.py
  • real cleanup verification against the running OpenViking service using the script's own inspector helpers

@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

1462 - Partially compliant

Compliant requirements:

  • Added Phase 5 cleanup to delete synthetic sessions and memories
  • Added --keep-artifacts flag to skip cleanup for debugging
  • Added rediscover of probe session if not found earlier
  • Updated documentation (EN and ZH)

Non-compliant requirements:

  • No retries for network calls (not in ticket scope)
  • No concurrency improvements (not in ticket scope)
  • No improved keyword matching (not in ticket scope)

Requires further human verification:

  • Cleanup of memories via filesystem enumeration fallback may need validation in real environments
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🏅 Score: 90
🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@Mijamind719 Mijamind719 changed the title fix: clean up ov-healthcheck artifacts fix(openclaw-plugin): clean up ov-healthcheck artifacts Apr 17, 2026
@Mijamind719 Mijamind719 force-pushed the codex/fix-issue-1462-healthcheck-cleanup branch from 45fe675 to f365d95 Compare April 17, 2026 10:00
HEALTHCHECK_PREFIX
+ "Please remember the following SYNTHETIC test data: "
"my name is Lin Zhou, I am rebuilding an order platform, "
HEALTHCHECK_PREFIX + "My name is Lin Zhou, I am rebuilding an order platform, "
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.

expected?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is intentional. The old wording explicitly told the model that the payload was synthetic data that should be ignored after the check, which made the memory path much less reliable to exercise in real E2E runs. For #1462 we need the healthcheck to create realistic synthetic artifacts so Phase 5 can actually verify cleanup of both sessions and memories. The run is still clearly marked by the [OPENVIKING-HEALTHCHECK] prefix and unique probe marker, and the new default cleanup removes those artifacts unless --keep-artifacts is set.

@Mijamind719 Mijamind719 changed the title fix(openclaw-plugin): clean up ov-healthcheck artifacts 【WIP】fix(openclaw-plugin): clean up ov-healthcheck artifacts Apr 17, 2026
@Mijamind719 Mijamind719 force-pushed the codex/fix-issue-1462-healthcheck-cleanup branch from f365d95 to bed88b3 Compare April 17, 2026 10:17
@Mijamind719
Copy link
Copy Markdown
Collaborator Author

Addressed the cleanup safety concerns in the latest push:

  • P1: memory cleanup is now bound to the current run only. The healthcheck seeds probe-derived unique facts (Kafka topic, callback host, debug tag, etc.), and cleanup only deletes memories whose content matches those run-specific markers. It no longer deletes based on static fingerprints like order_events_v2 or keep answers concise.
  • P2: the filesystem fallback no longer hardcodes viking://user/default/memories. Cleanup now derives the memory root from the actual session URI (viking://session/{user_space}/{session_id}), so the fallback stays in the same user space as the healthcheck run.
  • P3: post-delete verification no longer treats arbitrary API errors as success. Session/URI verification now distinguishes exists, missing, and unknown, and only records PASS when deletion is confirmed as missing.

Quick revalidation after the patch:

  • python3 -m py_compile examples/openclaw-plugin/health_check_tools/ov-healthcheck.py
  • real backend check: a fabricated probe-derived query now returns matches: [] against the current memory root, confirming the new cleanup matcher does not hit unrelated memories
  • real backend check: nonexistent session/URI verification now returns missing instead of collapsing API responses into a false PASS

@Mijamind719 Mijamind719 force-pushed the codex/fix-issue-1462-healthcheck-cleanup branch from bed88b3 to 744f828 Compare April 17, 2026 10:24
@Mijamind719
Copy link
Copy Markdown
Collaborator Author

Addressed the new blocker in the latest push (744f828c). The cleanup path no longer depends on parsing session URIs to discover the user memory root. It now resolves the current runtime user space directly from the backend view of viking://user, following the same preference order as the plugin client (preferred runtime user id -> default -> single visible space), and only uses session-path parsing as an extra hint.

Revalidation on the real backend:

  • runtime_user_id = default
  • resolved_user_memory_root = viking://user/default/memories
  • python3 -m py_compile examples/openclaw-plugin/health_check_tools/ov-healthcheck.py

So the memory cleanup path is no longer blocked by the viking://session/{session_id} vs viking://session/{user_space}/{session_id} URI shape mismatch.

@Mijamind719 Mijamind719 force-pushed the codex/fix-issue-1462-healthcheck-cleanup branch from 744f828 to d676d97 Compare April 17, 2026 11:20
@Mijamind719 Mijamind719 changed the title 【WIP】fix(openclaw-plugin): clean up ov-healthcheck artifacts fix(openclaw-plugin): clean up ov-healthcheck artifacts Apr 17, 2026
Co-authored-by: GPT-5.4 <noreply@openai.com>
@Mijamind719 Mijamind719 force-pushed the codex/fix-issue-1462-healthcheck-cleanup branch from d676d97 to 116d456 Compare April 17, 2026 12:57
Copy link
Copy Markdown
Collaborator

@ZaynJarvis ZaynJarvis left a comment

Choose a reason for hiding this comment

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

lgtm

@qin-ctx qin-ctx merged commit 064ee58 into volcengine:main Apr 17, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Apr 17, 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.

3 participants