fix(runnerd): send structured Codex permission profiles

This commit is contained in:
Dotta committed 2026-08-25 16:52:04 -05:00
1 parent 02d57721ca
commit 3dbce8a986
2 files changed
+19 -5

No files matched your search

@@ -86,9 +86,16 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
}
let config = request.pointer("/params/config").and_then(Value::as_object);
planning_thread = request
.pointer("/params/permissions")
.pointer("/params/permissions/id")
.and_then(Value::as_str)
== Some("paperclip-runner-workspace-read-only");
if request
.pointer("/params/permissions/type")
.and_then(Value::as_str)
!= Some("profile")
{
return Err(format!("{method} omitted a structured permission profile").into());
}
if config
.and_then(|value| value.get("skills.include_instructions"))
.and_then(Value::as_bool)
@@ -134,6 +141,13 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
}))?;
}
"turn/start" => {
if request
.pointer("/params/permissions/type")
.and_then(Value::as_str)
!= Some("profile")
{
return Err("turn/start omitted a structured permission profile".into());
}
if planning_thread {
let collaboration_mode = request.pointer("/params/collaborationMode");
if collaboration_mode
@@ -1203,9 +1203,9 @@ impl CodexProvider {
));
}
let permission_profile = if config.collaboration_mode == "plan" {
"paperclip-runner-workspace-read-only"
json!({"type": "profile", "id": "paperclip-runner-workspace-read-only"})
} else {
"paperclip-runner-workspace-only"
json!({"type": "profile", "id": "paperclip-runner-workspace-only"})
};
let opened = if let Some(thread_id) = resume_thread_id {
provider.request(
@@ -1318,9 +1318,9 @@ impl CodexProvider {
pub fn start_turn(&mut self, message: &str, cwd: &str) -> Result<Value, LocalRunnerError> {
let thread_id = self.thread_id.clone();
let permission_profile = if self.collaboration_mode == "plan" {
"paperclip-runner-workspace-read-only"
json!({"type": "profile", "id": "paperclip-runner-workspace-read-only"})
} else {
"paperclip-runner-workspace-only"
json!({"type": "profile", "id": "paperclip-runner-workspace-only"})
};
let mut params = json!({
"threadId": thread_id,