Skip to content

Add reliability gate manifest - #7001

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-terminal-reliability
Jul 4, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-terminal-reliability

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a reliability gate implementation plan for the recent terminal/session reliability work
  • add config/reliability-gates.jsonc, a checked-in registry of reliability invariants, owners, maturity, commands, budgets, gaps, and promotion criteria
  • add a manifest validator and wire it into lint so the registry cannot drift silently

Why We Need This

The recent terminal, tab, provider-session, startup, and performance regressions cut across several parts of the app. A normal test file can prove one behavior, but it does not tell future reviewers which outage class it protects, whether the coverage is mature, who owns it, or what gaps remain. This PR creates that shared reliability map so future PRs can be reviewed against named invariants instead of tribal memory.

What This Actually Does

This PR does not replace normal tests and the manifest is not the test runner. The manifest is the map that tells reviewers and factory agents which reliability promise a test protects, who owns it, when to run it, how mature it is, and what evidence is still missing before it can block merges.

A regular test can say "this behavior passes today." The manifest adds the missing operational context: "this test protects stale terminal snapshot teardown," "this one protects provider-session replay ownership," "this gate is only soaking," and "this gap still needs Electron or provider-contract coverage."

The validator checks the structure of that registry: every gate must declare its invariant, command/test files where applicable, owner, maturity, runtime budget, flake/red-green evidence status, known gaps, promotion criteria, and demotion rule. That makes reliability coverage visible and reviewable instead of scattered across anonymous test files.

Stack Order

This stack is intentionally split so the registry lands first, then each reliability class gets its own focused gate.

  1. Add reliability gate manifest #7001 adds the reliability gate registry and validator. It creates the place where reliability promises are named, owned, matured, and tied to commands. It does not itself prove every terminal/session behavior; it makes the proof plan explicit and machine-checkable.

  2. Contain xterm addon failures to terminal panes #7004 adds the xterm addon containment gate. It proves failures in terminal add-ons such as search decorations, link handling, and WebGL fallback stay scoped to that pane/add-on instead of taking down the whole terminal surface.

  3. Add terminal snapshot freshness contract gate #7005 adds the terminal snapshot freshness gate. It proves an old liveness answer cannot close a newer PTY binding that appeared after the liveness check started.

  4. Prove visible terminal size convergence #7006 adds the terminal geometry convergence gate. It proves visible terminal sizing can recover from bad first measurements, hidden-to-visible layout timing, and dropped provider size application without unbounded resize loops.

  5. Add persisted session upgrade fixture gate #7007 adds the persisted-session upgrade fixture gate. It proves an older saved workspace/session shape can hydrate through the current schema/store path without blank replacement tabs, duplicate tabs, lost wake hints, or eager startup spawning.

  6. Expand provider session replay ownership gate #7008 adds the provider session ownership/replay gate. It proves workspace activation does not replay an agent/provider session that is already owned, queued, pending, or live in that workspace.

Product Code vs Gate Coverage

Most of the stack is reliability gate coverage: manifest entries, deterministic harnesses, and fixtures that make recent regression classes visible in CI and review. Two child PRs also include targeted product hardening:

The other child PRs are primarily gate/test additions around behavior that already exists or known gaps we want to track:

Tests In This Stack

This foundation PR registers the first reliability gates and validates the registry. Some registered gates point at existing targeted tests; the child PRs add or strengthen the behavioral tests that make those gates useful:

So this PR is the reliability gate registry and validator; the stacked PRs are where the first concrete regression gates are added or expanded.

ELI5

We keep having similar reliability bugs because we do not always turn the lesson from one escape into a repeatable check. This PR creates the checklist and checker for those lessons: each risky area gets a named rule, an owner, the command that proves it, and a note about what evidence is still missing before it can block merges.

Merge Order

Merge this PR first. It is the foundation branch for the reliability-gate stack and the child PRs are currently based on it.

After this merges, merge or retarget the child PRs on top of main:

The child PRs are intended to be independently reviewable after this foundation lands. If more than one child touches config/reliability-gates.jsonc, later child PRs may need a normal rebase/retarget conflict fix after earlier children merge.

Why These Tests Stay Useful

  • Right layer: this PR intentionally adds a manifest validator, not a broad Electron test. The behavior under test is the reliability registry itself: every gate must declare its invariant, oracle, owner, command or accepted gap, maturity, runtime budget, flake status, red/green evidence, promotion criteria, and demotion rule.
  • Stable oracle: the validator is pure Node/Vitest coverage over checked-in JSONC metadata. It does not depend on Electron timing, shared profiles, network state, ports, screenshots, or platform-specific UI behavior.
  • How we know it works: the validator tests fail if required gate fields, maturity values, evidence blocks, or command/test-file relationships drift. pnpm run check:reliability-gates then exercises the same structural contract reviewers and factory agents rely on.
  • Why it stays useful: the manifest does not claim a test is blocking just because it exists. Gates must carry maturity, known gaps, red/green status, runtime budget, flake history, and demotion rules, so future reviewers can distinguish proven coverage from accepted gaps.
  • Anti-flake policy: this PR keeps the registry check cheap and deterministic, while requiring gate-specific PRs to collect soak/runtime/flake evidence before promotion to blocking.

Validation

  • pnpm run check:reliability-gates
  • pnpm exec vitest run --config config/vitest.config.ts config/scripts/check-reliability-gates.test.mjs
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/terminal-dead-session-reconcile.test.ts src/renderer/src/lib/resume-sleeping-agent-session.test.ts
  • git diff --check
  • pnpm exec oxlint config/scripts/check-reliability-gates.mjs config/scripts/check-reliability-gates.test.mjs --quiet

