Repository navigation
Driverless media keys, part 1: the session posts them (phase 6) - #1325
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ceab8c3d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // their own ledger so a stop releases them too. | ||
| var nextOutputs = outputs | ||
| guard let media = try nextOutputs.translateMedia(event) else { continue } | ||
| if media.isDown { outputs = nextOutputs; writeReport(.running) } |
There was a problem hiding this comment.
Persist held media usages in the crash ledger
When the worker crashes or is force-terminated while a media key is held, this writes a report after recording the media down, but writeReport serializes only outputs.heldUsages; recoverSessionOutputs likewise releases only report.heldOutputUsages. Because macOS repeats a posted media down until it receives an up, the missing media ledger can leave volume or brightness continuously changing after the worker dies. Include held consumer usages in SessionRuntimeReport and have the parent recovery path post their system-defined up events.
Useful? React with 👍 / 👎.
The bridge's output rule accepts the ten consumer-page keys the worker can post (volume up/down/mute, brightness up/down, play/pause, next/previous, fast-forward/rewind), a fixed table in session_config.rs. The worker keeps a media ledger beside its key ledger and posts each as an NSEvent system-defined (subtype 8) event tagged like a key event, dropping Kanata's repeats because macOS repeats a held media key itself; cleanup releases held media keys like keys. Because the capability profile asks the bridge, the catalog's Function layer, media mode of macOS Function Keys and the eight media system actions became available with no Swift change; the hard-coded refusals remain only as the no-bridge fallback. Inputs stay keyboard-page until part 2 (tap reads system-defined events). Tests that used a media key as their "unsupported output" fixture now use Fn, which the generator passes through and the bridge refuses. See docs/architecture/rules-admission-review.md §4.5 and docs/architecture/driverless-media-keys.md. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
9ceab8c to
7f8be46
Compare
|
Review of #1325 (media keys as session outputs): no blocking findings. I checked the NX key types in Minor notes, none blocking:
|
Phase 6, part 1 (review §4.5; measurements in driverless-media-keys.md).
What
oscode_supportedaccepts page-7 keys in the host's map or the ten consumer-page codes inCONSUMER_OUTPUT_CODES(volume up/down/mute, brightness up/down, play/pause, next/previous, fast-forward/rewind). The table is a constant — what can be posted is fixed by the worker's code, not the keyboard. Inputs stay keyboard-page until part 2.SessionOutputStategains a media ledger (translateMedia,heldMediaUsages,releaseAllMedia; value 2 dropped since macOS repeats a held media key itself).SessionRuntimeWorker.postMediabuildsNSEvent.otherEvent(.systemDefined, subtype 8, data1: keyType << 16 | 0xA/0xB << 8)fromSessionKeyMap.consumerUsageToMediaKeyType, tags it with the worker's output tag and posts it at the session tap; cleanup releases held media keys like keys.QMKKeycodeMapping21/22 comment now says illumination, not brightness.Tests
calcrefused).SessionOutputStateTestsmedia cases (translation, repeat drop, cleanup, event encoding); profile/catalog/system-action goldens flipped;SessionBridgeTestFixture.profileso admission tests don't depend on an installed app's bridge; tests that used a media key as the "unsupported output" fixture now usefn.KEYPATH_TEST_ENFORCE_CLEAN_SUMMARY=1 Scripts/run-tests-safe.sh: 5,780 passed, 0 app warnings/errors, 0 build warnings.check-accessibility.pyclean.Still to do on hardware (Air)
F10/F11/F12 and brightness from a rule; held-repeat;
keypath doctorshowing no media verdicts.🤖 Generated with Claude Code