Prioritize Remote heartbeats across all reader operations

This commit is contained in:
ak47 committed 2026-11-06 19:01:25 -05:00
1 parent e724c503d0
commit d7da6548e1
4 files changed
+72 -41

No files matched your search

+26 -23
View File
@@ -40,9 +40,9 @@ Implemented:
profiles, modifier-side and keypad distinctions, and constant errors for
unsupported or ambiguous keys. An epoch-bound outgoing encoder retains the
original mapping through repeats/releases, bounds held keys and preserves
failed-write cleanup with sequence-checked acknowledgements. Capture,
injection, AltGr and native layout/held-key ownership remain pending; these
are library prerequisites, not keyboard control. See [keyboard.md](keyboard.md).
failed-write cleanup with sequence-checked acknowledgements. The mapper is
attached to production capture and injection; physical layout and AltGr
acceptance remain unverified. See [keyboard.md](keyboard.md).
- Braille, approved per session: a controlled computer exports its Braille at
the controller's display width; a controller shows it and sends pan and
routing keys. Physical display acceptance is pending. See
@@ -59,28 +59,29 @@ Implemented:
through `remote.key`. Live acceptance is pending.
- Typed reader `remote.key` IPC, Go/Python validation and a bounded incoming-key
mailbox now have real-process SDK checks. The external bridge converts every
supported canonical mapping to the public SDK representation. No production
input owner is attached and the coordinator still discards keys; keyboard
control remains unavailable. See [the reader contract](../../cthulhu/docs/tentacle-remote-keyboard.md).
supported canonical mapping to the public SDK representation. The production
input owner consumes approved controlled-role keys. See
[the reader contract](../../cthulhu/docs/tentacle-remote-keyboard.md).
- A quarantined reader destination ledger/backend now preserves native keycodes
through layout/Num Lock changes and retains failed cleanup for retry, with
private Xvfb race checks. A source-built independent helper now supplies
bounded private IPC, EOF/watchdog cleanup and explicit cleanup acknowledgements.
A quarantined reader-side launcher now sequences heartbeats, closes the
lifetime pipe on cancellation and blocks replacement until cleanup and
process exit are confirmed. No production reader launcher is attached;
helper death, physical collisions and native repeat/lock policy remain open.
process exit are confirmed. The production reader launcher uses this
supervisor. Private tests cover helper death and repeat/lock policy; physical
collisions remain an acceptance gate.
See [the native prerequisite](../../cthulhu/docs/testing/remote-key-target.md).
- Private native crash tests now kill/stop the process running the real reader
SDK/host/mailbox worker and Supervisor. The separate helper releases held
modifiers on EOF/watchdog expiry; resuming the stopped owner leaves input
retired and replacement blocked after unconfirmed helper exit. These exercise
the quarantined worker, without launching an installed reader or establishing
production keyboard availability. See [the evidence and limits](../../cthulhu/docs/testing/remote-input-helper.md#mailbox-owner-process-failure).
the shared worker without launching an installed reader or establishing
physical keyboard acceptance. See [the evidence and limits](../../cthulhu/docs/testing/remote-input-helper.md#mailbox-owner-process-failure).
- A quarantined reader repeat normalizer converts native key observations into
one down, repeated downs and one up for the outgoing encoder, with private
Xvfb evidence for held keys. A capture router balances modifiers around
local/escape chords. Neither is attached to capture. See
local/escape chords. Both are attached to production capture. See
[keyboard.md](keyboard.md).
- TLS with normal certificate/hostname validation or an already-approved,
endpoint-bound SHA-256 certificate pin. Authentication sends no channel key
@@ -116,16 +117,16 @@ the combined connection workflow are supplied by the library described above.
A subsequent [private Xorg feasibility increment](../../cthulhu/docs/testing/remote-input-feasibility.md)
demonstrates exclusive capture and independent test-helper cleanup after writer
death or heartbeat expiry. It also records why connection closure and ordinary
input-event flags are insufficient for safe remote injection. The helper is
test-only; trusted origin, physical-key collisions and production integration
remain unresolved. This is partial Phase A evidence, not keyboard readiness.
input-event flags are insufficient for safe remote injection. Production capture
and helper integration now build on that evidence.
Physical-key collision and interoperability acceptance remain unverified.
The reader's [Braille feasibility increment](../../cthulhu/docs/testing/remote-braille-feasibility.md)
now reuses its existing liblouis viewport and physical writer's cell-mask logic
to export translated virtual cells without opening a display. Private tests
cover independent widths, contracted routing, attributes and cursor overlays.
Virtual table/cursor policy, helper IPC, raw receiving and physical-display
acceptance remain pending; this is not yet Remote Braille support.
Virtual table/cursor policy, helper IPC and raw receiving are implemented in
the production Braille bridge. Physical-display acceptance remains pending.
The reader now also implements opt-in protocol 1.1 lifecycle IPC, both SDK clients,
explicit install grants, and expiring core-issued leases. See
@@ -139,7 +140,7 @@ remains unverified. The source command now requests core consent through typed
interaction requests. Core revokes the original epoch on ordinary interaction completion;
an explicit desktop return retains only the verified already-open lease.
Bounded cancellation also stops pre-lease inspection on lock/handoff.
Keyboard, clipboard and Braille desktop services remain unavailable.
Keyboard, clipboard text and Braille desktop services use these approved leases.
Explicit Trust and remember/Forget pin actions now manage endpoint-bound saved
certificate trust. `make build` builds `remote/bin/remote`; `make check` also
@@ -172,12 +173,14 @@ based on source review, **not captured NVDA sessions**. The [source-command
procedure](command.md) describes pending physical-input acceptance checks;
private fixtures do not establish them.
Pending: actual NVDA/add-on/Orca interoperability, physical-source approval,
audible incoming speech and real server priority, complete output export, physical acceptance of desktop
return/status reopening, exclusive keyboard capture,
injection provenance and reader-death recovery, clipboard permission,
virtual Braille integration, audible masking, physical displays and packaging. The
full remote-control release must not be advertised until those gates pass.
Remaining release evidence includes captured NVDA protocol fixtures, actual
NVDA/add-on/Orca interoperability, physical-source approval and keyboard recovery,
audible speech and masking, physical Braille, installer checks and ARM64 package
validation. Review archives exist; catalog publication and release deployment
are separate actions. Unreviewed speech producers remain deliberately local.
See [the current plan status](../remote.md) for scope and release gates. Older
increment documents describe the state at the time of each increment, not a
current implementation backlog.
## Relay trust
+6 -1
View File
@@ -1,4 +1,9 @@
# Remote implementation and remaining integration
# Remote implementation history
This is a historical increment record. For current implemented features and
remaining release evidence, see [README.md](README.md) and the status at the top
of [the plan](../remote.md). The implementation gates below predate production
keyboard, clipboard, Braille and review packaging integration.
The design plan is [`../remote.md`](../remote.md) in this repository. This
increment implements part of phases A and C. **Phase A is not complete**: actual
+26
View File
@@ -184,3 +184,29 @@ func TestBrailleRequiresGrant(t *testing.T) {
}
}
}
func TestBrailleQueueCannotDelayDueHeartbeat(t *testing.T) {
c, a, stream := inertSpeechStream(t, "controlled", []string{"braille-stream"})
client := &fixtureClient{calls: make(chan readerCall, 4)}
c.client = client
ticks := make(chan time.Time, 1)
ticks <- time.Now()
stream.brailleOps <- sdk.RemoteBraille{Op: "size", Width: 20}
client.hook = func(_ context.Context, method string, _, _ any) error {
if method == "remote.braille" {
a.cancel()
}
return nil
}
done := make(chan struct{})
go func() { defer close(done); c.speech_operations_ticks(a, stream, ticks) }()
awaitDone(t, done)
first := <-client.calls
second := <-client.calls
if first.method != "remote.heartbeat" || second.method != "remote.braille" {
t.Fatalf("due heartbeat delayed: %s then %s", first.method, second.method)
}
if first.params.(sdk.RemoteOperation).Sequence != 1 || second.params.(sdk.RemoteBrailleRequest).Sequence != 2 {
t.Fatal("operation order changed")
}
}
+14 -17
View File
@@ -208,6 +208,10 @@ func (c *coordinator) speech_release(stream *speechStream, bytes int) {
func (c *coordinator) speech_operations(a *connectionAttempt, stream *speechStream) {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
c.speech_operations_ticks(a, stream, ticker.C)
}
func (c *coordinator) speech_operations_ticks(a *connectionAttempt, stream *speechStream, ticks <-chan time.Time) {
var utterance uint64
heartbeat := func() bool {
if a.ctx.Err() != nil {
@@ -223,10 +227,19 @@ func (c *coordinator) speech_operations(a *connectionAttempt, stream *speechStre
return err == nil
}
for {
// Every effect shares the heartbeat deadline, including Braille and
// focus requests. A continuously ready queue must not starve it.
select {
case <-ticks:
if !heartbeat() {
return
}
default:
}
select {
case <-a.ctx.Done():
return
case <-ticker.C:
case <-ticks:
if !heartbeat() {
return
}
@@ -257,26 +270,10 @@ func (c *coordinator) speech_operations(a *connectionAttempt, stream *speechStre
return
}
case key := <-stream.keys:
select {
case <-ticker.C:
if !heartbeat() {
c.key_release(stream)
return
}
default:
}
if !c.deliver_key(a, stream, key) {
return
}
case item := <-stream.incoming:
select {
case <-ticker.C:
if !heartbeat() {
c.speech_release(stream, item.bytes)
return
}
default:
}
c.mu.Lock()
ready := c.speech_ready_locked(a, stream)
c.mu.Unlock()