Skip to content

feat: human-readable action logs for GUI harnesses#62

Merged
stephenleo merged 6 commits into
mainfrom
feat/friendly-action-logs
Jul 19, 2026
Merged

feat: human-readable action logs for GUI harnesses#62
stephenleo merged 6 commits into
mainfrom
feat/friendly-action-logs

Conversation

@stephenleo

Copy link
Copy Markdown
Owner

Summary

Running openmicro codex-app, every button press logged the raw osascript payload ("key down control / key code 46") — gibberish to an end user. Logs now show the physical button pressed (named per pad family) and the action it executes:

● triangle → push-to-talk
● right stick flick right → thinking depth up
● R3 → send ctrl+shift+m
● d-pad up → send up arrow

Changes

  • src/labels.ts (new): controlLabel maps logical controls to physical names per controller family (cross/circle/square/triangle for DualSense/DS4, A/B/X/Y for Xbox/GameSir/generic) and actionLabel describes actions, decoding keys bindings (arrows, ctrl chars, CSI-u chords) into readable key names.
  • src/router.ts: LayerRouter.lastControl exposes the ControlId matched by the last successful route(), so stick-gesture actions are nameable at the cli.
  • src/cli.ts: track the connected pad type, announce each dispatched action via guiStatus, and drop the raw payload dump.

Testing

  • New test/labels.test.ts (6 tests) covering per-family face names, stick gestures, and keys decoding.
  • Full gate: typecheck, lint, format:check, 261 tests — all pass.

🤖 Generated with Claude Code

stephenleo and others added 2 commits July 19, 2026 21:03
Replace the raw osascript payload dump ("key down control / key code 46")
with one status line per routed action showing the physical control name
per pad family and the action it triggers, e.g.:

  ● triangle → push-to-talk
  ● right stick flick right → thinking depth up
  ● R3 → send ctrl+shift+m

- src/labels.ts: controlLabel (PlayStation vs ABXY face names) and
  actionLabel (decodes keys bindings: arrows, ctrl chars, CSI-u chords)
- LayerRouter.lastControl exposes the matched ControlId so stick
  gestures are nameable at the cli
- cli tracks the connected pad type and announces each dispatched action

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A chord whose 'key up' never lands (failed/timed-out osascript, process
exit mid-dictation-hold, two chords interleaving) left Control/Shift/D
stuck for the whole machine — clicks became right-clicks and typing broke
until reboot.

- serialize osascript runs through a queue with a 5s timeout so chords
  can never interleave
- on a failed key-down chord, synchronously release every key the
  harness can hold (control/option/shift/command/"d")
- Harness.dispose(): GUI shutdown (Ctrl+C/SIGTERM) now releases all
  held keys instead of a no-op

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@stephenleo

Copy link
Copy Markdown
Owner Author

Follow-up commit 392f82e: fixes the system-wide stuck-modifier hazard (Ctrl stuck → left click acts as right click, keyboard unusable until reboot).

Root cause was not the logging change — synthetic key down events are machine-wide, and three paths could leave them unbalanced:

  1. push_to_talk holds Ctrl+Shift+D by design; process exit mid-hold stranded it
  2. concurrent osascript chords could interleave their down/up steps
  3. a failed/hung osascript left key down without its key up, with no recovery

Fix: osascript runs are serialized through a queue with a 5s timeout; any failed key-down chord triggers a synchronous release of every key the harness can hold; and Harness.dispose() releases all keys on Ctrl+C/SIGTERM. 4 new tests.

stephenleo and others added 4 commits July 19, 2026 21:30
- logs show ✕ ○ □ △ instead of cross/circle/square/triangle
- push_to_talk is now hold-to-talk in GUI mode: the cli forwards both
  button edges (action.pressed), the harness maps down→hold chord,
  up→release chord — replacing the press-to-start/press-to-stop toggle
  and its desync-prone module state

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@stephenleo
stephenleo merged commit 5d1192b into main Jul 19, 2026
2 checks passed
@stephenleo
stephenleo deleted the feat/friendly-action-logs branch July 19, 2026 13:37
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