Skip to content

fix(process): stabilize capture comparisons - #8279

Closed
Sonai124 wants to merge 1 commit into
morluto:mainfrom
Sonai124:fix/process-capture-determinism-8204
Closed

Sonai124 wants to merge 1 commit into
morluto:mainfrom
Sonai124:fix/process-capture-determinism-8204

Conversation

@Sonai124

@Sonai124 Sonai124 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #8204.

Make deterministic process-capture comparisons ignore capture-local scheduler and observer timing by default, while retaining every timestamp in the source Evidence. Keep the comparison compatible with the generalized inline/retained/file Evidence inputs now provided by current main.

Problem and expected behavior

Two captures of the same deterministic command can record different terminal, settlement, finalization, process-sample, and filesystem-checkpoint times. The prior comparison treated those observation times as behavior, so otherwise identical captures reported changed terminal, exit, and filesystem dimensions.

Default comparison should compare observed behavior, not observer latency. Callers that need timing as part of the question can still assert exact timing fields through trace_spec.

Change and scope

  • Project semantic comparison observations that omit only capture-local timing fields.
  • Preserve full timed observations in Evidence and in diagnostics for genuine semantic divergences.
  • Keep exact trace matching unchanged, so caller-selected timing assertions remain available.
  • Update the process-capture docs and reverse-engineering runtime guidance.

This is an ordinary fix within the existing process-capture and comparison boundaries; no new provider, target execution capability, or protection-recovery scope is introduced.

Contract and boundary impact

  • Semantic owner and earliest changed stage: processComparison.ts owns the default semantic projection. Current main owns generalized Evidence selection in the shared process-comparison service; this PR adds no parallel resolver.
  • Contribution scope fit and linked maintainer decision: ordinary bug fix; not applicable.
  • CLI and MCP/tool-catalog contract: CLI/MCP comparison behavior changes only for capture-local timing differences. Current main already accepts inline, retained, and file Evidence inputs; this path remains covered after the rebase.
  • Provider, bridge, target-format, or platform compatibility: provider capture formats are unchanged; comparison behavior is platform-independent.
  • Evidence, artifact, provenance, or reconstruction contract: timestamps remain in original Evidence. Exact trace assertions can still select them.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): unchanged.
  • Generated metadata, package, or installation impact: none; authored docs and skill reference updated, generated checks pass.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: semantic timing regression and semantic-difference counterexample; raw/rendered earliest-divergence ordering; trace timing opt-in behavior, retained timing diagnostics, per-source ignored timing, and earlier trace-selected timing versus later semantic changes; compiled retained-reference compatibility on the shared current-main resolver.
  • Base reproduction: two real PTY captures of the same deterministic Node command had frame times 49/47 ms, settlement 108/86 ms, and final filesystem-checkpoint times 240/213 ms. Base 22e5aa9 returned status=changed, with terminal/exit/filesystem all changed and first divergence at terminal at_ms.
  • User-visible CLI/MCP output: the patched CLI reports terminal, interaction, exit, and filesystem unchanged for those exact capture files. Overall status remains unknown because both captures explicitly retain REA's existing sampled-process-tree residual unknown.
  • Remaining proof gaps: macOS was not locally available. The complete source suite ran on Ubuntu 24.04 under WSL2; targeted source, compiled boundary, docs, and static checks also ran on Windows.

Boundary/lifecycle coverage includes the public CLI capture/compare path, compiled MCP schema/registration/delivery, Evidence identity and retained-ledger lookup, trace parity, process lifecycle, filesystem snapshots, terminal rendering, normalization, and cleanup.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:fast -- --maxWorkers=1 --no-file-parallelism (Ubuntu 24.04 WSL2, Node 24.22.1/npm 11.16.0, immediately preceding 23de10b base) — 1,217 files passed; 22,487 tests passed; 16 skipped; zero failures. A prior default-concurrency run reached 22,486 passes with one untouched upstream NodeSeaArtifactReader stream-lifecycle flake; that file passed alone (41/41), and the complete serialized run passed.
  • npm run test:focused -- <12 relevant process/evidence files> on the final df25bc8 base — 12 files passed; 164 tests passed and 4 intentionally skipped (168 total) across semantic comparison, shared Evidence resolution/conformance, CLI input ordering/file loading, MCP consumers/boundaries, and real process-capture acceptance.
  • npm run test:local -- src/domain/process/processCapture.comparison.test.ts src/domain/process/processTraceComparison.test.ts src/application/EvidenceInputResolver.test.ts — 48 tests passed on Windows.
  • npm run check:fast — typecheck and lint passed on Windows and Linux, including the pre-push hook.
  • npm run format:check — all 6,673 files passed on the final base.
  • npm run docs:check — all six built documentation tasks and nine README consistency tests passed.
  • npm run verify:windows-native:artifact — exact 6.8.0 Windows x64 native artifact verified.
  • Real public CLI workflow — two captures and comparison passed; base reproduced the false changes and the patch removed them.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Timing-only differences stop producing false changes; exact timing checks remain available via trace_spec.
  • Real Hopper/Ghidra, browser, or OS coverage: no provider-specific behavior changed; Windows targeted coverage and complete Ubuntu/WSL2 source coverage ran. macOS is left to CI.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new execution, mutation, network, or authority surface. Retained references are restricted to exact Evidence already present in the current session.

Author readiness

Human owner: @Sonai124

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Default process comparisons now ignore capture-local timing while keeping timed observations in source Evidence and change details.

  • Process comparisons ignore timing unless a trace asks for it.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  E["Source Evidence<br/>timing retained"] --> S["Default projection<br/>capture-local timing omitted"]
  E --> T["Optional exact trace<br/>selected timing asserted"]
  S --> C["Compare dimensions"]
  T --> C
  C --> D["Choose first difference"]
  E --> R["Retained observations"]
  R --> D
Loading

Reviews (5) · Last reviewed commit: "fix(process): stabilize capture comparis..." · Reviewed by Greptile

Comment thread src/domain/process/processComparison.ts Resolved
Comment thread src/domain/process/processComparison.ts Resolved
@Sonai124
Sonai124 force-pushed the fix/process-capture-determinism-8204 branch 4 times, most recently from 48dbadc to 21007d7 Compare October 31, 2026 15:07
Comment thread src/domain/process/processComparison.ts Resolved
@Sonai124
Sonai124 marked this pull request as ready for review October 31, 2026 15:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-31T15:15:27.973327Z
We couldn’t complete this review. Comment @codex review to try again.
21007d7 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sonai124
Sonai124 force-pushed the fix/process-capture-determinism-8204 branch from 21007d7 to 1e30e34 Compare October 31, 2026 15:21
@morluto

morluto commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Superseded by #9644, which preserves this implementation and integrates current main with the documentation conflict resolved. The contributor fork rejected maintainer pushes. Validation on the replacement: 76 comparison, input-order, diagnostics and verification tests passed, plus check:fast and docs:check. Closing this duplicate; the fix continues in #9644.

@morluto morluto closed this Nov 9, 2026
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] compare-process-captures reports changed when comparing two captures of the same deterministic run

2 participants