Skip to content

refactor(reasons): declare the R7 shared reasons in ReasonTable rows - #4976

Merged
thymikee merged 4 commits into
mainfrom
refactor/r7-shared-reasons
Nov 22, 2026
Merged

thymikee merged 4 commits into
mainfrom
refactor/r7-shared-reasons

Conversation

@thymikee

@thymikee thymikee commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

First R7 PR for #4937. It declares reasons that several packages raise as ReasonTable rows, each in the lowest package every producer already loads:

  • contracts: remote_instance_mismatch, app-device-scope, alert-not-found, alert-wait-timeout
  • daemon-contracts: daemon-owner-unrecognized, daemon_retirement_unconfirmed
  • kernel: runtime-contract-invalid, request_canceled (replaces REQUEST_CANCELED_REASON) and keyboard_dismiss_unavailable. Kernel is the only home that grows no eager closure.
  • plugins: invalid_plugin. command-registry: fill_text_stdin_in_batch.
  • Follow-up: sparseFindRefusal moves into selectors/interaction-error. The eager-closure gate passes.

The Apple runner's RUNNER_ERROR_CODES row keeps its keyboard_dismiss_unavailable literal, because the runner refusal docs guard reads only same-file tables there (native mappings belong to R8). The durable outcomes are in #4978; the runtime facts and boot failures follow.

Value

Measure base head
R89 untyped reason sites 58 28
R89 untyped values 21 13
Reason table rows 464 475

Before / after

No observable change; spellings stay byte-identical. The three remote_instance_mismatch wire declarations now read the table, so their ledger digests and acks are re-pinned with a note.

Validation

Head 3eb1b26: typecheck, oxlint, format, generate:reasons, the repo guards, the eager-closure gate, wire-compat, and fallow audit (0 issues) pass. About 4,000 affected tests pass.

🤖 Generated with Claude Code

Declares remote_instance_mismatch, daemon_retirement_unconfirmed,
daemon-owner-unrecognized, runtime-contract-invalid, app-device-scope,
invalid_plugin, request_canceled, fill_text_stdin_in_batch,
keyboard_dismiss_unavailable, alert-not-found and alert-wait-timeout as
ReasonTable rows in the lowest package every producer loads, and moves
sparseFindRefusal beside the selectors interaction reasons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.53 MB 6.53 MB +782 B
Package (unpacked) 6.53 MB 6.53 MB +782 B
Package (download) 1.99 MB 1.99 MB +257 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 18.5 ms 18.7 ms +0.1 ms
CLI --help 40.6 ms 40.0 ms -0.6 ms

@apex-sentinel-staging

This comment has been minimized.

The runner refusal docs guard reads a RUNNER_ERROR_CODES row's reason only
as a literal or a same-file table row; native runner mappings are R8 scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

At 3eb1b26 the new recovery text for a live macOS app session sends the caller to a step that fails again. open-target.ts:6 tells the owner of an app session to open a non-app surface in a new --session. On the same Mac, open --surface desktop selects the whole Mac. The existing app session overlaps it through SessionStore.findByDevice (session-store.ts:220). The fresh open then returns DEVICE_IN_USE (session-open-execution.ts:532, session-recovery-hints.ts:62). The claims test at device-claims-app.test.ts:428 pins that conflict when one daemon owns both requests. A caller who follows the new instruction gets another refusal while the first session stays active. The same text is published under open and close in error-reasons.md:69 and :173. The rule the row must satisfy: opening a different app in a separate session is allowed, but opening a whole-Mac surface needs the sessions that hold app devices on that Mac to end first. Please split the row text along that line, then regenerate the page from the row.

Not blocking, and fine to take or leave: three rows say more than the code does. The Apple keyboard row (errors.ts:457) says no dismiss key was found, but the runner returns the refusal whenever the keyboard is visible and leaves it alone. The remote instance row (daemon-http.ts:145) promises one retry, but the client skips the resend if the health refresh fails, the request is canceled or the time budget ends (daemon-client-transport.ts:497-509). The canceled Revyl row (errors.ts:411) says the device start stopped, but only the caller's wait stops and the submitted start continues (revyl-session.ts:223-245).

The only check not passing is Body rules, which was canceled rather than failed. It validates the PR body and the diff touches no PR-body tooling, so it looks unrelated to the code. The other 21 checks passed at 3eb1b26, including wire-compat and the guards. There are no conflicts. Not verified here: the R89 untyped-site counts (58 to 28, 21 to 13) and the eager-closure gate, which was read from green CI and not re-run. After the docs fix, rerun the canceled Body rules check so CI reports a pass.

app-device-scope separates opening another app from a whole-Mac surface;
request_canceled, keyboard_dismiss_unavailable and remote_instance_mismatch
state only what their producers guarantee.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Addressed in 0d74461 and regenerated error-reasons.md:

  • app-device-scope now splits the recovery: open another app in a separate --session, and open a whole-Mac surface such as --surface desktop only after the sessions holding app devices on that Mac end.
  • keyboard_dismiss_unavailable: the Apple runner leaves a visible keyboard alone and presses nothing.
  • remote_instance_mismatch: the client refreshes health and resends at most once. The reason reaches the caller only when that resend is refused too.
  • request_canceled: the command stops waiting, and a provider device start that was already submitted may keep running.

Wire-compat and the reason-table guard pass. The push re-runs Body rules.

@apex-sentinel-staging

This comment has been minimized.

…asons

* origin/main:
  refactor(types): drop branches and assertions the types already exclude (#4975)
  refactor(reasons): declare the durable capture outcomes in ReasonTable rows (#4978)
  feat(harmonyos): verify foreground after open instead of trusting the launch line (#4293)
  fix(remote): give each session its own saved-connection file (#4925)

# Conflicts:
#	packages/kernel/src/errors.ts
#	src/platform-runtime-gateway.ts
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 7abe6db

Since the review of 0d74461: 0 new · 0 still open · 0 no longer raised

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (098c1780b9e5).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

The findings from the earlier review at 3eb1b26 are fixed at 7abe6db, and no new problems turned up. The change is reason-row comments plus generated docs, and it does not overlap any test route.

One check is still in progress. Wait for it to finish at 7abe6db before merge. No conflicts were reported. Not verified here: the wire-compat, reason-table guard and docs-generation checks were not re-run locally, so those results come from CI and the author's report. Not verified here: the upstream files brought in by the merge (harmonyos, remote, durable capture), which belong to main and not to this PR's patch.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 22, 2026
@thymikee
thymikee merged commit a4f2dca into main Nov 22, 2026
21 checks passed
@thymikee
thymikee deleted the refactor/r7-shared-reasons branch November 22, 2026 20:16
thymikee added a commit that referenced this pull request Nov 22, 2026
* refactor/r7-runtime-facts:
  refactor(reasons): declare the R7 shared reasons in ReasonTable rows (#4976)
thymikee added a commit that referenced this pull request Nov 22, 2026
* refactor/r7-runtime-facts:
  refactor(reasons): declare the R7 shared reasons in ReasonTable rows (#4976)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant