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 profiles, modifier-side and keypad distinctions, and constant errors for
unsupported or ambiguous keys. An epoch-bound outgoing encoder retains the unsupported or ambiguous keys. An epoch-bound outgoing encoder retains the
original mapping through repeats/releases, bounds held keys and preserves original mapping through repeats/releases, bounds held keys and preserves
failed-write cleanup with sequence-checked acknowledgements. Capture, failed-write cleanup with sequence-checked acknowledgements. The mapper is
injection, AltGr and native layout/held-key ownership remain pending; these attached to production capture and injection; physical layout and AltGr
are library prerequisites, not keyboard control. See [keyboard.md](keyboard.md). acceptance remain unverified. See [keyboard.md](keyboard.md).
- Braille, approved per session: a controlled computer exports its Braille at - Braille, approved per session: a controlled computer exports its Braille at
the controller's display width; a controller shows it and sends pan and the controller's display width; a controller shows it and sends pan and
routing keys. Physical display acceptance is pending. See routing keys. Physical display acceptance is pending. See
@@ -59,28 +59,29 @@ Implemented:
through `remote.key`. Live acceptance is pending. through `remote.key`. Live acceptance is pending.
- Typed reader `remote.key` IPC, Go/Python validation and a bounded incoming-key - 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 mailbox now have real-process SDK checks. The external bridge converts every
supported canonical mapping to the public SDK representation. No production supported canonical mapping to the public SDK representation. The production
input owner is attached and the coordinator still discards keys; keyboard input owner consumes approved controlled-role keys. See
control remains unavailable. See [the reader contract](../../cthulhu/docs/tentacle-remote-keyboard.md). [the reader contract](../../cthulhu/docs/tentacle-remote-keyboard.md).
- A quarantined reader destination ledger/backend now preserves native keycodes - A quarantined reader destination ledger/backend now preserves native keycodes
through layout/Num Lock changes and retains failed cleanup for retry, with through layout/Num Lock changes and retains failed cleanup for retry, with
private Xvfb race checks. A source-built independent helper now supplies private Xvfb race checks. A source-built independent helper now supplies
bounded private IPC, EOF/watchdog cleanup and explicit cleanup acknowledgements. bounded private IPC, EOF/watchdog cleanup and explicit cleanup acknowledgements.
A quarantined reader-side launcher now sequences heartbeats, closes the A quarantined reader-side launcher now sequences heartbeats, closes the
lifetime pipe on cancellation and blocks replacement until cleanup and lifetime pipe on cancellation and blocks replacement until cleanup and
process exit are confirmed. No production reader launcher is attached; process exit are confirmed. The production reader launcher uses this
helper death, physical collisions and native repeat/lock policy remain open. 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). See [the native prerequisite](../../cthulhu/docs/testing/remote-key-target.md).
- Private native crash tests now kill/stop the process running the real reader - Private native crash tests now kill/stop the process running the real reader
SDK/host/mailbox worker and Supervisor. The separate helper releases held SDK/host/mailbox worker and Supervisor. The separate helper releases held
modifiers on EOF/watchdog expiry; resuming the stopped owner leaves input modifiers on EOF/watchdog expiry; resuming the stopped owner leaves input
retired and replacement blocked after unconfirmed helper exit. These exercise retired and replacement blocked after unconfirmed helper exit. These exercise
the quarantined worker, without launching an installed reader or establishing the shared 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). 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 - A quarantined reader repeat normalizer converts native key observations into
one down, repeated downs and one up for the outgoing encoder, with private one down, repeated downs and one up for the outgoing encoder, with private
Xvfb evidence for held keys. A capture router balances modifiers around 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). [keyboard.md](keyboard.md).
- TLS with normal certificate/hostname validation or an already-approved, - TLS with normal certificate/hostname validation or an already-approved,
endpoint-bound SHA-256 certificate pin. Authentication sends no channel key 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) A subsequent [private Xorg feasibility increment](../../cthulhu/docs/testing/remote-input-feasibility.md)
demonstrates exclusive capture and independent test-helper cleanup after writer demonstrates exclusive capture and independent test-helper cleanup after writer
death or heartbeat expiry. It also records why connection closure and ordinary death or heartbeat expiry. It also records why connection closure and ordinary
input-event flags are insufficient for safe remote injection. The helper is input-event flags are insufficient for safe remote injection. Production capture
test-only; trusted origin, physical-key collisions and production integration and helper integration now build on that evidence.
remain unresolved. This is partial Phase A evidence, not keyboard readiness. Physical-key collision and interoperability acceptance remain unverified.
The reader's [Braille feasibility increment](../../cthulhu/docs/testing/remote-braille-feasibility.md) 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 now reuses its existing liblouis viewport and physical writer's cell-mask logic
to export translated virtual cells without opening a display. Private tests to export translated virtual cells without opening a display. Private tests
cover independent widths, contracted routing, attributes and cursor overlays. cover independent widths, contracted routing, attributes and cursor overlays.
Virtual table/cursor policy, helper IPC, raw receiving and physical-display Virtual table/cursor policy, helper IPC and raw receiving are implemented in
acceptance remain pending; this is not yet Remote Braille support. the production Braille bridge. Physical-display acceptance remains pending.
The reader now also implements opt-in protocol 1.1 lifecycle IPC, both SDK clients, The reader now also implements opt-in protocol 1.1 lifecycle IPC, both SDK clients,
explicit install grants, and expiring core-issued leases. See 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; interaction requests. Core revokes the original epoch on ordinary interaction completion;
an explicit desktop return retains only the verified already-open lease. an explicit desktop return retains only the verified already-open lease.
Bounded cancellation also stops pre-lease inspection on lock/handoff. 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 Explicit Trust and remember/Forget pin actions now manage endpoint-bound saved
certificate trust. `make build` builds `remote/bin/remote`; `make check` also 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; procedure](command.md) describes pending physical-input acceptance checks;
private fixtures do not establish them. private fixtures do not establish them.
Pending: actual NVDA/add-on/Orca interoperability, physical-source approval, Remaining release evidence includes captured NVDA protocol fixtures, actual
audible incoming speech and real server priority, complete output export, physical acceptance of desktop NVDA/add-on/Orca interoperability, physical-source approval and keyboard recovery,
return/status reopening, exclusive keyboard capture, audible speech and masking, physical Braille, installer checks and ARM64 package
injection provenance and reader-death recovery, clipboard permission, validation. Review archives exist; catalog publication and release deployment
virtual Braille integration, audible masking, physical displays and packaging. The are separate actions. Unreviewed speech producers remain deliberately local.
full remote-control release must not be advertised until those gates pass. 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 ## 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 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 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) { func (c *coordinator) speech_operations(a *connectionAttempt, stream *speechStream) {
ticker := time.NewTicker(time.Second) ticker := time.NewTicker(time.Second)
defer ticker.Stop() 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 var utterance uint64
heartbeat := func() bool { heartbeat := func() bool {
if a.ctx.Err() != nil { if a.ctx.Err() != nil {
@@ -223,10 +227,19 @@ func (c *coordinator) speech_operations(a *connectionAttempt, stream *speechStre
return err == nil return err == nil
} }
for { 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 { select {
case <-a.ctx.Done(): case <-a.ctx.Done():
return return
case <-ticker.C: case <-ticks:
if !heartbeat() { if !heartbeat() {
return return
} }
@@ -257,26 +270,10 @@ func (c *coordinator) speech_operations(a *connectionAttempt, stream *speechStre
return return
} }
case key := <-stream.keys: case key := <-stream.keys:
select {
case <-ticker.C:
if !heartbeat() {
c.key_release(stream)
return
}
default:
}
if !c.deliver_key(a, stream, key) { if !c.deliver_key(a, stream, key) {
return return
} }
case item := <-stream.incoming: case item := <-stream.incoming:
select {
case <-ticker.C:
if !heartbeat() {
c.speech_release(stream, item.bytes)
return
}
default:
}
c.mu.Lock() c.mu.Lock()
ready := c.speech_ready_locked(a, stream) ready := c.speech_ready_locked(a, stream)
c.mu.Unlock() c.mu.Unlock()