Skip to content

chore(daemon): disambiguate audit observations - #12343

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/daemon-audit-observation-correlation
Aug 3, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/daemon-audit-observation-correlation

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add an explicit current / legacy role to daemon_audit_eligibility observations, while dropping invalid or future protocol generations instead of contaminating the legacy cohort.
  • Add a stable, versioned, domain-separated correlation derived from the daemon launch nonce when exact incarnation evidence is available, while emitting none of the raw nonce, PID, start time, Linux ticks, or boot ID.
  • Preserve the existing five-minute identical-observation heartbeat dedupe and its fail-safe telemetry boundary, and block the generic renderer telemetry IPC from spoofing this main-owned event.
  • Scope is audit-only for [Bug]: App updates leave previous daemon generations running forever — invisible agent sessions accumulate and exhaust memory #9138: no daemon lifecycle, routing, containment, shutdown, inventory-authority, SSH, or workspace behavior changes.

Screenshots

No UI changed; Electron regression smoke was run on final head 4294685ed48a611bc538aefef52820d64a6c0848 with an isolated profile. The intended worktree identity matched, the full app shell and Resource Manager rendered with 0 console errors, and pty.management.listSessions() returned {"sessions":[],"degraded":false}.

Orca app shell on PR 12343

Orca Resource Manager on PR 12343

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — the pre-review full run completed with 44,274 passing and 21 unrelated failures, primarily timeout/performance cases while another worktree was concurrently running Vitest; no failure touched this PR's files. The final-head targeted suite and CI shards cover the review fixes.
  • pnpm build
  • pnpm exec oxfmt --check src/main/ipc/telemetry.ts src/main/ipc/telemetry.test.ts src/main/daemon/daemon-audit-eligibility-event.ts src/main/daemon/daemon-audit-eligibility-event.test.ts
  • Added regression coverage for the stable cross-launch test vector, replacement-incarnation separation, current-vs-legacy role, future-protocol fail-closed behavior, renderer spoofing prevention, raw-identity exclusion, schema validation, and exact-incarnation heartbeat dedupe.

Final-head targeted validation: pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/telemetry.test.ts src/main/daemon/daemon-audit-eligibility-event.test.ts src/main/daemon/daemon-incarnation-evidence.test.ts src/main/daemon/daemon-incarnation-evidence-main-thread.test.ts src/main/telemetry/validator.test.ts — 111/111 passed.

AI Review Report

Reviewed the complete #9138 safety plan, PR description, commit history, base-to-head diff, and production path from adapter inventory publication through the strict telemetry schema and renderer IPC boundary. The review verified privacy, stable correlation across fresh tracker instances, replacement-incarnation separation, telemetry failure isolation, heartbeat dedupe/cardinality, and the absence of daemon lifecycle/routing/containment/shutdown behavior; it found and fixed a future protocol being mislabeled as legacy and the generic renderer telemetry IPC being able to spoof the main-owned audit event. The final guards fail closed inside the telemetry boundary, with focused coverage proving that unsupported observations and renderer-originated audit rows are dropped without affecting daemon callers.

Security Audit

No command execution, path handling, authentication, dependency, or secret-handling surface changed. The existing generic renderer telemetry IPC is tightened to reject this main-owned audit event, preventing compromised renderer content from spoofing correlations or inflating its cardinality. The emitted correlation is a 128-bit prefix of a domain-separated SHA-256 digest over the daemon-generated UUID launch nonce; strict schema branches require it only when exact incarnation evidence exists, and tests verify that the raw nonce, PID, start time, Linux start ticks, and boot ID never enter telemetry. Remaining risk is limited to intentional event cardinality—one opaque value per exact daemon incarnation—and historical rows naturally lack the newly added fields.

Notes

This is observation-only groundwork for #9138 and does not merge or enable any containment or retirement policy. Electron validation screenshots and results are included above and in the validation comment.

PR 3 remains blocked until a build containing this correlated observation change reaches real machines through an RC, the restarted soak has enough dead-generation observations with zero gone-then-alive contradictions and per-platform coverage, and Brennan explicitly signs off the gone-proof list.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron validation — final head 4294685ed48a611bc538aefef52820d64a6c0848

Validated the real Orca desktop app from the gurnard worktree with an isolated profile through CDP.

  • App identity: gurnard @ brennanb2025/daemon-audit-observation-correlation
  • Visible result: full shell rendered normally; Resource Manager opened and showed zero terminal sessions; renderer console had 0 errors.
  • Backing result: real pty.management.listSessions() returned {"sessions":[],"degraded":false}.
  • Scope note: this PR has no UI change. The main-owned audit correlation is covered by the focused tests (111/111 passed); contributor dev builds intentionally do not transmit PostHog telemetry, so no live external capture was attempted.

App shell

Orca app shell on PR 12343

Resource Manager inventory

Orca Resource Manager on PR 12343

@brennanb2025
brennanb2025 marked this pull request as ready for review August 3, 2026 21:28
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c13bf56-2329-4006-b9cb-f6628561527c

📥 Commits

Reviewing files that changed from the base of the PR and between e25381c and 4294685.

📒 Files selected for processing (6)
  • src/main/daemon/daemon-audit-eligibility-event.test.ts
  • src/main/daemon/daemon-audit-eligibility-event.ts
  • src/main/ipc/telemetry.test.ts
  • src/main/ipc/telemetry.ts
  • src/shared/daemon-audit-eligibility.ts
  • src/shared/telemetry-events.ts

📝 Walkthrough

Walkthrough

Daemon audit eligibility telemetry now includes current or legacy generation roles and privacy-preserving exact-incarnation correlations. The schema validates available and unavailable incarnation variants separately. Tracker instances cache launch-nonce correlations and retain repeat suppression. Unsupported future protocol generations do not emit telemetry. Renderer-originated daemon audit events are blocked by the IPC handler. Tests cover correlation stability, schema validation, serialized property privacy, future generations, and heartbeat windows.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: disambiguating daemon audit observations.
Description check ✅ Passed The description covers all template sections and explains testing, security review, scope, and validation results; the full-test exception is documented.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

@brennanb2025
brennanb2025 merged commit 13f033f into main Aug 3, 2026
91 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* chore(daemon): disambiguate audit observations

* fix(daemon): reject future audit protocol roles

* fix(telemetry): protect daemon audit observations
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