Skip to content

docs(desktop): state runtime takeover acceptance - #5457

Closed
lee3Q wants to merge 1 commit into
lidge-jun:devfrom
lee3Q:contrib/desktop-runtime-acceptance-20260921
Closed

lee3Q wants to merge 1 commit into
lidge-jun:devfrom
lee3Q:contrib/desktop-runtime-acceptance-20260921

Conversation

@lee3Q

@lee3Q lee3Q commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

User problem

Desktop runtime takeover and consent reuse have implementation contracts, but the release acceptance conditions were not stated in one place for review.

Change

  • Add concise desktop runtime ownership acceptance conditions for consent reuse, re-ask/refusal, handback release, and guest-only attachment to old package-owned registrations.
  • Add source/doc contract tests that pin the acceptance text to the existing ownership preservation, revalidation, release, unreadable-record, and compatibility code paths.

Verification

  • bun test tests/clients/desktop-install-identity.test.ts

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • Documentation

    • Documented desktop consent ownership behavior across relaunches, package updates, and service repairs.
    • Clarified when existing consent can be reused and when users must provide consent again.
    • Documented how uninstall, handback, unreadable records, and legacy package registrations affect ownership.
  • Tests

    • Added coverage for consent preservation, ownership release, subject validation, and compatibility checks.
    • Added verification for handling mismatched installation identities, ownership details, consent generations, and unsupported protocols.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 21, 2026
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c090da91-67e1-4aeb-bf88-d10aeb9adeb2

📥 Commits

Reviewing files that changed from the base of the PR and between 52acf81 and 8ed7916.

📒 Files selected for processing (2)
  • structure/desktop-shell.md
  • tests/clients/desktop-install-identity.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change documents desktop runtime ownership acceptance rules and adds tests for consent preservation, ownership subject validation, and compatibility checks for older package-owned registrations.

Changes

Desktop ownership acceptance

Layer / File(s) Summary
Acceptance contract documentation
structure/desktop-shell.md, tests/clients/desktop-install-identity.test.ts
The desktop shell contract defines when consent is reused, when it must be requested again, how handback preserves the generation ceiling, and when an old registration remains guest-only. Tests verify the documented boundaries.
Ownership state and compatibility validation
tests/clients/desktop-install-identity.test.ts
Tests verify that consent survives state writes and ownership release, that recordServiceOwner validates owner, installId, and consentGeneration, and that unsupported package-owned registrations are rejected.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the documentation change and the runtime takeover acceptance conditions described in the pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

4/4 boxes ticked.

This pull request is already Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers: @lidge-jun @Ingwannu

@github-actions
github-actions Bot marked this pull request as draft September 21, 2026 11:01
@lee3Q
lee3Q marked this pull request as ready for review September 21, 2026 11:02
@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 46 / 80

이 PR은 데스크톱이 이미 켜져 있는 프로그램을 넘겨받을 때, 예전에 받은 동의를 그대로 써도 되는 규칙을 한곳에 적습니다. 돌아가는 코드는 바꾸지 않습니다. structure/desktop-shell.md에 짧은 합격 문단을 넣고, tests/clients/desktop-install-identity.test.ts가 그 문장과 서비스 함수 안의 글자가 파일에 있는지만 확인합니다.

같은 설치를 다시 켜면, 기록된 주인과 설치 번호가 같을 때 동의를 다시 묻지 않는다고 합니다. 패키지를 고치거나 서비스를 수리해도 그 동의를 지우지 말아야 합니다. 주인이 다르거나, 설치 번호가 다르거나, 동의에 붙는 번호(consentGeneration)가 바뀌었거나, 기록을 읽지 못하면 다시 묻거나, 쓰기 전에 거절해야 한다고 적습니다. 지우기나 돌려주기는 지금 주인만 지우고, 그 번호의 최고점은 남깁니다. 예전 패키지가 등록한 서비스는, 소유를 아는 CLI가 표시를 남길 때까지 손님으로만 붙을 수 있다고 합니다.

