Allow config reads to join active app-server read batches (#39036)

## Why

Config reads arriving while a long-running shared read was active waited for that
request to finish, even though they could safely run concurrently.

## What changed

- Admit newly queued shared reads into the active batch until an exclusive write
  is queued, preserving the write as a fairness barrier.
- Treat `hooks/list` and `configRequirements/read` as shared config reads.
- Cover concurrent reads, read/write ordering, and config reads completing
  alongside a `skills/list` request.

GitOrigin-RevId: 8194301c2ba60be0fc71b8915923af9accc745dc
This commit is contained in:
Charlie Marsh authored and copyberry committed 2026-08-17 17:28:37 +00:00
1 parent 71e5e1ec50
commit 1d928cad2f
3 files changed
+312 -19

No files matched your search

@@ -812,7 +812,7 @@ client_request_definitions! {
},
HooksList => "hooks/list" {
params: v2::HooksListParams,
serialization: global("config"),
serialization: global_shared_read("config"),
response: v2::HooksListResponse,
},
MarketplaceAdd => "marketplace/add" {
@@ -1310,7 +1310,7 @@ client_request_definitions! {
ConfigRequirementsRead => "configRequirements/read" {
params: #[ts(type = "undefined")] #[serde(skip_serializing_if = "Option::is_none")] Option<()>,
serialization: global("config"),
serialization: global_shared_read("config"),
response: v2::ConfigRequirementsReadResponse,
},
@@ -2245,6 +2245,15 @@ mod tests {
Some(ClientRequestSerializationScope::GlobalSharedRead("config"))
);
let hooks_list = ClientRequest::HooksList {
request_id: request_id(),
params: v2::HooksListParams { cwds: Vec::new() },
};
assert_eq!(
hooks_list.serialization_scope(),
Some(ClientRequestSerializationScope::GlobalSharedRead("config"))
);
let skills_extra_roots_set = ClientRequest::SkillsExtraRootsSet {
request_id: request_id(),
params: v2::SkillsExtraRootsSetParams {
@@ -2340,6 +2349,15 @@ mod tests {
Some(ClientRequestSerializationScope::GlobalSharedRead("config"))
);
let config_requirements_read = ClientRequest::ConfigRequirementsRead {
request_id: request_id(),
params: None,
};
assert_eq!(
config_requirements_read.serialization_scope(),
Some(ClientRequestSerializationScope::GlobalSharedRead("config"))
);
let account_read = ClientRequest::GetAccount {
request_id: request_id(),
params: v2::GetAccountParams {