Repository navigation
feat(captures): inspect recorded packets with bounded TShark delivery - #2318
Merged
Merged
Conversation
Integrate the recorded-only Linux provider from #2130 on current REA contracts, preserving selected fields, two-pass analysis and Evidence. Co-authored-by: Olorinm <[email protected]>
Exercise real descriptor ownership for capture, executable, limiter and kernel-report close failures. Refuse new work until cleanup can succeed and prove that repeated shutdown releases every retained handle. Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
3 tasks done
34 tasks done
11 tasks done
4 tasks done
3 tasks done
3 tasks done
14 of 19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Inspect caller-selected fields in an existing packet capture through shared CLI/MCP workflows. This replaces #2130, credited to Olorinm, with current-main integration, bounded delivery and cleanup regressions. There is no linked issue.
Problem and expected behavior
Analysts need offline network/USB/Bluetooth field inspection without opening an active binary or acquiring traffic. Selecting two fields from a real 12,023-frame capture previously returned about 1.10 MB of text. The default now returns 50 matching frames with original frame numbers and explicit coverage; callers can page or request all remaining matches.
Change and scope
Linux-only TShark 4.x provider; caller supplies absolute
REA_TSHARK_COMMANDand trusted util-linuxprlimit. Fields, display filter, decode-as, input-packet limit and pass mode remain caller-selected. Paging happens after dissection and filtering, preserving two-pass/reassembly semantics. MCPmatch_limit: nulland CLI--all_matchesexplicitly request full output; conflicting CLI options are rejected before effects.Use existing process supervision, artifact descriptor ownership, session admission and Evidence delivery. Admit one inspection at a time and return retryable capacity errors instead of accumulating work. Failed descriptor/process/private-file cleanup remains owned for retry, including shutdown. Source bytes are copied privately and never passed directly to TShark.
Contract and boundary impact
PacketCaptureService; TShark owns producer parsing, resource supervision and artifact identity.inspect-packet-capture/inspect_packet_capture, selected fields required. Defaultmatch_limit: 50,match_offset: 0;output_windowreports matching/returned counts andhas_morewithin the input read scope.Expected effects:
Evidence and regression coverage
Reproduced admission-after-close, excess admission and retained descriptor-close failures against the imported implementation before fixing them. Descriptor tests cover capture, executable, limiter and kernel report; successful retry returns descriptor counts to baseline.
Real compiled CLI/MCP verifier: 15 cases on Debian 12 / TShark 4.0.17, including generated Ethernet/DNS/Bluetooth HCI recordings, field repetition/omission, filters, decode-as, both pass modes, input prefix before filter, output paging/full selection, schemas, errors, persistence, identity and cleanup.
Additional real data: pinned Wireshark 4.0.17 HTTP PCAP and DNS/ICMP PCAPNG; owned HTTP server/curl recording; a real recording of 1,000 owned HTTP requests (1,526,684 bytes / 12,023 frames). Known request URIs and source SHA-256 checked independently. Full packet arrays exactly match the imported implementation; bounded results exactly match their prefixes.
Representative result:
output_window: { matching_packets: 12023, returned_packets: 50, has_more: true }, with originalframe.numbervalues and selected fields.Proof gaps: TShark versions beyond verified 4.0.17/4.2.2, other platforms, USB, BLE ATT and physical hardware are not established by these tests. Fixture Bluetooth HCI is not a hardware claim. Installed global plugins/libraries/configuration are trusted and not fully fingerprinted.
Observed, derived and inferred claims remain distinguishable.
Artifact identity, provenance and failed attempts remain preserved.
Unsupported/incomplete outcomes remain visible.
Validation performed
npm run test:focused --ten capture/CLI/MCP/kernel/capability/effect/schema files — 79 passed on synchronized main.REA_TSHARK_COMMAND=/usr/bin/tshark node scripts/verify-packet-capture.mjs— 15 real CLI/MCP cases passed locally after synchronization; Ubuntu 24.04 CI / TShark 4.2.2 also passed all 15 cases and all 47 provider-boundary tests.npm run check,npm run docs:check,npm run verify:test-discovery— all passed again on synchronized main.Performance: three repetitions per case, warm MCP process, new TShark process each call, two CPU cores, 8 GiB family RSS guard. No filesystem-cache flushing. On the 12,023-frame recording, selected two-field response text went from 1,099,961 to 9,541 bytes; latency from 1.66–2.00 s to 1.22–1.41 s. Explicit full output remains available (1,100,118 bytes; 1.63–1.99 s). Filtered 1,000 HTTP requests return 50 by default (144,124 to 12,137 text bytes; 1.05–1.21 s). The nine-call optimized run peaked at 868.68 MiB family RSS; all guarded work stayed below 8 GiB.
For the task of inspecting the first 50 frames,
o200k_baseestimates including one common current capture-tool definition, one request and measured response text are 449,644 before paging versus 7,633 after. The common definition contributes 4,266 tokens to both comparisons. These are tokenizer estimates, not billed usage; other tool catalogs, prompt conversion, agent reasoning and subsequent calls are unmeasured. No cache claim is made; later pages repeat dissection and remain subject to producer limits.Compatibility, safety, and release
New feature; no previously released capture-tool call changes. Input <=32 MiB, combined producer stdout/stderr <=4 MiB, 30-second deadlines, enforced 1 GiB address space / 64 MiB file / 30 CPU-second ceilings per producer; stricter inherited limits are preserved. Paging bounds delivery but does not bypass producer-output limits. This is not an OS sandbox or an aggregate filesystem/memory quota. Unsupported authority remains refused.
Before merge
Final CI: all 38 checks passed for
8a049dfc82171c798601eb9b88606eed003a380c, including required CI, real TShark, six full test shards, coverage, static/docs/workflow checks and all native package lanes. Automatic Codex review did not execute because repository review credits were exhausted; it supplied no code findings. Own source inspection, regression reproduction and real-provider verification were completed.Merged as
f611d8ce722cd36345e9ff83b9669ef2e7fe57a9.