structure/desktop-shell.md:149 - 동의 번호가 바뀌면 재사용이 아니라고 했는데, 다시 켤 때 쓰는 비교는 그 번호를 보지 않습니다. ownershipGrantedTo와 데스크톱 granted_to는 주인과 설치 번호만 봅니다. 같은 설치면 번호가 올라가도 Consent::Held입니다. ownership.rs의 테스트도 세대 번호는 비교에 넣지 않는다고 고정해 두었습니다. 번호가 달라서 거절하는 곳은 동의를 파일에 적을 때의 sameServiceOwnershipSubject입니다. 다시 켜기 규칙과 쓰기 잠금이 한 문장에 붙어 있습니다.

structure/desktop-shell.md:148 - 수리와 업데이트가 승인된 대상이 그대로일 때만 동의를 지킨다고 했습니다. writeServiceInstallState는 대상을 확인하지 않습니다. preservedConsent로 적혀 있는 주인을 항상 복사합니다.

structure/desktop-shell.md:153 - 이 문서 앞부분에서 손님은, 이미 살아있는 프로그램에 붙고 새로 켜지 않는다는 뜻입니다. 이번 문단의 손님은 assessServiceTakeoverCompatibilityservice-protocol-unsupported로 영구 인수를 막는 경우입니다. 그 함수는 손님 붙기를 돌려주지 않습니다.

tests/clients/desktop-install-identity.test.ts:132 - 테스트는 문장과 소스 글자만 찾습니다. 데스크톱 consent가 동의 번호를 무시하는지는 보지 않습니다. 합격 문단이 코드와 달라도 이 테스트는 통과합니다.

메인테이너의 판단이 필요한 지점
이 문단을 지금 동작의 합격 조건으로 고정할지입니다. 바로 위 문장은 묶인 CLI의 resolve가 아직 비어 있어서, 셸은 인수를 시도하지 않는다고 말합니다.

너의 추천
동의 번호 문장을 둘로 나누세요. 다시 켜서 동의를 그대로 쓰는 조건은 주인과 설치 번호입니다. 파일에 새로 적을 때는 승인 당시의 동의 번호와 같아야 합니다. 수리 문장에서 승인된 대상이 그대로일 때라는 조건은 빼세요. 프로토콜 표시가 없는 옛 등록은 영구 인수를 열지 않는다고 적으세요. 그다음 테스트는 글자 검색 대신 그 두 비교를 직접 확인하게 하세요.

이 댓글은 grok-bot이 작성했습니다

lidge-jun added a commit that referenced this pull request Sep 23, 2026
… fixes (#5619)

* fix(cursor): bound capability reads and buffered tool budgets (#5533)

Carries #5533 (and the closed #5233 it consolidates) onto current dev.

Co-authored-by: Epinephrine <luvs01@hanmail.net>

* fix(moonshot): bound normalized tool-schema expansion (#5547)

Carries #5547, which consolidates #5464 and the request-wide inline budget, onto current dev.

Co-authored-by: yeongjunyoo <47925973+yeongjunyoo@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Epinephrine <luvs01@hanmail.net>

* fix(moonshot): restore rejected inline budgets and charge nested growth once

A rejected sibling-reference expansion now restores the byte, node and expansion allowances it consumed, and outer growth no longer re-charges nested copies, so later independent expansions in the same request keep their allowance. Documents the provider-driven object type inference as a deliberate tradeoff and rewrites ADR-0355 in English.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* feat(reasoning): consolidate replay, opt-in tag parsing, and summary policy (#5566)

Carries #5566, which consolidates #5449, #5205 and #5491, onto current dev. The provider guide keeps the current bridge replay paragraph and adds the inline-tag and summary paragraphs.

Co-authored-by: Joonsuh Park <trckstr4422@gmail.com>
Co-authored-by: Daniel Sjöstrand <16033062+Danielsjostrand1979@users.noreply.github.com>
Co-authored-by: alexph-dev <alexph-dev@users.noreply.github.com>
Co-authored-by: Yum-wu <1172989563@qq.com>

* fix: bound Fernet slot runs, Kiro error-body read, and skill-path line slice (#5310)

Carries #5310 onto current dev. The follow-up commit makes the Fernet run cap fail closed and moves the Kiro regression out of the capped stream suite.

* docs(reasoning): reconcile inline-tag whitespace contract

Interleaved inline-tag parsing preserves answer whitespace; only Kiro single-block mode drops the whitespace after its leading block.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(responses): fail closed on Fernet run overflow and keep the Kiro suite under its cap

A slot with more than 64 structurally valid Fernet runs is now treated as unreadable or omitted as a whole, so no unexamined tail reaches the provider as text. The bounded Kiro fallback error-body regression moves byte for byte into a registered sibling file, and the Kiro, Responses and inbound contracts document the new bounds.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(reasoning): scan inline think tags with a moving cursor

The parser copied, rescanned and reserved the whole remaining response after every block, so one upstream chunk carrying many short blocks cost quadratic work. It now scans each chunk from an offset and charges the translator budget only for retained carry: undecided leading input or a trailing tag fragment.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(reasoning): keep undecided leading whitespace incremental

Before the format was decided, every content delta rebuilt, trimmed and re-reserved the whole leading prefix, so a stream of one-character whitespace deltas cost quadratic work. Leading whitespace is now kept in segments whose bytes are reserved once and joined only when the format is decided or the stream flushes.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(meta-muse): consolidate login admission and bounded response handling (#5591)

Carries #5591, which consolidates the closed #5234 and #5432, onto current dev. The provider contract keeps the inline-tag paragraph and adds the Meta Muse admission paragraph.

Co-authored-by: Epinephrine <luvs01@hanmail.net>

* fix(claude-desktop): keep applied state consistent across profile edits (#5590)

Carries #5590, which consolidates the closed #5337, onto current dev.

Co-authored-by: Epinephrine <luvs01@hanmail.net>
Co-authored-by: luvs01 <luvs01@users.noreply.github.com>

* fix(claude-desktop): commit applied markers only over the observed baseline

Both Desktop writers, provider-change auto-apply and client sync, now capture the desired profile and its applied marker before the Desktop write and commit the new marker only if profile presence, content, fingerprint and timestamp are unchanged. A concurrent edit, deletion or newer marker keeps its state and the write reports a skipped marker. The provider-change path no longer saves a whole stale config snapshot.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(claude-desktop): commit profile edits against the persisted marker

The Desktop profile PUT built its response from an earlier snapshot and saved that whole snapshot, so a marker committed by another writer during the awaited state build could be replaced by an older one. The edit now commits in one persisted-config mutation that keeps the latest marker for unchanged content and answers 409 when the profile itself changed meanwhile. The Meta Muse overflow test now asserts that the bounded-body limit, not a generic failure, produced the error.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(claude-desktop): report an unreadable config separately from an edit conflict

A missing or invalid config now answers 500 with its reason; only a concurrent profile change or exhausted rebase answers 409.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* feat(desktop): consolidate consent-based runtime takeover and ownership contracts (#5564)

Carries #5564, which consolidates #5459 and #5457, onto current dev. The review screenshot stays in the pull request description rather than the tree.

Co-authored-by: jun <bitkyc08@gmail.com>
Co-authored-by: sanggyulee <andy53295774@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(desktop): bind takeover stop to the approved runtime and fail closed

Desktop takeover re-resolves ownership immediately before stopping and passes the approved PID, endpoint, config home, CLI version and compatibility token to an opt-in guarded stop. The guard is checked under the ownership mutation lease before any manager or signal stop; the approved PID and endpoint must settle and the service manager must then be proven inactive, otherwise the stop answers approval-changed or manager-still-active and the desktop neither waits for silence nor claims. Unreadable or unparseable stop output is terminal as well. A second unreadable service-state read now blocks takeover, Windows managing-CLI discovery follows PATHEXT with file-only candidates and refuses command-interpreter metacharacters, the claim refusal test uses real sandbox state, and the runtime and desktop contracts record that the claim token is a consistency check rather than consent proof. Plain ocx stop is unchanged.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(desktop): keep plain stop entry points and format the takeover changes

Desktop exit keeps its plain runtime_stop::run entry while takeover uses run_approved, AttachPlan::Ask no longer carries an unread field, the Rust changes follow rustfmt, the plain CLI stop path keeps its literal outcome return, the stop source oracles follow the reader and outcome union that now include the two guarded refusals, and the runtime contract fits its 600-line budget.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(desktop): run takeover seam tests without tokio macros and harden manager and shim checks

The two async takeover seam tests now run on the shell runtime already used by the crate instead of tokio test macros, which this crate does not enable. Windows command-shim probes refuse command-interpreter metacharacters in every recorded argument as well as the executable, and the guarded stop re-inspects the service manager identity immediately before the manager command, answering approval-changed without stopping if it moved.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(responses): keep effort-based reasoning visible after routing

Final-route normalization recomputed hideThinkingSummary without the validated active-effort condition, so routed Chat and Kiro requests with an active effort and an omitted summary still hid raw reasoning. It now uses the same predicate as the parser; explicit "none" and requests without an active effort stay hidden.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(service): match the running CLI case-insensitively only on Windows

On case-sensitive filesystems a PATH executable that differs only in case is a different file, so it must get its own version probe instead of reporting the running CLI version.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(meta-muse): require the dashboard session for manual login codes

The manual-code continuation now applies the same dashboard-session admission as the login start, so a management token cannot advance a pending Meta Muse login.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(reasoning): reserve the joined leading-whitespace copy

Joining retained leading whitespace allocated a second copy outside the translator budget; the join is now reserved first and released once the segments are cleared.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(service): skip CLI probes for an absent runtime and treat failed systemd units as stopped

Resolve no longer spawns managing-CLI version probes when no runtime is live, since takeover is only offered for a live runtime. A systemd unit reported failed with no main PID is stopped, so a guarded stop that leaves it failed succeeds and a leftover failed unit does not block takeover.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(service): keep failed systemd units fail-closed and assess takeover only for a live runtime in tests

systemd can report failed before an automatic restart, so failed with no main PID is again treated as unknown rather than stopped. The resolve contract tests that assert ownership and takeover fields now use a live runtime, matching the skip of managing-CLI probes when no runtime is live.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

---------

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
Co-authored-by: Epinephrine <luvs01@hanmail.net>
Co-authored-by: yeongjunyoo <47925973+yeongjunyoo@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joonsuh Park <trckstr4422@gmail.com>
Co-authored-by: Daniel Sjöstrand <16033062+Danielsjostrand1979@users.noreply.github.com>
Co-authored-by: alexph-dev <alexph-dev@users.noreply.github.com>
Co-authored-by: Yum-wu <1172989563@qq.com>
Co-authored-by: luvs01 <luvs01@users.noreply.github.com>
Co-authored-by: sanggyulee <andy53295774@gmail.com>
@lidge-jun

Copy link
Copy Markdown
Owner

Closing as superseded. The changes from this PR (head 8ed791675d62, by @lee3Q) were carried with credit into #5564, which was consolidated into #5619. #5619 merged to dev as e964387. The carry was reimplemented as a squash with review repairs, not merged, so this branch's own commit history is not part of dev. I compared this head against current dev and found its behavior present, in some cases in revised form. The runtime-takeover ownership and consent contract is now documented in structure/desktop-shell.md. This supersedes the documentation change only. It does not assert that real installed-platform takeover has been accepted.

This is on dev only. It is not in the stable v2.63.0 release and will ship in a later release. Thank you for the contribution.

@lidge-jun lidge-jun closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants