mirror of
https://github.com/openai/codex.git
synced 2026-05-21 19:45:26 +00:00
## Why The app-server request path had grown around a large `CodexMessageProcessor` plus separate API wrapper/helper modules. That made the dependency graph hard to see and forced unrelated request families to share broad processor state. This PR makes the split mechanical and command-prefix oriented so request families own only the dependencies they use. ## What changed - Replaced `CodexMessageProcessor` with command-prefix request processors under `app-server/src/request_processors/`. - Removed the old config, device-key, external-agent-config, and fs API wrapper files by moving their API handling into processors. - Split apps, plugins, marketplace, catalog, account, MCP, command exec, fs, git, feedback, thread, turn, thread goals, and Windows sandbox handling into dedicated processors. - Kept shared lifecycle, summary conversion, token usage replay, and shared error mapping only where multiple processors use them; single-use helpers were inlined into their owning processor. - Removed the fallback processor path and moved processor tests to `_tests` files. ## Validation - `cargo test -p codex-app-server` - `cargo check -p codex-app-server` - `just fix -p codex-app-server`
37 lines
944 B
Rust
37 lines
944 B
Rust
use super::*;
|
|
|
|
#[derive(Clone)]
|
|
pub(crate) struct GitRequestProcessor;
|
|
|
|
impl GitRequestProcessor {
|
|
pub(crate) fn new() -> Self {
|
|
Self
|
|
}
|
|
|
|
pub(crate) async fn git_diff_to_remote(
|
|
&self,
|
|
params: GitDiffToRemoteParams,
|
|
) -> Result<Option<ClientResponsePayload>, JSONRPCErrorError> {
|
|
self.git_diff_to_origin(params.cwd)
|
|
.await
|
|
.map(|response| Some(response.into()))
|
|
}
|
|
|
|
async fn git_diff_to_origin(
|
|
&self,
|
|
cwd: PathBuf,
|
|
) -> Result<GitDiffToRemoteResponse, JSONRPCErrorError> {
|
|
git_diff_to_remote(&cwd)
|
|
.await
|
|
.map(|value| GitDiffToRemoteResponse {
|
|
sha: value.sha,
|
|
diff: value.diff,
|
|
})
|
|
.ok_or_else(|| {
|
|
invalid_request(format!(
|
|
"failed to compute git diff to remote for cwd: {cwd:?}"
|
|
))
|
|
})
|
|
}
|
|
}
|