Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/living/github-dynamic-compute.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# GitHub and dynamic compute (P7)

> **DRAFT — drafted by the fleet 2026-11-12 from Drew's reprioritization order; awaiting Drew's ratification. Not Drew's own words.**
> **ACCEPTED FOR FLEET OPERATION — adopted by the fleet lane on 2026-11-21 from the documented measurements and existing practice below. This is a fleet decision, not a statement or ratification by Drew.**

- Living document · Status: DRAFT · Program: P7 GitHub + dynamic compute (band 40) · Register entry: X9 · Tracking epic: developing-today/code#8805 · Milestone: "GitHub + dynamic compute" · Label: `epic/github-dynamic-compute`
- Living document · Status: ACCEPTED FOR FLEET OPERATION · Program: P7 GitHub + dynamic compute (band 40) · Register entry: X9 · Tracking epic: developing-today/code#8805 · Milestone: "GitHub + dynamic compute" · Label: `epic/github-dynamic-compute`

## Purpose

Expand All @@ -27,15 +27,15 @@ The fleet's compute is increasingly **dynamic**: GitHub-hosted Actions pools, Bl

## Deliverables

- [ ] This design ratified or amended by Drew.
- [x] This design accepted for fleet operation by the fleet lane on 2026-11-21; the decision is not attributed to Drew.
- [ ] The living capacity table (pools, quotas, concurrency, current-cycle usage) maintained in this doc, refreshed monthly from the billing API.
- [ ] Placement rules applied to the fleet's dispatch surfaces (fleet-run / org-run / fleet-dispatch-test) and written into their docs.
- [ ] Actions usage review completed (per the trim goal) with per-workflow keep/cut decisions recorded.
- [ ] Codespaces verification cadence running (weekly clean-room run inside the standing codespace) once the codespace scope grant lands.
- [ ] Blacksmith second pool (developing-today-forks install) proven with a first dispatch, once Drew's sudo tap lands.
- [ ] Runner-switch audit: every workflow in the four repos carries correct concurrency groups and, where relevant, `# RUNNER-SWITCH:` markers.

## Open questions for Drew
## Open questions (not gates to the accepted design)