Follow-up Stack

Child PRs add the first concrete harnesses and update this manifest with red/green, flake, runtime, and perf evidence before any gate becomes blocking.

Made with Orca 🐋


Open in Stage

Post-PR Stabilization

  • CI checks pass after the post-push wait.
  • Initial CodeRabbit findings on manifest policy validation and structured errors were fixed in a follow-up commit; the latest CodeRabbit review reports no actionable comments.

@ghost

ghost commented Jul 1, 2026 •

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 4 individual chapters for you:

Title
1 Document reliability pain points and implementation plan
2 Define the reliability gate manifest schema
3 Implement and test the manifest validator
4 Wire manifest validation into linting
Open in Stage

Chapters generated by Stage for commit a642c73 on Jul 1, 2026 8:45am UTC.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Related Issues: Not specified
Related PRs: Not specified
Suggested Labels: documentation, tooling, reliability
Suggested Reviewers: Not specified

Changes

This PR adds a new reliability-gates JSONC manifest, a Node.js validator with tests, a lint script hook, and two reference documents. The manifest defines five gates plus policy thresholds. The validator parses and checks the manifest, including per-gate and policy-level rules, and the test suite covers success and several failure cases. The lint command now runs the new check. The two docs add an implementation plan and a broader reliability pain-points analysis.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant main
  participant jsoncparser as jsonc-parser
  participant Manifest as reliability-gates.jsonc
  CLI->>main: run check:reliability-gates
  main->>Manifest: read file
  main->>jsoncparser: parse manifest
  jsoncparser-->>main: parsed gates or errors
  main->>main: validate schema/gates
  main-->>CLI: exit code 0 or 1
Loading

Estimated Code Review Effort: 3/5

Poem:
A manifest now guards the gate,
With checks for shape and flake-rate fate.
Tests probe paths both sharp and wide,
While docs record the plan inside.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding a reliability gate manifest.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description is detailed and covers summary, rationale, testing, and follow-up, but it omits the template's AI Review Report, Security Audit, Notes, and Screenshots sections.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (5)
docs/reference/reliability-gates-implementation-plan.md (2)

31-31: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional style nit: adverb placement.

"Both gates already have targeted tests" reads fine, but "Both gates have already targeted tests" or "Both gates have targeted tests already" would place the adverb closer to the verb per the style hint. Very minor—feel free to ignore.


55-72: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider acknowledging all manifest maturity levels.

The manifest defines five maturity levels (experimental, soak, blocking, accepted-gap, deprecated), but the doc only discusses the three active promotion states. As the reference implementation plan, a brief note about accepted-gap (intentionally deferred) and deprecated (superseded/removed) would help readers understand the full factory contract without reading the JSONC schema.

config/scripts/check-reliability-gates.mjs (2)

9-9: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

policy block is declared but never validated; maturity list is duplicated instead of derived.

The manifest defines policy.maturityLevels (config/reliability-gates.jsonc line 5) as the source of truth for valid maturities, but the script hardcodes its own MATURITIES set instead of reading from manifest.policy.maturityLevels. main() also never checks that policy exists or that blockingPromotion fields (minimumSoakRuns, minimumSoakDays, maximumUnexplainedFlakes) are well-formed. If the manifest's policy is edited independently, the validator won't catch the drift or malformed policy content.

♻️ Suggested direction
-const MATURITIES = new Set(['experimental', 'soak', 'blocking', 'accepted-gap', 'deprecated'])
+// Derive from manifest.policy.maturityLevels once parsed, instead of hardcoding.

Add a validatePolicy(manifest, failures) helper called from main() that checks manifest.policy is a record, maturityLevels is a non-empty string array, and blockingPromotion fields are finite non-negative numbers — then build MATURITIES from that array for use in validateGate.

Also applies to: 121-141


121-133: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Unguarded fs.readFile surfaces a raw stack trace instead of a structured error.

If the manifest is missing/unreadable, this throws before reaching the script's own error-reporting path (lines 156-161), producing a less useful failure message than the rest of the tool.

🛡️ Suggested fix
   const manifestPath = path.join(root, MANIFEST_PATH)
-  const raw = await fs.readFile(manifestPath, 'utf8')
+  let raw
+  try {
+    raw = await fs.readFile(manifestPath, 'utf8')
+  } catch (error) {
+    console.error(`${MANIFEST_PATH}: unable to read manifest (${error.message})`)
+    return 1
+  }
config/scripts/check-reliability-gates.test.mjs (1)

79-90: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider covering the testFiles-missing and JSONC parse-error branches too.

Current test only exercises the commands half of the soak-maturity check (config/scripts/check-reliability-gates.mjs lines 104-109) and doesn't test malformed JSONC input (mjs lines 126-133).


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d0179236-a053-49c5-a154-fa0d5a600828

📥 Commits

Reviewing files that changed from the base of the PR and between 07bbd44 and f96a48e.

📒 Files selected for processing (6)
  • config/reliability-gates.jsonc
  • config/scripts/check-reliability-gates.mjs
  • config/scripts/check-reliability-gates.test.mjs
  • docs/reference/reliability-gates-implementation-plan.md
  • docs/reference/reliability-pain-points-2026-06-30.md
  • package.json

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.

1 participant