optz: Goal orchestrator

This commit is contained in:
thanhnv
2026-07-11 12:18:59 +09:00
parent b56f7d357e
commit 4fc72332f5
34 changed files with 850 additions and 452 deletions
@@ -0,0 +1 @@
62231
@@ -0,0 +1,4 @@
{"timestamp": "2026-07-10T14:44:35Z", "provider": "codex", "status": "prompt_length_invalid", "prompt_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "prompt_characters": 0, "latency_ms": 0}
{"timestamp": "2026-07-11T03:05:27Z", "provider": "codex", "status": "success", "prompt_hash": "eb0d4dea8f4d9db4e5a23b30cb230e2877e0f10e3b068b6c26e60df4348336bb", "prompt_characters": 1661, "latency_ms": 43253}
{"timestamp": "2026-07-11T03:07:54Z", "provider": "codex", "status": "success", "prompt_hash": "0bd46179eb95de73deb5be96bc4306993e43b7b5ade08af7e806c313ded88ad0", "prompt_characters": 1340, "latency_ms": 47640}
{"timestamp": "2026-07-11T03:15:44Z", "provider": "codex", "status": "success", "prompt_hash": "2c095509fcae5832ca5fc0952f61e234097cbee6905f4ffcdf24e5830bfa6c0d", "prompt_characters": 11606, "latency_ms": 56375}
@@ -0,0 +1 @@
b39f21f536ddb5ce72aac871e08584044fc2578f02026a79916b92dbd8738e86
+20
View File
@@ -0,0 +1,20 @@
flowchart LR
A["Người dùng gửi Goal"] --> B["H1: Phân loại mục tiêu"]
B --> C["Local + Cloud tạo Execution Plan"]
C --> D["H4: Kiểm tra policy và rủi ro"]
D --> E["Plan ready\nXem file, lệnh, dependency, test"]
E -->|"Approve"| F["Workspace Executor có sandbox"]
E -->|"Reject / Edit"| C
F --> G["Tạo branch/worktree và project"]
G --> H["Chạy test + kiểm tra acceptance"]
H -->|"Pass"| I["Completed"]
H -->|"Fail"| J["Failed + rollback / resume"]
K["Luồng hiện tại"] -.-> L["Local worker tạo text"]
L -.-> M["Cloud reviewer tạo text"]
M -.-> N["Completed = trả lời xong\nkhông sửa workspace"]
classDef current fill:#fff7ed,stroke:#f97316,color:#7c2d12;
classDef target fill:#eff6ff,stroke:#2563eb,color:#1e3a8a;
class K,L,M,N current;
class A,B,C,D,E,F,G,H,I,J target;
Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 31 KiB

@@ -0,0 +1 @@
21e680feef6579237c8a922712245afe8311c59e74d61523f8781535fcc35130
@@ -0,0 +1 @@
{"seq": 1, "timestamp": "2026-07-10T14:14:25Z", "trace_id": "38db1352-5ffc-4f37-b785-fd1c61e5a740", "chat_id": "phase2-blocked", "turn_id": "turn-38db1352-5ff", "tenant_id": "default", "actor": "phase2-smoke", "mode": "BLOCK", "risk": "high", "decision": "DENIED", "router": {"mode": "BLOCK", "risk": "high", "gates": ["H4_INPUT", "H5_CHAT_AUDIT"], "needs_approval": false, "reason": "blocked_by_rule", "matched_rules": ["ignore previous instructions", "reveal system prompt"], "side_effect_allowed": false, "classified_at": "2026-07-10T14:14:25Z"}, "user_msg_ref": "a20fa0ed6c2e5e629cf8413dfeb67a916825b0e617f0924ef9ea7d4e2eff916d", "safe_preview": "", "answer_ref": "eb8a01730d30c968225db76b066cdf294dd89d0be3ad5f3925b636a8a91ac6b2", "answer_preview": "Denied by Prompt Router: mode=BLOCK reason=blocked_by_rule", "synthesis_mode": "deterministic", "sources": [], "prev_hash": "0000000000000000000000000000000000000000000000000000000000000000", "record_hash": "21e680feef6579237c8a922712245afe8311c59e74d61523f8781535fcc35130"}
@@ -0,0 +1 @@
{"timestamp": "2026-07-10T14:14:25Z", "trace_id": "38db1352-5ffc-4f37-b785-fd1c61e5a740", "harness": "H6-agentops", "agent": "chat.ask-casan", "step": "ask-casan-readonly", "status": "failed", "exit_code": 2, "latency_ms": 90, "retry_count": 0, "input_tokens": 7, "output_tokens": 6, "total_tokens": 13, "cost_estimate": 0.0, "cost_source": "readonly_word_count", "synthesis_mode": "deterministic", "hallucination_signals": 0, "alerts": [], "input_hash": "a20fa0ed6c2e5e629cf8413dfeb67a916825b0e617f0924ef9ea7d4e2eff916d", "output_hash": "eb8a01730d30c968225db76b066cdf294dd89d0be3ad5f3925b636a8a91ac6b2"}
@@ -0,0 +1,7 @@
{"timestamp": "2026-07-10T14:14:25Z", "trace_id": "38db1352-5ffc-4f37-b785-fd1c61e5a740", "gate_id": "H1-context", "status": "running", "reason": "Classifying prompt contract", "evidence": {}}
{"timestamp": "2026-07-10T14:14:25Z", "trace_id": "38db1352-5ffc-4f37-b785-fd1c61e5a740", "gate_id": "H1-context", "status": "blocked", "reason": "blocked_by_rule", "evidence": {"mode": "BLOCK", "risk": "high"}}
{"timestamp": "2026-07-10T14:14:25Z", "trace_id": "38db1352-5ffc-4f37-b785-fd1c61e5a740", "gate_id": "H5-governance", "status": "running", "reason": "Writing append-only decision audit", "evidence": {}}
{"timestamp": "2026-07-10T14:14:25Z", "trace_id": "38db1352-5ffc-4f37-b785-fd1c61e5a740", "gate_id": "H5-governance", "status": "pass", "reason": "Decision audit recorded", "evidence": {"decision": "DENIED", "audit_seq": 1, "audit_hash": "21e680feef6579237c8a922712245afe8311c59e74d61523f8781535fcc35130"}}
{"timestamp": "2026-07-10T14:14:25Z", "trace_id": "38db1352-5ffc-4f37-b785-fd1c61e5a740", "gate_id": "H6-agentops", "status": "running", "reason": "Recording runtime metrics", "evidence": {}}
{"timestamp": "2026-07-10T14:14:25Z", "trace_id": "38db1352-5ffc-4f37-b785-fd1c61e5a740", "gate_id": "H6-agentops", "status": "error", "reason": "Runtime metrics recorded", "evidence": {"latency_ms": 90, "status": "failed", "synthesis_mode": "deterministic"}}
{"timestamp": "2026-07-10T14:14:25Z", "trace_id": "38db1352-5ffc-4f37-b785-fd1c61e5a740", "gate_id": "H7-orchestration", "status": "blocked", "reason": "Harness stopped with governed outcome", "evidence": {"decision": "DENIED", "certified": false}}
@@ -0,0 +1,2 @@
{"timestamp":"2026-07-10T14:12:40Z","trace_id":"27486dfc-3f1a-40da-a239-9d3f5ef75496","harness":"H4-security","mode":"input","status":"pass","action":"allow","risk_level":"low","input_hash":"2f2fcdae3b44f5ba01fc31a7ee39b66b0f752ae567f4c84d7964d94c6f2f79f0","output_hash":"2f2fcdae3b44f5ba01fc31a7ee39b66b0f752ae567f4c84d7964d94c6f2f79f0"}
{"timestamp":"2026-07-10T14:12:45Z","trace_id":"dac69766-9c81-49bc-8a11-4659dcf7dfdd","harness":"H4-security","mode":"output","status":"pass","action":"allow","risk_level":"low","input_hash":"c79023a4034447e036f4a5fc1d38323b5d7bebdad17bcf6f8bc990fd33389319","output_hash":"c79023a4034447e036f4a5fc1d38323b5d7bebdad17bcf6f8bc990fd33389319"}
+1
View File
@@ -0,0 +1 @@
4f5f5d965fc38522128bfff17058c9ce133edef023901afb3b75b9036470cc43
@@ -0,0 +1 @@
{"seq": 1, "timestamp": "2026-07-10T14:12:45Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "chat_id": "phase2-smoke", "turn_id": "turn-d73c565f-19e", "tenant_id": "default", "actor": "phase2-smoke", "mode": "READ_ONLY", "risk": "low", "decision": "ANSWERED", "router": {"mode": "READ_ONLY", "risk": "low", "gates": ["H4_INPUT", "H4_OUTPUT", "H5_CHAT_AUDIT", "H6_TOKEN"], "needs_approval": false, "reason": "read_only_terms", "matched_rules": ["casan"], "side_effect_allowed": false, "classified_at": "2026-07-10T14:12:40Z"}, "user_msg_ref": "2f2fcdae3b44f5ba01fc31a7ee39b66b0f752ae567f4c84d7964d94c6f2f79f0", "safe_preview": "Tóm tắt kiến trúc CASAN", "answer_ref": "c79023a4034447e036f4a5fc1d38323b5d7bebdad17bcf6f8bc990fd33389319", "answer_preview": "Ask CASAN read-only answer (evidence-backed):\n- docs/plans/CASAN_PLAN_01_RESTRUCTURE.md:7 — > `PASS=64 FAIL=0 SKIP=3`. Nền cho Plan-06/12 sẵn sàng (`project-registry.json` có `doma", "synthesis_mode": "deterministic", "sources": [{"path": "docs/plans/CASAN_PLAN_01_RESTRUCTURE.md", "line": 7}, {"path": "docs/plans/CASAN_PLAN_10_TRACEABILITY_EVAL.md", "line": 1}, {"path": "docs/plans/CASAN_PLAN_13_CONTROL_PLANE.md", "line": 4}, {"path": "docs/output/casan/WHY-81-TO-90-DEEP-DIVE.md", "line": 30}, {"path": "docs/output/casan/phase3-push-to-90-plan.md", "line": 1}], "prev_hash": "0000000000000000000000000000000000000000000000000000000000000000", "record_hash": "4f5f5d965fc38522128bfff17058c9ce133edef023901afb3b75b9036470cc43"}
+1
View File
@@ -0,0 +1 @@
{"timestamp": "2026-07-10T14:12:45Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "harness": "H6-agentops", "agent": "chat.ask-casan", "step": "ask-casan-readonly", "status": "success", "exit_code": 0, "latency_ms": 5690, "retry_count": 0, "input_tokens": 5, "output_tokens": 49, "total_tokens": 54, "cost_estimate": 0.0, "cost_source": "readonly_word_count", "synthesis_mode": "deterministic", "hallucination_signals": 0, "alerts": [], "input_hash": "2f2fcdae3b44f5ba01fc31a7ee39b66b0f752ae567f4c84d7964d94c6f2f79f0", "output_hash": "c79023a4034447e036f4a5fc1d38323b5d7bebdad17bcf6f8bc990fd33389319"}
@@ -0,0 +1,14 @@
{"timestamp": "2026-07-10T14:12:40Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H1-context", "status": "running", "reason": "Classifying prompt contract", "evidence": {}}
{"timestamp": "2026-07-10T14:12:40Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H1-context", "status": "pass", "reason": "read_only_terms", "evidence": {"mode": "READ_ONLY", "risk": "low"}}
{"timestamp": "2026-07-10T14:12:40Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H4-security", "status": "running", "reason": "Scanning input boundary", "evidence": {}}
{"timestamp": "2026-07-10T14:12:44Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H4-security", "status": "running", "reason": "Input passed; output scan pending", "evidence": {"input_scan": "pass"}}
{"timestamp": "2026-07-10T14:12:44Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H2-tool", "status": "running", "reason": "Retrieving allowlisted evidence", "evidence": {}}
{"timestamp": "2026-07-10T14:12:44Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H2-tool", "status": "pass", "reason": "Allowlisted evidence prepared", "evidence": {"source_count": 5, "history_available": false}}
{"timestamp": "2026-07-10T14:12:44Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H3-eval", "status": "running", "reason": "Synthesizing grounded answer", "evidence": {}}
{"timestamp": "2026-07-10T14:12:44Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H3-eval", "status": "pass", "reason": "Grounded synthesis completed", "evidence": {"mode": "deterministic", "provider": "deterministic", "model": "none", "source_count": 5}}
{"timestamp": "2026-07-10T14:12:45Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H4-security", "status": "pass", "reason": "Input and output security scans passed", "evidence": {}}
{"timestamp": "2026-07-10T14:12:45Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H5-governance", "status": "running", "reason": "Writing append-only decision audit", "evidence": {}}
{"timestamp": "2026-07-10T14:12:45Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H5-governance", "status": "pass", "reason": "Decision audit recorded", "evidence": {"decision": "ANSWERED", "audit_seq": 1, "audit_hash": "4f5f5d965fc38522128bfff17058c9ce133edef023901afb3b75b9036470cc43"}}
{"timestamp": "2026-07-10T14:12:45Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H6-agentops", "status": "running", "reason": "Recording runtime metrics", "evidence": {}}
{"timestamp": "2026-07-10T14:12:45Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H6-agentops", "status": "pass", "reason": "Runtime metrics recorded", "evidence": {"latency_ms": 5690, "status": "success", "synthesis_mode": "deterministic"}}
{"timestamp": "2026-07-10T14:12:45Z", "trace_id": "d73c565f-19ec-4ada-bf69-5fad89cfa282", "gate_id": "H7-orchestration", "status": "pass", "reason": "Harness turn completed", "evidence": {"decision": "ANSWERED", "certified": true}}
@@ -0,0 +1,12 @@
{
"trace_id": "27486dfc-3f1a-40da-a239-9d3f5ef75496",
"timestamp": "2026-07-10T14:12:40Z",
"harness": "H4-security",
"mode": "input",
"status": "pass",
"action": "allow",
"risk_level": "low",
"matched_rules": [],
"input_hash": "2f2fcdae3b44f5ba01fc31a7ee39b66b0f752ae567f4c84d7964d94c6f2f79f0",
"output_hash": "2f2fcdae3b44f5ba01fc31a7ee39b66b0f752ae567f4c84d7964d94c6f2f79f0"
}
@@ -0,0 +1,12 @@
{
"trace_id": "dac69766-9c81-49bc-8a11-4659dcf7dfdd",
"timestamp": "2026-07-10T14:12:45Z",
"harness": "H4-security",
"mode": "output",
"status": "pass",
"action": "allow",
"risk_level": "low",
"matched_rules": [],
"input_hash": "c79023a4034447e036f4a5fc1d38323b5d7bebdad17bcf6f8bc990fd33389319",
"output_hash": "c79023a4034447e036f4a5fc1d38323b5d7bebdad17bcf6f8bc990fd33389319"
}