feat(app-server): persist remote-control desired state (#27445)

## Why

Remote-control runtime enablement and persisted enrollment preference
were represented by separate flags. That made startup rehydration, RPC
persistence, and new-enrollment seeding race with one another, and it
did not cleanly distinguish runtime-only CLI or daemon starts from
durable app-server RPC changes.

## What Changed

- Replace the parallel enablement, seed, and rehydration flags with one
transport-owned `RemoteControlDesiredState`.
- Add nullable enrollment-scoped persistence and preserve existing
preferences during enrollment upserts.
- Rehydrate plain startup only after auth and client scope resolve,
without overwriting a concurrent RPC transition.
- Make ordinary `remoteControl/enable` and `remoteControl/disable`
durable while retaining `ephemeral: true` for runtime-only callers.
- Have the daemon explicitly request ephemeral enablement and regenerate
the app-server schemas.

## Verification

- Covered migration and `NULL`/`0`/`1` persistence round trips.
- Covered plain-start rehydration and runtime-only versus durable
enrollment seeding.
- Covered durable enable, durable disable, and ephemeral enable through
app-server RPC.
- Covered the daemon's exact `{ "ephemeral": true }` request payload.

Related issue: N/A (internal remote-control persistence architecture
change).
This commit is contained in:
Anton Panasenko
2026-06-11 21:28:52 -07:00
committed by GitHub
parent be338ee9a2
commit d61dfeb23a
33 changed files with 2157 additions and 412 deletions
@@ -2124,6 +2124,22 @@
}
]
},
"RemoteControlDisableParams": {
"properties": {
"ephemeral": {
"type": "boolean"
}
},
"type": "object"
},
"RemoteControlEnableParams": {
"properties": {
"ephemeral": {
"type": "boolean"
}
},
"type": "object"
},
"RequestId": {
"anyOf": [
{
@@ -14050,6 +14050,22 @@
],
"type": "string"
},
"RemoteControlDisableParams": {
"properties": {
"ephemeral": {
"type": "boolean"
}
},
"type": "object"
},
"RemoteControlEnableParams": {
"properties": {
"ephemeral": {
"type": "boolean"
}
},
"type": "object"
},
"RemoteControlStatusChangedNotification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Current remote-control connection status and remote identity exposed to clients.",
@@ -10532,6 +10532,22 @@
],
"type": "string"
},
"RemoteControlDisableParams": {
"properties": {
"ephemeral": {
"type": "boolean"
}
},
"type": "object"
},
"RemoteControlEnableParams": {
"properties": {
"ephemeral": {
"type": "boolean"
}
},
"type": "object"
},
"RemoteControlStatusChangedNotification": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Current remote-control connection status and remote identity exposed to clients.",
@@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type RemoteControlDisableParams = { ephemeral?: boolean, };
@@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type RemoteControlEnableParams = { ephemeral?: boolean, };
@@ -325,6 +325,8 @@ export type { ReasoningSummaryPartAddedNotification } from "./ReasoningSummaryPa
export type { ReasoningSummaryTextDeltaNotification } from "./ReasoningSummaryTextDeltaNotification";
export type { ReasoningTextDeltaNotification } from "./ReasoningTextDeltaNotification";
export type { RemoteControlConnectionStatus } from "./RemoteControlConnectionStatus";
export type { RemoteControlDisableParams } from "./RemoteControlDisableParams";
export type { RemoteControlEnableParams } from "./RemoteControlEnableParams";
export type { RemoteControlStatusChangedNotification } from "./RemoteControlStatusChangedNotification";
export type { RequestPermissionProfile } from "./RequestPermissionProfile";
export type { ResidencyRequirement } from "./ResidencyRequirement";