Skip to content

[Integration] Add an offline incident ZIP for issue and AI handoff - #4841

Open
jacklin78911-collab wants to merge 5 commits into
kvcache-ai:mainfrom
jacklin78911-collab:codex/mc-diag-zip-integration
Open

jacklin78911-collab wants to merge 5 commits into
kvcache-ai:mainfrom
jacklin78911-collab:codex/mc-diag-zip-integration

Conversation

@jacklin78911-collab

@jacklin78911-collab jacklin78911-collab commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Add a standard-library incident collector under scripts/diagnostics/: prepare one redacted ZIP of Mooncake/vLLM P/D logs, service-host snapshots, incident context, and troubleshooting records. On completion it suggests attaching the reviewed ZIP to a Mooncake issue or consulting AI.

python3 scripts/diagnostics/mc_diag.py bundle \
  --case incident/case.md \
  --prefill-log incident/p.log --decode-log incident/d.log \
  --snapshot incident/p-snapshot.json --snapshot incident/d-snapshot.json \
  -o incident/mooncake-incident.zip

Python 3.9+ is sufficient. Packaging requires no installed skill, Mooncake package, GPU, or AI client. snapshot is a separate read-only Linux service-host command; bundle never collects the packaging host's environment or uploads data.

The ZIP has one reading entry (AI_CONTEXT.md), env.json, manifest.json, numbered logs, and optional incident/troubleshooting records. It retains all supplied LF lines and lists literal P/D IDs, explicit request/transfer pairs, and representative error lines. Different request IDs are never merged. Error samples are bounded per role so prefill noise cannot exclude decode errors. Analysis belongs in the issue discussion or AI; the collector has no stage classifier, revision-rule catalog, or duplicate report tree.

Sharing and field correctness

  • Consistent host/IP/GID/MAC/user pseudonyms include network IDs beside _ filename separators and DNS case variants. The private map stays outside the ZIP and .map.json inputs/symlink targets are rejected.
  • Credentials, RDMA keys and recognized request content are removed. JSON embedded in a multiline prompt cannot end redaction just because it has a message key; actual leveled JSON diagnostics still work.
  • UTF-8 BOM exports are accepted. UTF-16, binary and invalid UTF-8 are rejected with the input filename rather than shared after unreliable decoding. Incomplete/corrupt gzip inputs identify the source file and publish no archive.
  • Output creation is exclusive. Failed publication rolls back this invocation's new outputs and preserves existing files.
  • Snapshots collect interpreter/build/process/RDMA/GPU facts. Package metadata follows interpreter discovery order; it is not proof of modules already imported in a modified process. Build capability is not proof of the active backend.

Review the ZIP for business-specific private formats before sharing. Select the relevant incident window before running; inputs are not silently truncated.

Relation to existing work

Supports the local incident-bundle goal in RFC #2864 and complements the diagnostic core/tent version merged in #4154. It serves existing Classic/TENT and application-level vLLM deployments, with no new live transport probe, benchmark engine, or native runtime dependency. Related diagnostic/collection issues and PRs were checked before this implementation.

Module

  • Integration / operator tooling
  • Docs
  • CI/CD
  • Other: scripts/diagnostics

Type of Change

  • New feature
  • Bug fix
  • Documentation update

How Has This Been Tested?

python3 -m unittest discover -s scripts/diagnostics -p 'test_mc_diag.py' -v
pre-commit run --files scripts/diagnostics/mc_diag.py \
  scripts/diagnostics/test_mc_diag.py scripts/diagnostics/README.md \
  README.md .github/workflows/diagnostics.yml
  • 48 tests pass per interpreter on local Linux Python 3.9.25, 3.11.15 and 3.12, with no skips. Scoped pre-commit passes on an exact Linux mirror of the changed files using the repository configuration; source hashes were checked against the worktree. GitHub's matrix uses Ubuntu 24.04 so Python 3.9 remains available; latest-head GitHub offline CI passes on Python 3.9, 3.11 and 3.12; some repository-wide checks remain queued.
  • Reproduced field counterexamples on the previous revision before fixing them: JSON prompt continuations; underscores around network IDs in filenames; DNS case variants; P error samples displacing D failures; accidental inclusion of a prior private map; BOM snapshot import; BOM/UTF-16 request-content leakage; and corrupt gzip reporting only None: None. Regressions cover the log/case/record paths, all input types for maps, and failed-publication cleanup.
  • Historical real 2xH20 TENT/RDMA vLLM PD failure replay retains 681 P lines and 745 D lines, with 32 unique references checked. Independently verified 30 literal-ID references, 3 explicit pairs and 6 error excerpts against the retained logs. ZIP CRC, member paths, mapped-identity removal and exclusion of maps/redundant reports pass review.
  • Windows NTFS: four simultaneous CLI publishers targeting the same output produce exactly one valid ZIP/map, three clean overwrite refusals, unchanged source logs, and no partial siblings or tracebacks.
  • The historical 0.2.4 snapshots' invalid package metadata remains withheld; independent original runtime evidence is retained as an operator record. This is an offline replay, not a new snapshot or GPU run.
  • No private logs, snapshots, maps or real replay ZIP are uploaded here.

Test results:

  • Unit tests pass
  • Real-log replay, citations, privacy and Windows concurrent publishing verified
  • Scoped static/format checks pass
  • New GPU/RDMA run (not applicable to collector changes)

Checklist

  • Self-review and independent second pass through collection, redaction, ownership/lifecycle, citations and archive paths
  • C/C++ formatting via scripts/code_format.sh (not applicable)
  • Scoped pre-commit passes
  • Documentation updated
  • Regressions protect observed field failures and the core ZIP path
  • Design context for >500 LOC: existing RFC [RFC]: TENT Operator CLI and Sanitized Diagnostic Bundle #2864; application-log collection subset
  • Human submitter has reviewed every changed line and can defend the import; human review/signoff remains required before merge

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used

Codex assisted with implementation, simplification, concrete counterexamples, tests and review. Automated testing/review is not represented as human review of every line. Ready for maintainer review; no automatic merge or approval is requested.

@github-actions github-actions Bot added documentation Improvements or additions to documentation run-ci CI/Build labels Oct 22, 2026
@jacklin78911-collab
jacklin78911-collab marked this pull request as ready for review October 26, 2026 02:13

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

CI/Build documentation Improvements or additions to documentation run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant