Skip to content

fix(session-analysis): qualify and harden DSH evidence for rc.8 - #97

Open
Cobb04 wants to merge 13 commits into
QoderAI:mainfrom
Cobb04:fix/dsh-rc8-session-evidence
Open

fix(session-analysis): qualify and harden DSH evidence for rc.8#97
Cobb04 wants to merge 13 commits into
QoderAI:mainfrom
Cobb04:fix/dsh-rc8-session-evidence

Conversation

@Cobb04

@Cobb04 Cobb04 commented Aug 20, 2026

Copy link
Copy Markdown

Summary

Qualifies Better Harness dsh-v1 against the audited DeepSeek Harness
dsh-v0.1.0-rc.7 / dsh-v0.1.0-rc.8 format-0 persisted session-evidence
slice. The delivered capability is read-only sessionAnalysis for raw JSONL
and feature-detected framed Zstandard evidence; it is not full DSH host or full
rc.8 support.

The rc.8 work strictly validates interrupted assistant evidence and four known
team event types without projecting team analytics. It also closes seven
evidence-contract gaps covering unknown tool outcomes, home resolution,
ignorable events, seed ownership, sessions-root containment, crash tails, and
reused native call IDs. A separately reviewable Windows secret-scan commit is
disclosed below because the mandatory Windows lane exposed that pre-existing
CI-blocking defect.

Why

  • Issue/Story: Refs [Feature]: Add partial DeepSeek Harness session-evidence adapter #93
  • User or maintainer outcome: Keep the partial DSH session-evidence adapter
    aligned with the pinned rc.7/rc.8 persisted contract, fail closed on
    unsupported drift, and give maintainers current native, regression,
    cross-platform, packaging, and risk evidence for review.

Traceability and Scope

  • Spec/ADR, if applicable:
    docs/specs/2026-08-18-93-deepseek-harness-session-evidence.md
  • Acceptance criteria addressed: AC-1 through AC-11. AC-6 now includes the
    completed reused-invocation contract for equal and non-monotonic timestamps.
  • Canonical owners changed:
    • scripts/session-analysis/platforms/dsh.mjs — DSH persisted-evidence owner.
    • scripts/session-analysis/episode-contract.mjs — shared lifecycle
      occurrence owner.
    • scripts/agent-guardrails/secret-scan.mjs — isolated Windows CI/security
      follow-up.
  • Explicit non-goals: full DSH host or full rc.8 support; installation,
    configured assets, plugin lifecycle, shell, packaging, Quickstart, report
    routing, SQLite/custom persistence, team analytics, and native DSH E2E on
    every operating system.

The compatibility boundary is: Better Harness dsh-v1, sessionAnalysis
only, DSH persisted format 0, raw JSONL and feature-detected framed Zstandard,
qualified against the audited rc.7/rc.8 format-0 persisted session-evidence
slice.

What Changed

RC8 compatibility

  • Accept and strictly validate the optional literal
    assistant/message.data.interrupted: true marker.
  • Recognize and strictly validate team/member, team/task,
    team/message/queued, and team/message/delivered and their audited replay
    relationships.
  • Account for those team events without projecting team ownership, causality,
    activity, or analytics.

Evidence and compatibility fixes

  1. Missing native tool-result isError remains unknown instead of being
    fabricated as success.
  2. Blank inherited DSH_HOME is treated as unset; explicit invalid CLI values
    remain invalid.
  3. Unknown ignorable:true events accept valid JSON-valued data while known
    event schemas remain strict.
  4. Inherited seedLength history is decoded and validated but excluded from
    child-owned activity.
  5. Discovery remains contained within the canonical sessions root and fails
    closed on escaping symlinks or canonical paths.
  6. Raw JSONL and framed-Zstd crash tails retain committed prefixes while
    committed structural/checksum corruption remains rejected.
  7. A native call ID reused after a completed lifecycle remains a distinct
    occurrence even when timestamps are equal or non-monotonic. Occurrence
    grouping follows stable provider/native lifecycle order; timestamps remain
    temporal presentation/duration evidence and do not define invocation
    identity. Native IDs are neither rewritten nor synthesized.

Windows CI follow-up

The required Windows CI lane exposed a pre-existing secret-scan file-identity
precision defect. The focused final commit preserves full-width filesystem
identity during the existing before/open check. It is unrelated to the DSH
behavior in this PR, independently reviewable and revertible, and included here
as the CI-blocking exception required to restore the mandatory Windows lane. It
does not claim to eliminate all filesystem TOCTOU races. Maintainer guidance on
accepting this isolated exception in #97 is welcome.

Change Type

  • Feature
  • Bug fix
  • Tests only
  • Documentation/community
  • Refactor with no intended behavior change
  • Dependency, packaging, or infrastructure

Test and Review Evidence

Check Result
Focused DSH fixture/discovery/provider suites PASS — 3 files, 95/95
F7 reused-ID × non-monotonic regression PASS — 1/1 targeted; 16 unrelated tests skipped
Shared episode contract PASS — 17/17
Directly affected shared lifecycle/cross-host suites PASS — 6 files, 188/188
All session suites PASS — 21 files, 380/380
Focused secret-scan suite PASS — 26/26
Agent/security owner suites PASS — 10 files, 163/163
Full repository npm test -- --maxWorkers=4 PASS — 99 files, 1433/1433
Harness DSL tests CI PASS — 156/156 in every matrix lane
Harness UI tests CI PASS — 29/29 in every matrix lane
Harness Studio tests CI PASS — 121/121 in every matrix lane
Harness Studio browser interaction CI PASS — 15/15 on Ubuntu Node 22.20
Generated Harness DSL source verification CI PASS in every matrix lane
npm run pack:verify PASS — npm 548 entries; runtime zip 577 entries; CI PASS in every lane
Documentation/link validation PASS — 6/6
git diff --check PASS
Native DSH rc.8 real-provider E2E Recorded PASS — isolated macOS/arm64 run produced framed-Zstd evidence and exercised the public Better Harness session-analysis paths
Pinned rc.7 regression PASS — retained in the current focused DSH compatibility suites
GitHub cross-platform CI PASS — Windows Node 22.20: 1431 passed + 2 platform skips (1433 total); macOS Node 22.20: 1433/1433; Ubuntu Node 22.20: 1433/1433; Ubuntu Node 24.x: 1433/1433

Manual or visual evidence: Native rc.8 E2E was run in the recorded isolated
macOS/arm64 environment. Better Harness regressions were separately validated
across the repository's Windows/macOS/Linux CI matrix; this does not claim a
native DSH E2E on every OS.

Risk and Recovery

  • Compatibility and cross-platform impact:
    • Strict rc.8 evidence validation intentionally fails closed on unsupported
      upstream drift.
    • Crash-tail recovery distinguishes uncommitted suffixes from committed
      corruption; seed ownership changes projection ownership while retaining
      full validation.
    • Shared lifecycle occurrence partitioning affects every host using the
      generic episode owner; focused cross-host and full-suite regressions are
      green.
    • Canonical sessions-root containment remains fail closed.
    • Full-width filesystem identity prevents Number precision loss while
      retaining the existing before/open guard; it does not eliminate every
      filesystem TOCTOU race.
  • Package, plugin, schema, or generated-file impact: no dependency migration,
    no format migration, no persisted-data rewrite, and generated-source and pack
    verification pass.
  • Rollback or recovery path: behavior-separated commits allow the DSH changes,
    shared lifecycle completion, and Windows secret-scan exception to be reviewed
    or reverted independently; no migration cleanup is required.
  • Residual risk or unverified boundary: default-facts prompt exposure and
    replacement/current-surface semantics remain outside fix(session-analysis): qualify and harden DSH evidence for rc.8 #97; full DSH host
    support, SQLite/custom persistence, team analytics, and cross-platform native
    DSH E2E remain out of scope.

AI Involvement

  • Level: Assisted.
  • Human review and validation: Codex and Cursor were used during implementation,
    adversarial audit, and testing. The contributor independently compared the
    delivered behavior with pinned DSH rc.8 sources, ran the recorded isolated
    native E2E, inspected the resulting diff and cross-platform CI, and retains
    final review responsibility. AI-generated analysis itself is not treated as
    acceptance evidence.

Review Guide

Review commits in their actual oldest-to-newest order:

  1. b2be0f6fix(session-analysis): accept audited dsh rc8 events
  2. 1ea8d17fix(session-analysis): preserve unknown DSH tool outcomes
  3. 7b2b7d1fix(dsh): treat blank DSH_HOME as unset
  4. 6280985fix(dsh): accept JSON-valued ignorable events
  5. 7a8cc31fix(dsh): exclude inherited seed history from child activity
  6. a85cefcfix(dsh): contain discovery within sessions root
  7. f7653edfix(dsh): recover committed prefixes from crash tails
  8. 09b7ad2fix(session-analysis): retain repeated tool invocation occurrences
  9. 1b6f938docs(dsh): record audited rc8 evidence boundaries
  10. 74229c2test(dsh): strengthen compatibility edge coverage
  11. 103c21cdocs(dsh): point rc8 evidence to rc8 sources
  12. f730a7dfix(secret-scan): preserve filesystem identity precision
  13. 53534b2fix(session-analysis): preserve lifecycle order across timestamp drift

Checklist

  • I followed AGENTS.md, CONTRIBUTING.md, and the relevant canonical-owner guidance.
  • The change is focused and does not include unrelated local or generated state.
    Unchecked because the disclosed, independently reviewable Windows secret-scan
    CI exception is technically unrelated to DSH; no unrelated local or generated
    state is included.
  • Tests and documentation match the behavior actually delivered.
  • Markdown links were checked when documentation moved or changed.
  • Cross-platform behavior was considered for Windows, macOS, and Linux.
  • Package/runtime verification was run when shipped files or dependencies changed.
  • User-facing or compatibility changes are recorded in CHANGELOG.md.
    CHANGELOG.md is not updated because the accepted issue/spec does not
    explicitly authorize a changelog edit; maintainer guidance is welcome.
  • I have the right to contribute this work under the repository's MIT License.

Refs #93

codex and others added 13 commits August 20, 2026 21:42
Extend the existing dsh-v1 format-0 reader with strict rc.8 interrupted-assistant and team-event validation while keeping team records account-only. Add native-derived regression fixtures and document the audited rc.7/rc.8 evidence slice.

Validated with the focused DSH suites, the full session suites, npm test, generated-code checks, workspace package tests, documentation links, and pack verification.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Only emit normalized success and error fields when pinned DSH records isError. Keep explicit true and false behavior and call/result correlation covered by provider tests.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Match the pinned rc.8 home resolver by falling back to ~/.dsh for blank or whitespace-only inherited DSH_HOME values while preserving strict explicit-home validation. Implements the AC-1 boundary in docs/specs/2026-08-18-93-deepseek-harness-session-evidence.md for QoderAI#93 and was validated by the focused regression plus the full DSH discovery owner.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Allow the pinned rc.8 JSON value domain only for unknown events explicitly marked ignorable, while keeping every known event payload on its strict object schema and omitting unknown payloads from normalized evidence. Implements the AC-7 boundary in docs/specs/2026-08-18-93-deepseek-harness-session-evidence.md for QoderAI#93 and was validated by the focused six-class regression plus the full DSH discovery owner.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Project only events at or beyond the pinned seedLength boundary after the complete artifact has passed decoding, relationship validation, and surface folding. The all-seed, mixed, and malformed-prefix regression preserves lineage without double-counting parent prompts, usage, tools, or outcomes. Implements the AC-6 provenance boundary in docs/specs/2026-08-18-93-deepseek-harness-session-evidence.md for QoderAI#93 and was validated by the focused provider regression, the full provider owner, and core-facts aggregation tests.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Match pinned rc.8 directory discovery by refusing project and session symlinks, then verify every candidate artifact realpath remains within the canonical configured sessions root before reading it. Escape cases are skipped without exposing external paths. Implements the AC-2 source-boundary contract in docs/specs/2026-08-18-93-deepseek-harness-session-evidence.md for QoderAI#93 and was validated by the focused two-level symlink regression plus the full DSH discovery owner.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Preserve contiguous raw JSONL rows when an uncommitted suffix is torn or malformed, while rejecting corruption proven committed by a later turn boundary. Recover complete Zstd frames across systematic final-frame truncations and keep complete checksum or structural corruption fail-closed.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Partition lifecycle groups when a reused stable invocation id opens again after its prior post/result boundary. This preserves sequential occurrences through shared deduplication and tool tracing without changing provider-native identifiers.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Align the Issue QoderAI#93 specification and adapter matrices with the audited RC7/RC8 format-0 slice, including the independently tested persistence, discovery, ownership, outcome, and lifecycle contracts. Keep all unavailable host and persistence capabilities explicit.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Extend the QoderAI#93 regressions in docs/specs/2026-08-18-93-deepseek-harness-session-evidence.md with falsy JSON values and a seed boundary that splits a valid tool lifecycle. The focused discovery and provider owners passed without production changes.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Keep the historical RC7 links for QoderAI#93 while binding RC8-only and requalified contracts to their exact owners at 141eb6fef83422698aef7a981029e843e8161534 in docs/specs/2026-08-18-93-deepseek-harness-session-evidence.md. All seven fixed URLs returned 200 and the documentation link graph passed.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Windows file identities can exceed JavaScript safe integer precision. Use full-width filesystem stats for the existing before/open identity comparison so distinct files cannot compare equal through Number precision loss.

When inode identity is unavailable, retain the conservative metadata fallback with exact nanosecond timestamps. This hardens the existing fail-closed swap check; it does not claim to eliminate all filesystem TOCTOU races.

Validated with the Node 22.20 secret-scan and agent suites, the bounded full repository suite, generated checks, workspace tests, and package verification.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Repeated native invocation IDs are legal after a prior lifecycle closes. Lifecycle deduplication previously sorted by timestamp before occurrence partitioning, so non-monotonic timestamps could reorder two valid occurrences and collapse them into one.

Partition lifecycle occurrences using stable provider/native order while preserving timestamps for duration evidence and final presentation. Implements QoderAI#93 AC-6 in docs/specs/2026-08-18-93-deepseek-harness-session-evidence.md and was validated by focused lifecycle and DSH suites, all session suites, npm test -- --maxWorkers=4, and package verification.

Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants