feat: surface codex app-server approval progress

This commit is contained in:
AI Bot
2026-05-31 03:36:07 +08:00
parent b9d3cca2e7
commit 4800352e22
12 changed files with 691 additions and 5 deletions

View File

@@ -904,6 +904,60 @@ public class ProjectDetailActivityUiTest {
assertTrue(viewTreeContainsText(messageView, "Mendelexplorer"));
}
@Test
public void executionProgressMessageRendersCodexApprovalAndFileChangeSections() throws Exception {
Intent intent = new Intent()
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_ID, "thread-approval")
.putExtra(ProjectDetailActivity.EXTRA_PROJECT_NAME, "Boss开发主线程");
TestProjectDetailActivity activity = Robolectric
.buildActivity(TestProjectDetailActivity.class, intent)
.setup()
.get();
JSONObject message = new JSONObject()
.put("id", "progress-approval-1")
.put("sender", "master")
.put("senderLabel", "主 Agent")
.put("body", "执行进度")
.put("kind", "execution_progress")
.put("sentAt", "2026-05-31T10:16:00+08:00")
.put("executionProgress", new JSONObject()
.put("status", "running")
.put("steps", new JSONArray()
.put(new JSONObject().put("text", "等待 Codex 审批事件").put("status", "running")))
.put("approvals", new JSONArray()
.put(new JSONObject()
.put("label", "命令执行审批")
.put("status", "resolved")
.put("detail", "需要确认命令执行")
.put("riskLevel", "medium")))
.put("warnings", new JSONArray()
.put(new JSONObject()
.put("message", "检测到需要用户确认的命令执行。")
.put("severity", "warning")))
.put("fileChanges", new JSONArray()
.put(new JSONObject()
.put("path", "src/app/page.tsx")
.put("kind", "update")
.put("status", "updated"))));
View messageView = ReflectionHelpers.callInstanceMethod(
activity,
"buildMessageView",
ReflectionHelpers.ClassParameter.from(JSONObject.class, message)
);
assertTrue(viewTreeContainsText(messageView, "安全提醒"));
assertTrue(viewTreeContainsText(messageView, "检测到需要用户确认的命令执行。"));
assertTrue(viewTreeContainsText(messageView, "审批状态"));
assertTrue(viewTreeContainsText(messageView, "命令执行审批 · resolved"));
assertTrue(viewTreeContainsText(messageView, "需要确认命令执行"));
assertTrue(viewTreeContainsText(messageView, "文件变更"));
assertTrue(viewTreeContainsText(messageView, "src/app/page.tsx"));
assertFalse(viewTreeContainsText(messageView, "sk-secret"));
assertFalse(viewTreeContainsText(messageView, "diff"));
}
@Test
public void nativeRemoteExecutionProgressDoesNotRenderCodexSections() throws Exception {
Intent intent = new Intent()