feat(devkit): enforce governed prompt adoption

This commit is contained in:
thanhnv
2026-07-21 23:40:26 +07:00
parent 4d5dca9400
commit 7b2ba60a3a
16 changed files with 622 additions and 12 deletions
@@ -115,6 +115,22 @@ python3 "$RESOLVER" verify-audit > "$WORK/audit.out" \
&& grep -q "CHAT_AGENT_AUDIT ok=true" "$WORK/audit.out" \
&& pass "agent binding audit hash chain verifies" || fail "agent binding audit invalid"
set +e
python3 "$TURN" ask --message "Show project status" --role viewer --actor telemetry-test \
--project okr --chat-id project-telemetry --tenant default > "$WORK/project-turn.json"
RC=$?
set -e 2>/dev/null || true
python3 - "$WORK/project-turn.json" "$WORK/state/logs/cost/metrics.jsonl" "$RC" <<'PY' \
&& pass "chat-turn attributes H6 telemetry to the adopted project" || fail "H6 project attribution missing"
import json, sys
result = json.loads(open(sys.argv[1], encoding="utf-8").read().splitlines()[-1])
rows = [json.loads(line) for line in open(sys.argv[2], encoding="utf-8") if line.strip()]
matches = [row for row in rows if row.get("trace_id") == result.get("trace_id")]
assert int(sys.argv[3]) in (0, 2)
assert result["project_id"] == "okr"
assert matches and matches[-1]["project"] == "okr" and matches[-1]["project_id"] == "okr"
PY
echo ""
echo "===== CHAT AGENT SUMMARY: PASS=$PASS FAIL=$FAIL ====="
[[ "$FAIL" -eq 0 ]] || exit 1