From d1483dcd5da035c34266ad8a15db5bcd031650e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sun, 19 Apr 2026 15:15:43 -0400 Subject: [PATCH] Add final native verification matrix --- .../tests/native_inbox_attention_e2e.rs | 69 +++++++++++++++++++ AgentCompany-Rust/prd.json | 4 +- AgentCompany-Rust/progress.txt | 2 +- 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 AgentCompany-Rust/crates/storage/tests/native_inbox_attention_e2e.rs diff --git a/AgentCompany-Rust/crates/storage/tests/native_inbox_attention_e2e.rs b/AgentCompany-Rust/crates/storage/tests/native_inbox_attention_e2e.rs new file mode 100644 index 00000000..72fc823c --- /dev/null +++ b/AgentCompany-Rust/crates/storage/tests/native_inbox_attention_e2e.rs @@ -0,0 +1,69 @@ +use storage::{NewCompanyInput, ProfileStore}; +use tempfile::tempdir; + +#[test] +fn inbox_attention_derivation_round_trips_through_snapshot() { + let sandbox = tempdir().expect("temp dir"); + let mut store = ProfileStore::open(sandbox.path()).expect("open store"); + + let company_id = store + .create_company(NewCompanyInput { + name: "Orbit Inbox".to_string(), + description: "Verifies native inbox derivation".to_string(), + workspace_path: "/tmp/orbit-inbox".to_string(), + execution_mode: "ai_ceo".to_string(), + }) + .expect("create company"); + + let ts = support::time::now_iso().expect("timestamp"); + let approval_id = uuid::Uuid::new_v4().to_string(); + let run_id = uuid::Uuid::new_v4().to_string(); + + let conn = rusqlite::Connection::open(store.db_path()).expect("open raw db"); + conn.execute( + "insert into approvals (id, company_id, related_task_id, requested_by_agent_id, related_agent_id, type, payload_summary, impact_summary, payload_json, decision_note, state, created_at, updated_at) values (?1, ?2, null, null, null, 'runtime_tool_call', 'Review shell command', 'Blocks workspace write', null, '', 'pending', ?3, ?3)", + rusqlite::params![approval_id, company_id, ts], + ) + .expect("insert approval"); + conn.execute( + "insert into runs (id, company_id, task_id, agent_id, workspace_id, connector_id, status, summary, error_message, model, cost_usd, started_at, finished_at, created_at, updated_at) values (?1, ?2, null, '__board__', null, 'anthropic', 'failed', 'Workspace write failed', 'permission denied', 'claude-sonnet', 0.5, ?3, ?3, ?3, ?3)", + rusqlite::params![run_id, company_id, ts], + ) + .expect("insert failed run"); + let message_id = store + .send_board_message( + &company_id, + "Board update: human review is required before retry.", + ) + .expect("send board message"); + + let snapshot = store.snapshot().expect("snapshot"); + assert_eq!(snapshot.pending_approvals(), 1); + assert_eq!(snapshot.unread_messages(), 1); + assert_eq!(snapshot.active_runs(), 0); + assert!( + snapshot + .runs + .iter() + .any(|run| run.id == run_id && run.status == "failed") + ); + assert!( + snapshot + .agent_messages + .iter() + .any(|message| message.id == message_id && message.read_at.is_none()) + ); + + store + .mark_message_read(&company_id, &message_id) + .expect("mark message read"); + let reopened = ProfileStore::open(sandbox.path()).expect("reopen store"); + let reopened_snapshot = reopened.snapshot().expect("reopened snapshot"); + assert_eq!(reopened_snapshot.pending_approvals(), 1); + assert_eq!(reopened_snapshot.unread_messages(), 0); + assert!( + reopened_snapshot.runs.iter().any( + |run| run.id == run_id && run.error_message.as_deref() == Some("permission denied") + ) + ); +} diff --git a/AgentCompany-Rust/prd.json b/AgentCompany-Rust/prd.json index 47684aa4..881eae71 100644 --- a/AgentCompany-Rust/prd.json +++ b/AgentCompany-Rust/prd.json @@ -126,8 +126,8 @@ "cargo test --workspace passes" ], "priority": 9, - "passes": false, - "notes": "Final confidence layer before calling the rewrite complete." + "passes": true, + "notes": "Completed with the final native verification matrix: profile_store_e2e.rs covers onboarding bootstrap, native_surface_e2e.rs covers run/approval/document visibility, native_settings_workspace_e2e.rs covers settings/workspaces, runtime_live_flow_e2e.rs covers live runtime approval/message/run flows, and native_inbox_attention_e2e.rs covers inbox attention derivation. cargo clippy/test both pass." } ] } diff --git a/AgentCompany-Rust/progress.txt b/AgentCompany-Rust/progress.txt index 172ef545..43f72d71 100644 --- a/AgentCompany-Rust/progress.txt +++ b/AgentCompany-Rust/progress.txt @@ -13,4 +13,4 @@ Started: 2026-04-19 - Added runtime contract persistence entities for run events and artifacts, exposed them in ProfileSnapshot, and rendered them in the native runs inspector. - Added runtime_contract_snapshot_e2e.rs to verify runtime event and artifact persistence across reopen. - Runtime contract integration advanced: RuntimeEvent ingestion now persists message/tool/artifact/run-finished events into storage and exposes them in the runs inspector. -- Wired a live native runtime session into the GPUI Runs surface. Selected runs now launch Pi Mono through env-configured stdio sidecar settings, runtime tool calls create approval rows, approval decisions send ToolApproval back into the live session, runtime messages project into agent_messages, and run lifecycle still persists into run_events/artifacts/runs.\n \ No newline at end of file +- Wired a live native runtime session into the GPUI Runs surface. Selected runs now launch Pi Mono through env-configured stdio sidecar settings, runtime tool calls create approval rows, approval decisions send ToolApproval back into the live session, runtime messages project into agent_messages, and run lifecycle still persists into run_events/artifacts/runs.\n- Closed the final native verification matrix. The workspace now has explicit storage-backed e2e coverage for onboarding bootstrap, approvals/documents/runs visibility, settings/workspace mutations, live runtime contract flows, and inbox attention derivation.\n \ No newline at end of file