Skip to content

feat(install): P4a recoverable handoff reservation and writer floor 2 - #180

Draft
777genius wants to merge 3 commits into
feat/agent-notify-e2efrom
cursor/uap-installer-p4a-handoff-6c84
Draft

777genius wants to merge 3 commits into
feat/agent-notify-e2efrom
cursor/uap-installer-p4a-handoff-6c84

Conversation

@777genius

@777genius 777genius commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Stacked on #177 (feat/agent-notify-e2e @ 89d8524). This is P4a only from the UAP installer SDK + notification wizard plan: kernel reservation/intent/floor guard. Default installer routing is unchanged. Do not merge this into #177; keep it as a child PR.

What landed

  • Kernel PendingMutation reservation published in the same recoverable transaction as host-owned portable-handoff.json.
  • Reservation is required before retiring owned direct MCP/skill; unmatched writers get ErrReservationConflict.
  • Transaction schema 3 + writer floor 2 for reservation start/change/cleanup/reverse. Ordinary installs stay schema 2 / floor 1 / managed-writer protocol v1.
  • Floor and schema 3 are never lowered on cleanup or rollback.
  • Frozen v1 decoder/floor checks reject schema 3 journals and floor 2 ledgers.
  • Coordinator process lease (.setup-coordinator.lock) serializes confirmed handoff/resume. Death releases the lease; the persisted reservation remains.
  • Recovery-only Recover() / Commit(RecoverOnly) replays a pending journal and returns without refresh, install, or a new consumer.
  • Policy-only disable still works on an intact reserved ledger; an open kernel journal still returns ErrPolicyRecovery.
  • Kernel does not import portablesetup or UAP types and does not parse intent JSON.
  • No-op handoff does not create intent and does not raise the writer floor.
  • Current portable locator and setup qualification accept floor 2 so a completed handoff can still launch.

Tests (no Claude/Codex login)

go test ./internal/installruntime/ ./internal/agentnotify/portablesetup/ ./internal/agentnotify/clientsetup/ ./internal/agentnotify/portable/ ./internal/agentnotify/setup/ -count=1

TestRecoverOnlyReplaysJournalWithoutConsumer compares recovered RuntimeRoot through CanonicalPath. TestAgentNotifyProcessBlockedMCP/signal treats SIGTERM as a successful join, using a positive join predicate that satisfies staticcheck QF1001.

Not in this PR (later plan checkpoints)

  • P1–P3, P5: public UAP installer API in the UAP repo.
  • P4: Notifications portable adapter pin onto that API.
  • P6: setup-notifications wizard.
  • R3: cross-platform native client E2E.

Plan acceptance for P4a

Reservation blocks conflicting replace/register; intent+reservation are published atomically through the existing transaction; schema 3 + floor 2; old writer rejects pending start/cleanup/reverse; floor is not lowered; coordinator lease; recovery-only kernel entry; no second journal engine.

Open in Web Open in Cursor 

Publish host intent plus a kernel-owned PendingMutation before retiring
owned direct MCP, raise transaction schema 3 / writer floor 2 for that
transition, and keep the floor after cleanup or rollback. Ordinary
installs stay on protocol v1. Coordinators take a process lease and
replay journals through a recovery-only Commit entry.

Co-authored-by: Илия <iliyazelenkog@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.60606% with 130 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.18%. Comparing base (89d8524) to head (e29dbd1).

Files with missing lines Patch % Lines
internal/agentnotify/portablesetup/setup.go 60.38% 34 Missing and 27 partials ⚠️
internal/agentnotify/portablesetup/uap.go 17.07% 29 Missing and 5 partials ⚠️
internal/installruntime/reservation.go 74.69% 12 Missing and 9 partials ⚠️
internal/agentnotify/portablesetup/intent.go 62.50% 3 Missing and 3 partials ⚠️
internal/installruntime/recovery.go 66.66% 2 Missing and 2 partials ⚠️
internal/installruntime/transaction.go 84.21% 1 Missing and 2 partials ⚠️
internal/agentnotify/setup/setup.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##           feat/agent-notify-e2e     #180      +/-   ##
=========================================================
- Coverage                  65.27%   65.18%   -0.09%     
=========================================================
  Files                        168      170       +2     
  Lines                      17182    17474     +292     
=========================================================
+ Hits                       11215    11391     +176     
- Misses                      4360     4432      +72     
- Partials                    1607     1651      +44     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cursoragent and others added 2 commits September 14, 2026 15:39
macOS and Windows CI failed Recover-only replay because the ledger stores
EvalSymlinks/long-path roots while t.TempDir() still holds the uncanonical
path. Accept SIGTERM as a successful blocked-MCP join on Darwin.

Co-authored-by: Илия <iliyazelenkog@gmail.com>
Rewrite the SIGTERM-or-exit-2 check as a positive join predicate so
golangci-lint staticcheck no longer flags De Morgan's law.

Co-authored-by: Илия <iliyazelenkog@gmail.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