1. The two standing gates: complete the `gh` codespace scope grant, and install Blacksmith/CodeRabbit on developing-today-forks (one sudo tap, ~30s)?
2. Org Team plan ($4/user/mo): buy for org Codespaces + 60 concurrency, or keep Free and keep routing around the 20-slot org queue?
Expand Down
36 changes: 36 additions & 0 deletions pkgs/id/crates/id-worlds/src/world/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ pub(crate) enum WorldCommand {
token: JoinCapability,
input: Vec<u8>,
session_id: Option<SessionId>,
device_input: Option<serde_json::Value>,
/// The player-signed move event bytes for this input (#2814), when
/// the participant plays signed. `None` is the unsigned path,
/// which refuses participants with a bound author key.
Expand Down Expand Up @@ -650,6 +651,10 @@ pub(crate) struct WorldActor {
/// device re-enumeration. `None` when the host cannot describe
/// its device — `device.info` then refuses with `unknown_cap`.
pub(crate) device_manifest: Option<crate::world_caps::DeviceManifest>,
/// Input affordances of the session whose input is currently being
/// processed. Unlike `device_manifest`, this describes the presenter,
/// not the hosting device, and is only used for this actor turn.
pub(crate) acting_device_input: Option<serde_json::Value>,
/// The host's current location consent (#2341 slice 2): the seam a
/// host fills from its permission prompt / OS state. The default
/// host records no consent, so sensor caps refuse
Expand Down Expand Up @@ -804,6 +809,7 @@ impl WorldActor {
command.as_ref(),
Some(WorldCommand::Input {
signed_move: None,
device_input: None,
..
})
) {
Expand All @@ -817,6 +823,7 @@ impl WorldActor {
next,
WorldCommand::Input {
signed_move: None,
device_input: None,
..
}
) =>
Expand Down Expand Up @@ -857,6 +864,7 @@ impl WorldActor {
self.drain_provider_completions().await;
self.acting = None;
self.acting_session = None;
self.acting_device_input = None;
}
}

Expand Down Expand Up @@ -1333,6 +1341,7 @@ impl WorldActor {
token,
input,
session_id,
device_input,
signed_move,
reply,
} => {
Expand All @@ -1359,6 +1368,7 @@ impl WorldActor {
Ok((candidate, signed)) if self.program_healthy => {
self.acting = Some(candidate.participant_id);
self.acting_session = session_id;
self.acting_device_input = device_input;
match self
.program
.update(&candidate)
Expand Down Expand Up @@ -3514,6 +3524,7 @@ mod form_tests {
audio: serde_json::json!({}),
network: serde_json::json!({}),
});
actor.acting_device_input = None;
(actor, events)
}

Expand Down Expand Up @@ -3583,6 +3594,9 @@ mod form_tests {
let (mut actor, _) = form_actor();
let headless = crate::world::WorldHandle::host_device_manifest();
actor.device_manifest = Some(headless.clone());
actor.acting_device_input = Some(serde_json::json!({
"keys": 128, "text_entry": "keyboard", "encoder": false, "pointer": true
}));
let form = form(vec![FormField::Text {
id: "name".to_owned(),
label: "Name".to_owned(),
Expand All @@ -3599,6 +3613,27 @@ mod form_tests {
);
}

#[test]
fn presenter_without_text_entry_is_refused_even_when_host_can_type() {
let (mut actor, _) = form_actor();
actor.acting_device_input = Some(serde_json::json!({
"keys": 0, "text_entry": "none", "encoder": false, "pointer": false
}));
let text_form = form(vec![FormField::Text {
id: "name".to_owned(),
label: "Name".to_owned(),
required: true,
max_length: 32,
}]);
assert_eq!(
present(&mut actor, &text_form)
.unwrap_err()
.reason()
.map(String::as_str),
Some("text_entry_unavailable")
);
}

#[tokio::test]
async fn form_result_correlates_validates_and_keeps_invalid_form_for_re_presentation() {
let (mut actor, events) = form_actor();
Expand Down Expand Up @@ -4093,6 +4128,7 @@ impl WorldActor {
stale_wants_at_open: BTreeSet::new(),
acting: None,
acting_session: None,
acting_device_input: None,
device_manifest: None,
location_consent: crate::world_caps::LocationConsent::ConsentRequired,
location_fix: None,
Expand Down
31 changes: 20 additions & 11 deletions pkgs/id/crates/id-worlds/src/world/actor/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ impl WorldActor {
JoinCapability,
Vec<u8>,
Option<SessionId>,
Option<serde_json::Value>,
oneshot::Sender<Result<WorldEvent>>,
);
let mut items: std::collections::VecDeque<InputParts> = batch
Expand All @@ -147,16 +148,17 @@ impl WorldActor {
token,
input,
session_id,
device_input,
signed_move: None,
reply,
} => Some((token, input, session_id, reply)),
} => Some((token, input, session_id, device_input, reply)),
// The run loop only drains unsigned Inputs into a batch.
_ => None,
})
.collect();
if let Err(error) = self.check_writable() {
let message = format!("{error:#}");
for (_, _, _, reply) in items {
for (_, _, _, _, reply) in items {
let _ = reply.send(Err(anyhow::anyhow!(message.clone())));
}
return;
Expand All @@ -169,7 +171,7 @@ impl WorldActor {
let mut staged: Vec<Staged> = Vec::new();
let mut staged_spends: HashMap<u64, u32> = HashMap::new();
let mut failed: Option<(oneshot::Sender<Result<WorldEvent>>, anyhow::Error)> = None;
while let Some((token, input, session_id, reply)) = items.pop_front() {
while let Some((token, input, session_id, device_input, reply)) = items.pop_front() {
let sequence = self.core.sequence + staged.len() as u64 + 1;
let candidate =
match self
Expand Down Expand Up @@ -198,6 +200,7 @@ impl WorldActor {
}
self.acting = Some(candidate.participant_id);
self.acting_session = session_id;
self.acting_device_input = device_input;
match self
.program
.update(&candidate)
Expand Down Expand Up @@ -264,11 +267,12 @@ impl WorldActor {
}
// Whatever the batch did not stage goes through the single-command
// path, in order, with its semantics untouched.
for (token, input, session_id, reply) in items {
for (token, input, session_id, device_input, reply) in items {
self.handle(WorldCommand::Input {
token,
input,
session_id,
device_input,
signed_move: None,
reply,
})
Expand Down Expand Up @@ -1398,13 +1402,18 @@ impl WorldActor {
if args_size > crate::world_caps::MAX_ARGS_BYTES {
return Err(CapError::bad_args_with("args_too_large"));
}
if let Some(manifest) = &self.device_manifest
&& manifest
.display
.get("kind")
.and_then(serde_json::Value::as_str)
!= Some("headless")
&& let Err(error) = form.validate_device_input(&manifest.input)
let presenter_input = self.acting_device_input.as_ref().or_else(|| {
self.device_manifest.as_ref().and_then(|manifest| {
(manifest
.display
.get("kind")
.and_then(serde_json::Value::as_str)
!= Some("headless"))
.then_some(&manifest.input)
})
});
if let Some(input) = presenter_input
&& let Err(error) = form.validate_device_input(input)
{
let reason = if format!("{error:#}").contains("text entry unavailable") {
"text_entry_unavailable"
Expand Down
9 changes: 7 additions & 2 deletions pkgs/id/crates/id-worlds/src/world/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ impl WorldHandle {
stale_wants_at_open,
acting: None,
acting_session: None,
acting_device_input: None,
device_manifest,
location_consent: crate::world_caps::LocationConsent::ConsentRequired,
location_fix: None,
Expand Down Expand Up @@ -1464,7 +1465,7 @@ impl WorldHandle {

/// Submit bounded opaque game input.
pub async fn input(&self, token: JoinCapability, input: Vec<u8>) -> Result<WorldEvent> {
self.input_with_session(token, input, None).await
self.input_with_session(token, input, None, None).await
}

/// Submit bounded opaque game input from a live session connection.
Expand All @@ -1473,8 +1474,9 @@ impl WorldHandle {
token: JoinCapability,
input: Vec<u8>,
session_id: SessionId,
device_input: Option<serde_json::Value>,
) -> Result<WorldEvent> {
self.input_with_session(token, input, Some(session_id))
self.input_with_session(token, input, Some(session_id), device_input)
.await
}

Expand All @@ -1483,13 +1485,15 @@ impl WorldHandle {
token: JoinCapability,
input: Vec<u8>,
session_id: Option<SessionId>,
device_input: Option<serde_json::Value>,
) -> Result<WorldEvent> {
let (reply, response) = oneshot::channel();
self.commands
.send(WorldCommand::Input {
token,
input,
session_id,
device_input,
signed_move: None,
reply,
})
Expand Down Expand Up @@ -1536,6 +1540,7 @@ impl WorldHandle {
token,
input,
session_id: None,
device_input: None,
signed_move: Some(signed_move),
reply,
})
Expand Down
3 changes: 3 additions & 0 deletions pkgs/id/crates/id-worlds/src/world/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9709,6 +9709,7 @@ mod schedule_tests {
token: token.clone(),
input: document.to_string().into_bytes(),
session_id: None,
device_input: None,
signed_move: None,
reply,
})
Expand Down Expand Up @@ -9809,6 +9810,7 @@ mod schedule_tests {
token: token.clone(),
input: input.to_vec(),
session_id: None,
device_input: None,
signed_move: None,
reply,
});
Expand Down Expand Up @@ -9900,6 +9902,7 @@ mod schedule_tests {
token: token.clone(),
input: b"{}".to_vec(),
session_id: Some(session_id),
device_input: None,
signed_move: None,
reply,
})
Expand Down
9 changes: 6 additions & 3 deletions pkgs/id/crates/id-worlds/src/world_session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ async fn joined<I: SessionIo>(
screen_patches: bool,
resume_token: Option<String>,
agent_profile: bool,
device_input: Option<serde_json::Value>,
documents_store: Option<Store>,
) {
let world = service.world();
Expand Down Expand Up @@ -1273,6 +1274,7 @@ async fn joined<I: SessionIo>(
&mut viewport,
cursor,
session_id,
device_input.as_ref(),
&mut view_state,
screen_patches,
&mut pending_view_deadline,
Expand Down Expand Up @@ -1501,6 +1503,7 @@ async fn handle_client_frame<I: SessionIo>(
viewport: &mut Option<Viewport>,
sequence: u64,
session_id: SessionId,
device_input: Option<&serde_json::Value>,
view_state: &mut ViewRevisionState,
screen_patches: bool,
pending_view_deadline: &mut Option<tokio::time::Instant>,
Expand Down Expand Up @@ -1820,13 +1823,13 @@ async fn handle_client_frame<I: SessionIo>(
.await;
};
world
.input_from_session(token.clone(), bytes, session_id)
.input_from_session(token.clone(), bytes, session_id, device_input.cloned())
.await
}
ClientFrame::Input { data_hex, .. } => match decode_hex(&data_hex) {
Some(data) => {
world
.input_from_session(token.clone(), data, session_id)
.input_from_session(token.clone(), data, session_id, device_input.cloned())
.await
}
None => {
Expand Down Expand Up @@ -1897,7 +1900,7 @@ async fn handle_client_frame<I: SessionIo>(
match serde_json::to_vec(&encoded) {
Ok(bytes) => {
world
.input_from_session(token.clone(), bytes, session_id)
.input_from_session(token.clone(), bytes, session_id, device_input.cloned())
.await
}
Err(_) => {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/id/crates/id-worlds/src/world_session/session_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub(crate) async fn run_world_session<I: SessionIo>(
screen_patches,
resume_token,
agent_profile,
device_input,
} => {
if capability.len() > MAX_CAPABILITY_BYTES {
let _ = send_error(service.frame_meter(), io, "invalid join capability").await;
Expand All @@ -36,6 +37,7 @@ pub(crate) async fn run_world_session<I: SessionIo>(
screen_patches,
resume_token,
agent_profile,
device_input,
documents_store,
)
.await;
Expand Down Expand Up @@ -514,6 +516,7 @@ async fn query_session<I: SessionIo>(
screen_patches,
resume_token,
agent_profile,
device_input,
} => {
if capability.len() > MAX_CAPABILITY_BYTES {
let _ = send_error(service.frame_meter(), io, "invalid join capability").await;
Expand All @@ -528,6 +531,7 @@ async fn query_session<I: SessionIo>(
screen_patches,
resume_token,
agent_profile,
device_input,
documents_store.clone(),
)
.await;
Expand Down
Loading