Skip to content

chore(sight): fix HTTP/2 Huffman decode + dead-code/warning cleanup + docs#663

Merged
Daydreamer-Li merged 3 commits into
alibaba:mainfrom
jfeng18:chore/sight-polish
Jun 2, 2026
Merged

chore(sight): fix HTTP/2 Huffman decode + dead-code/warning cleanup + docs#663
Daydreamer-Li merged 3 commits into
alibaba:mainfrom
jfeng18:chore/sight-polish

Conversation

@jfeng18

@jfeng18 jfeng18 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Independent polish pass on sight (off main, no dependency on the lineage/scheduler PRs). Four focused commits:

  1. fix: decode HTTP/2 HPACK Huffman headersParsedHttp2Frame::huffman_decode() returned a "<huffman:N bytes>" placeholder, so any Huffman-encoded HTTP/2 header (:path, :status, content-type, header values) was unreadable, breaking path classification / SSE detection for HTTP/2 LLM-API traffic. Now delegates to the already-imported hpack crate's RFC 7541 decoder, with RFC test vectors.
  2. chore: remove dead code, deprecated APIs, unused imports — delete ~265 lines of compiler-confirmed dead token-computation code in analyzer/unified.rs, the unused comm_to_string / get_pending_calls_for_pid, and two todo!() public stubs in tokenizer/llm_tok.rs (latent panics); replace deprecated base64::encode; make set_ffi_sender pub(crate) (was leaking a crate-internal type); drop unused imports.
  3. chore: silence generated-code warnings — scope an #[allow(...)] to each probe's mod bpf { include!(...) } block (bindgen/skeleton output) and clear the last hand-written warnings. The crate now builds warning-free (lib + tests + bins).
  4. docs: sync probe/Event/test-index docs — AGENTS.md, integration-tests/README, and the ebpf-probes design doc had drifted behind the 7 merged probes / 6 Event variants.

Test plan

  • 439 unit tests pass, zero regressions; new RFC 7541 Huffman decode tests
  • cargo build clean: 0 warnings across lib + tests + bins
  • Pure userspace (parsing/cleanup/docs) — no eBPF runtime change, so no kernel E2E required

Follow-up (separate PR): a cargo fmt + cargo clippy --fix pass to make sight pass clippy -D warnings, then add the fmt/clippy/FFI gate to the agentsight CI job (the repo PR template already expects it; CI currently runs only cargo test).

Generated with Claude Code


Update (polish)

Huffman fix split out to #670fix(sight): decode HPACK Huffman headers. Force-pushed to drop commit 63fad98 from this stack so the diff is now scope-clean (polish/cleanup/docs only).


Update (2026-06-02 conflict-fix rebase)

Rebased onto post-Huffman main (#670 merged). The frame.rs rustfmt conflict (predicted in CLAUDE.md's rebase note: rustfmt commit recreated against new base) was resolved by the canonical recipe — drop the original rustfmt commit, replay clippy commits, then run cargo fmt once on the new base to produce a fresh rustfmt commit. While in rebase mode, also normalised every commit subject to ≤50 chars (the commit msg ≤50 rule mandates re-checking inherited subjects on amend).

jfeng18 and others added 3 commits June 2, 2026 11:37
Hygiene pass over the crate (no behavior change):
- Delete compiler-confirmed dead code: the orphaned token-computation cluster
  in analyzer/unified.rs (compute_prompt_tokens /
  compute_token_consumption_with_template /
  compute_output_token_breakdown_from_json, ~265 lines), the unused
  comm_to_string in sslsniff.rs, and get_pending_calls_for_pid in health/checker.
- Remove two `todo!()` public stubs in tokenizer/llm_tok.rs (from_url,
  messages_to_json) that would panic if ever called and had no callers.
- Replace deprecated base64::encode with the Engine API (base64 0.22).
- Make AgentSight::set_ffi_sender pub(crate) so it no longer leaks the
  crate-internal FfiEventSender type.
- Drop unused imports (via cargo fix) and silence a few unused-variable
  bindings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The bindgen header + libbpf skeleton blocks (mod bpf { include!(...) }) emit
~100 non_camel_case_types / non_upper_case_globals / dead_code warnings that
drowned out real signals. Annotate each of the 7 probe modules' generated
include block with a scoped #[allow(...)] instead of touching generated code.

Also clear the remaining real warnings: a dead trailing bind_idx increment in
token_consumption.rs, the unused format_duration_ns CLI helper, and an unused
test binding. The crate now builds warning-free (lib + tests + bins), making a
future -D warnings gate viable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The docs drifted behind the 7 merged probes and 6 Event variants:
- AGENTS.md: Event enum listed 4 of 6 variants and the probe table 4 of 7
  probes; add FileWrite/UdpDns + filewrite/udpdns/tcpsniff.
- integration-tests/README.md: pointed at nonexistent test_sni.md /
  test_hermes_sni.md and omitted the real test_dns/test_hermes_dns/test_http/
  test_connection_scanner/test_ffi_integration entries.
- docs/design-docs/ebpf-probes.md: said "4 probes"; document all 7 (diagram,
  detail sections, and the ring-buffer source-value table).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jfeng18 jfeng18 force-pushed the chore/sight-polish branch from 0ee2e07 to 9a3daca Compare June 2, 2026 03:38

@Daydreamer-Li Daydreamer-Li left a comment

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.

LGTM — thanks for the sight dead-code cleanup and docs sync.

@Daydreamer-Li Daydreamer-Li merged commit cf8b1a6 into alibaba:main Jun 2, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:sight src/agentsight/ scope:documentation ./docs/|./*.md|./NOTICE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants