feat: chat + optmz control panel
This commit is contained in:
@@ -106,7 +106,38 @@ assert d["decision"] == "DENIED"
|
||||
assert d["mode"] == "BLOCK"
|
||||
PY
|
||||
|
||||
# 5) Model OUTPUT still flows through the H4 output scan (no governance bypass):
|
||||
# 5) Gateway/cloud model failure falls back to the configured local model before
|
||||
# CASAN uses deterministic synthesis. This keeps an OmniRoute outage from taking
|
||||
# down an otherwise healthy local Ollama deployment.
|
||||
FALLBACK_CFG="$WORK/fallback-providers.json"
|
||||
cat > "$FALLBACK_CFG" <<'EOF'
|
||||
{"providers":{"gateway":{"model":"fake:gateway","class":"gateway","requires_preflight":true},"local":{"model":"fake:local","class":"local"}},"role_bindings":{"read_only":"gateway"}}
|
||||
EOF
|
||||
FALLBACK_STUB="$WORK/fallback-router.sh"
|
||||
cat > "$FALLBACK_STUB" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
OUT="$2"
|
||||
MODEL="${6:-}"
|
||||
if [[ "$MODEL" == "fake:gateway" ]]; then
|
||||
echo "gateway unavailable" >&2
|
||||
exit 2
|
||||
fi
|
||||
printf '{"text":"Local fallback answer.","input_tokens":31,"output_tokens":9}\n' > "$OUT"
|
||||
EOF
|
||||
chmod +x "$FALLBACK_STUB"
|
||||
CASAN_CHAT_MODEL_MODE=model CASAN_MODEL_PROVIDERS_FILE="$FALLBACK_CFG" CASAN_CHAT_MODEL_ROUTER="$FALLBACK_STUB" \
|
||||
python3 "$CHAT" ask --message "Summarize Plan 18 MVP-0 evidence" --actor alice --chat-id m5 > "$WORK/local-fallback.json"
|
||||
python3 - "$WORK/local-fallback.json" <<'PY' \
|
||||
&& pass "gateway failure falls back to local model" || fail "gateway-to-local fallback failed"
|
||||
import json, sys
|
||||
d = json.load(open(sys.argv[1]))
|
||||
assert d["success"] is True and d["synthesis"]["mode"] == "model", d
|
||||
assert d["synthesis"]["provider"] == "local", d["synthesis"]
|
||||
assert d["synthesis"]["fallback_from"] == "gateway", d["synthesis"]
|
||||
assert "Local fallback answer" in d["answer"], d["answer"]
|
||||
PY
|
||||
|
||||
# 6) Model OUTPUT still flows through the H4 output scan (no governance bypass):
|
||||
# a planted AWS key in the model text must be caught — the turn is DENIED
|
||||
# fail-closed and the raw secret never reaches the user.
|
||||
CASAN_CHAT_MODEL_MODE=model CASAN_CHAT_MODEL_ROUTER="$STUB" \
|
||||
|
||||
Reference in New Issue
Block a user