@kontourai/flow-agents 2.3.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/CODEOWNERS +16 -0
- package/.github/workflows/ci.yml +44 -0
- package/.github/workflows/trust-reconcile.yml +62 -4
- package/AGENTS.md +4 -4
- package/CHANGELOG.md +62 -0
- package/CONTEXT.md +35 -0
- package/README.md +9 -3
- package/agents/dev.json +1 -1
- package/agents/tool-code-reviewer.json +1 -1
- package/agents/tool-planner.json +3 -3
- package/agents/tool-verifier.json +3 -3
- package/build/src/cli/assignment-provider.d.ts +1 -0
- package/build/src/cli/assignment-provider.js +748 -0
- package/build/src/cli/console-learning-projection.js +3 -2
- package/build/src/cli/effective-assignment-provider-settings.d.ts +1 -0
- package/build/src/cli/effective-assignment-provider-settings.js +125 -0
- package/build/src/cli/init.js +104 -21
- package/build/src/cli/kit.js +37 -6
- package/build/src/cli/pull-work-provider.js +1 -1
- package/build/src/cli/usage-feedback.js +3 -3
- package/build/src/cli/validate-hook-influence.js +1 -0
- package/build/src/cli/validate-workflow-artifacts.js +27 -7
- package/build/src/cli/workflow-artifact-cleanup-audit.js +36 -2
- package/build/src/cli/workflow-sidecar.d.ts +14 -7
- package/build/src/cli/workflow-sidecar.js +938 -168
- package/build/src/cli.js +6 -0
- package/build/src/flow-kit/validate.d.ts +23 -0
- package/build/src/flow-kit/validate.js +67 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +1 -1
- package/build/src/lib/flow-resolver.d.ts +6 -4
- package/build/src/lib/flow-resolver.js +125 -58
- package/build/src/lib/local-artifact-root.d.ts +14 -2
- package/build/src/lib/local-artifact-root.js +22 -5
- package/build/src/lib/workflow-learning-projection.js +2 -2
- package/build/src/runtime-adapters.d.ts +12 -0
- package/build/src/runtime-adapters.js +56 -16
- package/build/src/tools/build-universal-bundles.js +49 -16
- package/build/src/tools/generate-context-map.js +10 -8
- package/build/src/tools/validate-source-tree.js +24 -1
- package/console.telemetry.json +22 -0
- package/context/contracts/artifact-contract.md +40 -7
- package/context/contracts/assignment-provider-contract.md +239 -0
- package/context/contracts/builder-kit-workflow-state-contract.md +5 -2
- package/context/contracts/decision-registry-contract.md +265 -0
- package/context/contracts/delivery-contract.md +3 -1
- package/context/contracts/execution-contract.md +25 -0
- package/context/contracts/governance-adapter-contract.md +2 -0
- package/context/contracts/knowledge-store-contract.md +197 -0
- package/context/contracts/planning-contract.md +4 -1
- package/context/contracts/review-contract.md +7 -3
- package/context/contracts/sandbox-policy.md +2 -0
- package/context/contracts/standing-directives.md +13 -0
- package/context/contracts/verification-contract.md +11 -1
- package/context/contracts/work-item-contract.md +3 -1
- package/context/deferred/parallelization.md +1 -1
- package/context/gate-awareness.md +4 -4
- package/context/scripts/git-status.sh +2 -2
- package/context/scripts/hooks/config-protection.js +502 -2
- package/context/scripts/hooks/lib/config-protection-remedies.js +69 -0
- package/context/scripts/hooks/run-hook.js +14 -1
- package/context/scripts/hooks/stop-goal-fit.js +1140 -99
- package/context/scripts/hooks/workflow-steering.js +212 -6
- package/context/settings/assignment-provider-settings.json +33 -0
- package/docs/adr/0007-flow-skill-kit-tool-boundary.md +2 -0
- package/docs/adr/0015-flow-flow-agents-boundary-reconciliation.md +35 -0
- package/docs/adr/0019-kit-dependency-ownership.md +62 -0
- package/docs/adr/0020-trust-reconcile-manifest-and-claim-classification.md +290 -0
- package/docs/adr/0021-assignment-leases-and-stale-claim-takeover.md +221 -0
- package/docs/adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md +463 -0
- package/docs/agent-system-guidebook.md +3 -3
- package/docs/agent-usage-feedback-loop.md +6 -6
- package/docs/context-map.md +10 -7
- package/docs/decisions/decision-records.md +57 -0
- package/docs/decisions/index.md +17 -0
- package/docs/decisions/knowledge-store-provider.md +51 -0
- package/docs/decisions/model-routing.md +63 -0
- package/docs/decisions/promotion-gate.md +52 -0
- package/docs/decisions/standing-directives.md +66 -0
- package/docs/developer-architecture.md +1 -1
- package/docs/fixture-ownership.md +4 -0
- package/docs/flow-kit-repository-contract.md +5 -5
- package/docs/getting-started.md +12 -2
- package/docs/integrations/harness-install.md +2 -1
- package/docs/kit-authoring-guide.md +64 -5
- package/docs/knowledge-kit.md +5 -1
- package/docs/learnings/2026-07-improvement-program.md +203 -0
- package/docs/migrations.md +6 -5
- package/docs/north-star.md +2 -2
- package/docs/operating-layers.md +4 -3
- package/docs/repository-structure.md +5 -5
- package/docs/skills-map.md +8 -8
- package/docs/spec/runtime-hook-surface.md +19 -15
- package/docs/spikes/graph-provider-2026-07.md +155 -0
- package/docs/standards-register.md +7 -7
- package/docs/trust-anchor-adoption.md +105 -4
- package/docs/work-item-adapters.md +1 -1
- package/docs/workflow-artifact-lifecycle.md +72 -9
- package/docs/workflow-eval-strategy.md +3 -3
- package/docs/workflow-shared-contracts.md +3 -2
- package/docs/workflow-usage-guide.md +260 -21
- package/evals/acceptance/DEMO-false-completion.md +20 -11
- package/evals/acceptance/prove-capture-teeth-declared.sh +15 -15
- package/evals/acceptance/prove-capture-teeth.sh +11 -11
- package/evals/acceptance/test_kiro_harness.sh +1 -1
- package/evals/ci/antigaming-suite.sh +5 -0
- package/evals/ci/run-baseline.sh +71 -1
- package/evals/fixtures/assignment-provider/actor-a.json +6 -0
- package/evals/fixtures/assignment-provider/actor-b.json +6 -0
- package/evals/fixtures/assignment-provider/github-issue-claimed.json +27 -0
- package/evals/fixtures/assignment-provider/github-issue-unassigned.json +7 -0
- package/evals/fixtures/assignment-provider/liveness-fresh.json +9 -0
- package/evals/fixtures/assignment-provider/liveness-stale.json +9 -0
- package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/flows/review.flow.json +26 -0
- package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/kit.json +13 -0
- package/evals/fixtures/flow-kit-repository/valid-with-dependency/flows/review.flow.json +26 -0
- package/evals/fixtures/flow-kit-repository/valid-with-dependency/kit.json +13 -0
- package/evals/fixtures/hook-influence/cases.json +32 -0
- package/evals/fixtures/pull-work-provider/github-issues.json +6 -6
- package/evals/fixtures/trust-reconcile-exploits/fabricated-attestation.json +59 -0
- package/evals/fixtures/trust-reconcile-exploits/no-label-bypass.json +36 -0
- package/evals/fixtures/trust-reconcile-exploits/skip-assumed-bypass.json +59 -0
- package/evals/fixtures/trust-reconcile-exploits/status-misassertion.json +48 -0
- package/evals/fixtures/trust-reconcile-exploits/waived-command-check.json +44 -0
- package/evals/fixtures/trust-reconcile-mixed-bundle/mixed-bundle.json +159 -0
- package/evals/fixtures/trust-reconcile-ws3/ws3-bundle.json +920 -0
- package/evals/integration/test_actor_identity.sh +254 -0
- package/evals/integration/test_assignment_provider_github.sh +318 -0
- package/evals/integration/test_assignment_provider_local_file.sh +222 -0
- package/evals/integration/test_builder_step_producers.sh +33 -23
- package/evals/integration/test_bundle_install.sh +22 -16
- package/evals/integration/test_bundle_lifecycle.sh +11 -11
- package/evals/integration/test_captured_fail_reconciliation.sh +50 -50
- package/evals/integration/test_checkpoint_signing.sh +43 -0
- package/evals/integration/test_claim_lookup.sh +4 -4
- package/evals/integration/test_codex_hook_resolution.sh +114 -0
- package/evals/integration/test_command_log_concurrency.sh +8 -8
- package/evals/integration/test_command_log_fork_classification.sh +3 -3
- package/evals/integration/test_command_log_integrity.sh +16 -16
- package/evals/integration/test_console_learning_projection.sh +1 -1
- package/evals/integration/test_critique_supersession_roundtrip.sh +182 -0
- package/evals/integration/test_dual_emit_flow_step.sh +145 -0
- package/evals/integration/test_enforcer_expects_driven.sh +12 -12
- package/evals/integration/test_evidence_capture_hook.sh +14 -13
- package/evals/integration/test_fixture_retirement_audit.sh +2 -2
- package/evals/integration/test_flow_agents_statusline.sh +2 -2
- package/evals/integration/test_flow_kit_install_git.sh +52 -0
- package/evals/integration/test_flow_kit_repository.sh +2 -0
- package/evals/integration/test_flowdef_session_activation.sh +6 -6
- package/evals/integration/test_flowdef_union_floor_regression.sh +429 -0
- package/evals/integration/test_gate_bypass_chain.sh +52 -40
- package/evals/integration/test_gate_lockdown.sh +97 -73
- package/evals/integration/test_gate_review_inquiry_records.sh +3 -3
- package/evals/integration/test_goal_fit_escape_hatch.sh +10 -10
- package/evals/integration/test_goal_fit_ghost_session.sh +104 -0
- package/evals/integration/test_goal_fit_hook.sh +32 -32
- package/evals/integration/test_goal_fit_rederive.sh +9 -9
- package/evals/integration/test_hook_category_behaviors.sh +103 -0
- package/evals/integration/test_hook_influence_cases.sh +1 -0
- package/evals/integration/test_install_merge.sh +262 -1
- package/evals/integration/test_kit_identity_trust.sh +6 -6
- package/evals/integration/test_liveness_conflict_injection.sh +587 -0
- package/evals/integration/test_liveness_heartbeat.sh +677 -0
- package/evals/integration/test_liveness_verdict.sh +394 -0
- package/evals/integration/test_local_flow_kit_install.sh +15 -0
- package/evals/integration/test_phase_map_and_gate_claim.sh +63 -11
- package/evals/integration/test_promote_gate.sh +178 -0
- package/evals/integration/test_publish_delivery.sh +23 -6
- package/evals/integration/test_pull_work_assignment_join.sh +132 -0
- package/evals/integration/test_pull_work_liveness_preflight.sh +394 -0
- package/evals/integration/test_pull_work_provider.sh +2 -2
- package/evals/integration/test_reconcile_soundness.sh +37 -13
- package/evals/integration/test_resolvefirststep_security.sh +22 -0
- package/evals/integration/test_runtime_adapter_activation.sh +87 -18
- package/evals/integration/test_session_resume_roundtrip.sh +147 -0
- package/evals/integration/test_sidecar_field_preservation.sh +249 -0
- package/evals/integration/test_trust_reconcile.sh +11 -10
- package/evals/integration/test_trust_reconcile_manifest.sh +79 -0
- package/evals/integration/test_trust_reconcile_mixed_bundle.sh +96 -0
- package/evals/integration/test_trust_reconcile_negatives.sh +759 -0
- package/evals/integration/test_usage_feedback_global.sh +5 -5
- package/evals/integration/test_validate_artifacts_portability.sh +60 -0
- package/evals/integration/test_verify_cli.sh +2 -2
- package/evals/integration/test_veritas_governance_kit.sh +117 -0
- package/evals/integration/test_workflow_artifact_cleanup_audit.sh +26 -1
- package/evals/integration/test_workflow_artifacts.sh +33 -0
- package/evals/integration/test_workflow_sidecar_writer.sh +802 -74
- package/evals/integration/test_workflow_steering_hook.sh +175 -5
- package/evals/lib/codex-provider.sh +1 -1
- package/evals/lib/node.sh +19 -1
- package/evals/run.sh +32 -0
- package/evals/static/test_decisions.sh +150 -0
- package/evals/static/test_flowdef_codeowners_coverage.sh +62 -0
- package/evals/static/test_knowledge_providers.sh +23 -0
- package/evals/static/test_package.sh +19 -10
- package/evals/static/test_universal_bundles.sh +48 -3
- package/evals/static/test_workflow_skills.sh +41 -8
- package/kits/builder/flows/build.flow.json +3 -74
- package/kits/builder/flows/publish-learn.flow.json +90 -0
- package/kits/builder/kit.json +11 -0
- package/kits/builder/skills/builder-shape/SKILL.md +1 -1
- package/kits/builder/skills/deliver/SKILL.md +32 -11
- package/kits/builder/skills/design-probe/SKILL.md +4 -4
- package/kits/builder/skills/evidence-gate/SKILL.md +26 -1
- package/kits/builder/skills/execute-plan/SKILL.md +2 -2
- package/kits/builder/skills/fix-bug/SKILL.md +2 -0
- package/kits/builder/skills/gate-review/SKILL.md +6 -6
- package/kits/builder/skills/idea-to-backlog/SKILL.md +1 -1
- package/kits/builder/skills/learning-review/SKILL.md +7 -7
- package/kits/builder/skills/pickup-probe/SKILL.md +5 -4
- package/kits/builder/skills/plan-work/SKILL.md +27 -5
- package/kits/builder/skills/pull-work/SKILL.md +148 -5
- package/kits/builder/skills/release-readiness/SKILL.md +4 -4
- package/kits/builder/skills/review-work/SKILL.md +24 -1
- package/kits/builder/skills/tdd-workflow/SKILL.md +2 -0
- package/kits/builder/skills/verify-work/SKILL.md +8 -1
- package/kits/catalog.json +6 -0
- package/kits/knowledge/kit.json +35 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/CONTEXT.md +12 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/old-sprocket-shape.md +13 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/sprocket-shape.md +14 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/widget-format.md +14 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/learnings/fixture-learning.md +7 -0
- package/kits/knowledge/providers/conformance/fixtures/work-item/issues.json +30 -0
- package/kits/knowledge/providers/conformance/suite.test.js +125 -0
- package/kits/knowledge/providers/git-repo/index.js +236 -0
- package/kits/knowledge/providers/health/health-pass.test.js +99 -0
- package/kits/knowledge/providers/health/index.js +153 -0
- package/kits/knowledge/providers/index.js +24 -0
- package/kits/knowledge/providers/lib/model.js +91 -0
- package/kits/knowledge/providers/lib/schema-validate.js +119 -0
- package/kits/knowledge/providers/markdown-vault/index.js +169 -0
- package/kits/knowledge/providers/work-item/index.js +204 -0
- package/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +178 -0
- package/kits/veritas-governance/docs/README.md +75 -0
- package/kits/veritas-governance/fixtures/readiness/not-ready.readiness-report.json +4645 -0
- package/kits/veritas-governance/fixtures/readiness/ready.readiness-report.json +4403 -0
- package/kits/veritas-governance/flows/readiness-check.flow.json +35 -0
- package/kits/veritas-governance/kit.json +16 -0
- package/package.json +11 -5
- package/packaging/README.md +2 -2
- package/packaging/conformance/fixtures/config-protection--allow-read-state-json.json +20 -0
- package/packaging/conformance/fixtures/config-protection--block-write-state-json.json +20 -0
- package/packaging/conformance/fixtures/stop-goal-fit--block-bundle-disputed-claim.json +1 -1
- package/packaging/conformance/fixtures/stop-goal-fit--block-capture-contradicts-claimed-pass.json +1 -1
- package/packaging/manifest.json +9 -10
- package/schemas/assignment-provider-settings.schema.json +125 -0
- package/schemas/decision-record.schema.json +109 -0
- package/schemas/knowledge/edge.schema.json +54 -0
- package/schemas/knowledge/health-report.schema.json +45 -0
- package/schemas/knowledge/node.schema.json +49 -0
- package/schemas/knowledge/proposal.schema.json +53 -0
- package/schemas/workflow-evidence.schema.json +1 -1
- package/schemas/workflow-state.schema.json +5 -0
- package/scripts/README.md +8 -3
- package/scripts/check-content-boundary.cjs +1 -1
- package/scripts/check-decisions.cjs +356 -0
- package/scripts/ci/derive-claim-status.mjs +74 -0
- package/scripts/ci/trust-reconcile.js +957 -103
- package/scripts/git-status.sh +2 -2
- package/scripts/hooks/claude-telemetry-hook.js +37 -3
- package/scripts/hooks/codex-telemetry-hook.js +36 -2
- package/scripts/hooks/config-protection.js +102 -30
- package/scripts/hooks/evidence-capture.js +3 -3
- package/scripts/hooks/lib/actor-identity.js +368 -0
- package/scripts/hooks/lib/config-protection-remedies.js +69 -0
- package/scripts/hooks/lib/liveness-heartbeat.js +361 -0
- package/scripts/hooks/lib/liveness-policy.js +127 -0
- package/scripts/hooks/lib/liveness-read.js +105 -12
- package/scripts/hooks/lib/liveness-write.js +46 -0
- package/scripts/hooks/lib/local-artifact-paths.js +12 -6
- package/scripts/hooks/opencode-telemetry-hook.js +27 -1
- package/scripts/hooks/pi-telemetry-hook.js +27 -1
- package/scripts/hooks/stop-goal-fit.js +157 -26
- package/scripts/hooks/workflow-steering.js +77 -3
- package/scripts/install-codex-home.sh +138 -38
- package/scripts/statusline/flow-agents-statusline.js +2 -2
- package/src/cli/assignment-provider.ts +845 -0
- package/src/cli/console-learning-projection.ts +3 -2
- package/src/cli/effective-assignment-provider-settings.ts +112 -0
- package/src/cli/init.ts +101 -21
- package/src/cli/kit.ts +37 -6
- package/src/cli/public-api.test.mjs +58 -6
- package/src/cli/pull-work-provider.ts +1 -1
- package/src/cli/trust-bundle-policy-order.test.mjs +87 -0
- package/src/cli/usage-feedback.ts +3 -3
- package/src/cli/validate-hook-influence.ts +1 -0
- package/src/cli/validate-workflow-artifacts.ts +27 -7
- package/src/cli/veritas-readiness-adapter.test.mjs +267 -0
- package/src/cli/workflow-artifact-cleanup-audit.ts +35 -2
- package/src/cli/workflow-sidecar.ts +933 -168
- package/src/cli.ts +6 -0
- package/src/flow-kit/validate.ts +74 -1
- package/src/index.ts +6 -2
- package/src/lib/flow-resolver.ts +123 -55
- package/src/lib/local-artifact-root.ts +24 -5
- package/src/lib/workflow-learning-projection.ts +2 -2
- package/src/runtime-adapters.ts +61 -15
- package/src/tools/build-universal-bundles.ts +49 -16
- package/src/tools/generate-context-map.ts +10 -8
- package/src/tools/validate-source-tree.ts +24 -1
|
@@ -32,11 +32,11 @@ trap cleanup EXIT
|
|
|
32
32
|
# ── helper: seed a minimal delivered workflow artifact ────────────────────────
|
|
33
33
|
seed_repo() { # $1=dir $2=slug
|
|
34
34
|
local p="$1" slug="$2"
|
|
35
|
-
mkdir -p "$p/.flow-agents/$slug"
|
|
35
|
+
mkdir -p "$p/.kontourai/flow-agents/$slug"
|
|
36
36
|
printf '# Repo\n' > "$p/AGENTS.md"
|
|
37
37
|
printf '%s' "{\"schema_version\":\"1.0\",\"task_slug\":\"$slug\",\"status\":\"delivered\",\"phase\":\"done\",\"updated_at\":\"2026-06-23T00:00:00Z\",\"next_action\":{\"status\":\"done\",\"summary\":\"done\"}}" \
|
|
38
|
-
> "$p/.flow-agents/$slug/state.json"
|
|
39
|
-
cat > "$p/.flow-agents/$slug/$slug--deliver.md" << MD
|
|
38
|
+
> "$p/.kontourai/flow-agents/$slug/state.json"
|
|
39
|
+
cat > "$p/.kontourai/flow-agents/$slug/$slug--deliver.md" << MD
|
|
40
40
|
# $slug
|
|
41
41
|
|
|
42
42
|
branch: main
|
|
@@ -71,12 +71,12 @@ echo "Test 1: altered entry (flip fail→pass without fixing hash) → broken
|
|
|
71
71
|
T1="$TMP/t1"; seed_repo "$T1" t1
|
|
72
72
|
write_chained_log "$T1" t1
|
|
73
73
|
|
|
74
|
-
LOG="$T1/.flow-agents/t1/command-log.jsonl"
|
|
74
|
+
LOG="$T1/.kontourai/flow-agents/t1/command-log.jsonl"
|
|
75
75
|
|
|
76
76
|
if [[ -f "$LOG" ]]; then _pass "T1: command-log.jsonl written"; else _fail "T1: command-log.jsonl missing"; fi
|
|
77
77
|
|
|
78
78
|
# Verify clean chain (before tamper)
|
|
79
|
-
chain_status=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T1/.flow-agents/t1'); console.log(r.status);")
|
|
79
|
+
chain_status=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T1/.kontourai/flow-agents/t1'); console.log(r.status);")
|
|
80
80
|
if [[ "$chain_status" == "ok" ]]; then
|
|
81
81
|
_pass "T1: untampered chain verifies as ok"
|
|
82
82
|
else
|
|
@@ -97,7 +97,7 @@ open(sys.argv[1], 'w').write('\n'.join(lines) + '\n')
|
|
|
97
97
|
PY
|
|
98
98
|
|
|
99
99
|
# Verify broken chain
|
|
100
|
-
chain_after=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T1/.flow-agents/t1'); console.log(r.status + ':' + r.brokenAt);")
|
|
100
|
+
chain_after=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T1/.kontourai/flow-agents/t1'); console.log(r.status + ':' + r.brokenAt);")
|
|
101
101
|
if [[ "$chain_after" == "broken:1" ]]; then
|
|
102
102
|
_pass "T1: tampered entry detected → broken at entry 1"
|
|
103
103
|
else
|
|
@@ -108,7 +108,7 @@ fi
|
|
|
108
108
|
# The tampered entry (lint) was a FAIL flipped to PASS — so the log now shows a false pass.
|
|
109
109
|
# Since chain is broken, gate should block with integrity warning and NOT trust log passes.
|
|
110
110
|
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"npm-test","kind":"command","status":"pass","command":"npm test","summary":"passed"}]}' \
|
|
111
|
-
> "$T1/.flow-agents/t1/evidence.json"
|
|
111
|
+
> "$T1/.kontourai/flow-agents/t1/evidence.json"
|
|
112
112
|
|
|
113
113
|
set +e
|
|
114
114
|
gate_out=$(FLOW_AGENTS_GOAL_FIT_MODE=block FLOW_AGENTS_GOAL_FIT_BACKSTOP=skip \
|
|
@@ -141,7 +141,7 @@ echo "Test 2: removed/reordered entry → linkage breaks → broken → gate fla
|
|
|
141
141
|
T2="$TMP/t2"; seed_repo "$T2" t2
|
|
142
142
|
write_chained_log "$T2" t2
|
|
143
143
|
|
|
144
|
-
LOG2="$T2/.flow-agents/t2/command-log.jsonl"
|
|
144
|
+
LOG2="$T2/.kontourai/flow-agents/t2/command-log.jsonl"
|
|
145
145
|
lines_before=$(wc -l < "$LOG2" | tr -d ' ')
|
|
146
146
|
|
|
147
147
|
# Reorder: swap entry 0 and entry 1
|
|
@@ -153,7 +153,7 @@ lines[0], lines[1] = lines[1], lines[0]
|
|
|
153
153
|
open(sys.argv[1], 'w').write('\n'.join(lines) + '\n')
|
|
154
154
|
PY
|
|
155
155
|
|
|
156
|
-
chain_reorder=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T2/.flow-agents/t2'); console.log(r.status);")
|
|
156
|
+
chain_reorder=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T2/.kontourai/flow-agents/t2'); console.log(r.status);")
|
|
157
157
|
if [[ "$chain_reorder" == "broken" ]]; then
|
|
158
158
|
_pass "T2: reordered entries detected → broken"
|
|
159
159
|
else
|
|
@@ -163,7 +163,7 @@ fi
|
|
|
163
163
|
# Test: delete middle entry (restore then delete entry 0 so entry 1's prevHash is wrong)
|
|
164
164
|
write_chained_log "$T2" t2 # re-append fresh entries (now 4 total — but that's fine for test)
|
|
165
165
|
# Write a fresh log with just 2 entries and then delete the first
|
|
166
|
-
LOG2_FRESH="$T2/.flow-agents/t2/command-log.jsonl"
|
|
166
|
+
LOG2_FRESH="$T2/.kontourai/flow-agents/t2/command-log.jsonl"
|
|
167
167
|
python3 - "$LOG2_FRESH" << 'PY'
|
|
168
168
|
import sys
|
|
169
169
|
lines = [l for l in open(sys.argv[1]).read().strip().split('\n') if l.strip()]
|
|
@@ -173,7 +173,7 @@ last2 = lines[-2:]
|
|
|
173
173
|
open(sys.argv[1], 'w').write(last2[1] + '\n')
|
|
174
174
|
PY
|
|
175
175
|
|
|
176
|
-
chain_delete=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T2/.flow-agents/t2'); console.log(r.status);")
|
|
176
|
+
chain_delete=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T2/.kontourai/flow-agents/t2'); console.log(r.status);")
|
|
177
177
|
if [[ "$chain_delete" == "broken" ]]; then
|
|
178
178
|
_pass "T2: removed predecessor entry detected → broken (prevHash mismatch)"
|
|
179
179
|
else
|
|
@@ -191,7 +191,7 @@ printf '{"hook_event_name":"PostToolUse","tool_name":"Bash","cwd":"%s","tool_inp
|
|
|
191
191
|
printf '{"hook_event_name":"PostToolUse","tool_name":"Bash","cwd":"%s","tool_input":{"command":"npm run build"},"tool_response":{"exitCode":1}}' "$T3" \
|
|
192
192
|
| node "$CAPTURE" >/dev/null 2>&1
|
|
193
193
|
|
|
194
|
-
chain_legit=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T3/.flow-agents/t3'); console.log(r.status);")
|
|
194
|
+
chain_legit=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T3/.kontourai/flow-agents/t3'); console.log(r.status);")
|
|
195
195
|
if [[ "$chain_legit" == "ok" ]]; then
|
|
196
196
|
_pass "T3: untampered chained log verifies ok"
|
|
197
197
|
else
|
|
@@ -200,7 +200,7 @@ fi
|
|
|
200
200
|
|
|
201
201
|
# Evidence claims npm run build passed (it actually failed → capture log shows fail → block)
|
|
202
202
|
printf '%s' '{"schema_version":"1.0","task_slug":"t3","verdict":"pass","checks":[{"id":"build","kind":"command","status":"pass","command":"npm run build","summary":"build passed"}]}' \
|
|
203
|
-
> "$T3/.flow-agents/t3/evidence.json"
|
|
203
|
+
> "$T3/.kontourai/flow-agents/t3/evidence.json"
|
|
204
204
|
|
|
205
205
|
set +e
|
|
206
206
|
gate3_out=$(FLOW_AGENTS_GOAL_FIT_MODE=block FLOW_AGENTS_GOAL_FIT_BACKSTOP=skip \
|
|
@@ -234,9 +234,9 @@ T4="$TMP/t4"; seed_repo "$T4" t4
|
|
|
234
234
|
|
|
235
235
|
# Write a legacy-style log (no _chain field) — exactly like pre-B2 fixtures
|
|
236
236
|
printf '%s\n' '{"command":"npm test","observedResult":"fail","exitCode":1,"capturedAt":"2026-06-23T00:00:00Z","source":"postToolUse-capture"}' \
|
|
237
|
-
> "$T4/.flow-agents/t4/command-log.jsonl"
|
|
237
|
+
> "$T4/.kontourai/flow-agents/t4/command-log.jsonl"
|
|
238
238
|
|
|
239
|
-
chain_legacy=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T4/.flow-agents/t4'); console.log(r.status);")
|
|
239
|
+
chain_legacy=$(node -e "const g = require('$GATE'); const r = g.verifyCommandLogChain('$T4/.kontourai/flow-agents/t4'); console.log(r.status);")
|
|
240
240
|
if [[ "$chain_legacy" == "legacy" ]]; then
|
|
241
241
|
_pass "T4: unchained (legacy) log returns legacy status"
|
|
242
242
|
else
|
|
@@ -245,7 +245,7 @@ fi
|
|
|
245
245
|
|
|
246
246
|
# Evidence claims npm test passed, but legacy log shows it failed → still blocks
|
|
247
247
|
printf '%s' '{"schema_version":"1.0","task_slug":"t4","verdict":"pass","checks":[{"id":"unit-tests","kind":"command","status":"pass","command":"npm test","summary":"passed"}]}' \
|
|
248
|
-
> "$T4/.flow-agents/t4/evidence.json"
|
|
248
|
+
> "$T4/.kontourai/flow-agents/t4/evidence.json"
|
|
249
249
|
|
|
250
250
|
set +e
|
|
251
251
|
gate4_out=$(FLOW_AGENTS_GOAL_FIT_MODE=block FLOW_AGENTS_GOAL_FIT_BACKSTOP=skip \
|
|
@@ -102,7 +102,7 @@ if jq -e --arg generated "$GENERATED_AT" '
|
|
|
102
102
|
.derivedFrom.eventHistory == "unavailable" and
|
|
103
103
|
.derivedFrom.directSnapshot.emittedAt == $generated and
|
|
104
104
|
.derivedFrom.directSnapshot.producer == {"id":"flow-agents-learning","product":"flow-agents"} and
|
|
105
|
-
.derivedFrom.directSnapshot.sourceRef == {"product":"flow-agents","kind":"workflow-learning","id":".flow-agents/*/learning.json","label":"Local workflow learning sidecars"} and
|
|
105
|
+
.derivedFrom.directSnapshot.sourceRef == {"product":"flow-agents","kind":"workflow-learning","id":".kontourai/flow-agents/*/learning.json","label":"Local workflow learning sidecars"} and
|
|
106
106
|
(.learnings | length) == 2
|
|
107
107
|
' "$PROJECTION" >/dev/null 2>&1; then
|
|
108
108
|
_pass "projection envelope includes Console schema, scope, producer, and direct snapshot provenance"
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_critique_supersession_roundtrip.sh — Regression evals for the trust-ledger defects
|
|
3
|
+
# fixed under #267 (critique supersession), #268 (lossless, type-stable check/critique
|
|
4
|
+
# round-trip), and #282 (first-class superseded_by affordance).
|
|
5
|
+
#
|
|
6
|
+
# Proves:
|
|
7
|
+
# (a) record-critique twice for the same id (fail → pass, SAME reviewer) supersedes the fail:
|
|
8
|
+
# the effective/live state is the pass, the historical fail is retained (status=superseded,
|
|
9
|
+
# metadata.superseded_by) but excluded from evaluation, no duplicate claim ids, and CI
|
|
10
|
+
# trust-reconcile exits 0.
|
|
11
|
+
# (b) HEADLINE: a --flow-id (builder.build/verify) session — ensure-session → record-evidence
|
|
12
|
+
# (mixed session-local kinds) → record-critique → trust-reconcile — exits 0. This exact flow
|
|
13
|
+
# could never converge before (critique claims were re-absorbed as command-less test_output
|
|
14
|
+
# checks → permanent [not-run] divergence; check kinds collapsed to the declared claimType).
|
|
15
|
+
# (c) record-evidence AFTER a critique preserves the critique history (previously hardcoded []).
|
|
16
|
+
# (d) ANTI-GAMING: a DIFFERENT reviewer cannot supersede a reviewer's fail — the disputed
|
|
17
|
+
# critique stays live and trust-reconcile still exits 1 (worker cannot bury a reviewer finding).
|
|
18
|
+
# (e) VALIDATOR (#282): a top-level pass tolerates a superseded historical fail member, but a
|
|
19
|
+
# LIVE (non-superseded) fail still triggers "required critique must pass".
|
|
20
|
+
#
|
|
21
|
+
# Deterministic, no model spend, self-cleaning.
|
|
22
|
+
# Usage: bash evals/integration/test_critique_supersession_roundtrip.sh
|
|
23
|
+
|
|
24
|
+
set -uo pipefail
|
|
25
|
+
|
|
26
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
27
|
+
source "$ROOT/evals/lib/node.sh"
|
|
28
|
+
RECON="$ROOT/scripts/ci/trust-reconcile.js"
|
|
29
|
+
WRITER="workflow-sidecar"
|
|
30
|
+
|
|
31
|
+
TMP="$(mktemp -d)"
|
|
32
|
+
errors=0
|
|
33
|
+
_pass() { echo " PASS: $1"; }
|
|
34
|
+
_fail() { echo " FAIL: $1"; errors=$((errors + 1)); }
|
|
35
|
+
cleanup() { rm -rf "$TMP"; }
|
|
36
|
+
trap cleanup EXIT
|
|
37
|
+
|
|
38
|
+
# seed <aroot> <slug> [flow-args...] — ensure-session + init-plan
|
|
39
|
+
seed() {
|
|
40
|
+
local aroot="$1"; local slug="$2"; shift 2
|
|
41
|
+
mkdir -p "$aroot"
|
|
42
|
+
flow_agents_node "$WRITER" ensure-session --artifact-root "$aroot" --task-slug "$slug" \
|
|
43
|
+
--title "T" --summary "S" --timestamp "2026-07-01T00:00:00Z" "$@" >/dev/null 2>&1
|
|
44
|
+
flow_agents_node "$WRITER" init-plan "$aroot/$slug/$slug--deliver.md" \
|
|
45
|
+
--source-request "R" --summary "S" --timestamp "2026-07-01T00:00:00Z" >/dev/null 2>&1
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# ─── (a) same-reviewer supersession: fail → pass ──────────────────────────────
|
|
49
|
+
echo ""
|
|
50
|
+
echo "=== (a) record-critique fail→pass (same reviewer) supersedes, history intact, reconcile 0 ==="
|
|
51
|
+
A_AROOT="$TMP/a/aroot"; A_SLUG="supersede-same"; A_DIR="$A_AROOT/$A_SLUG"
|
|
52
|
+
seed "$A_AROOT" "$A_SLUG"
|
|
53
|
+
flow_agents_node "$WRITER" record-evidence "$A_DIR" --verdict pass \
|
|
54
|
+
--check-json '{"id":"c1","kind":"diff","status":"pass","summary":"diff check"}' \
|
|
55
|
+
--timestamp "2026-07-01T00:01:00Z" >/dev/null 2>&1
|
|
56
|
+
flow_agents_node "$WRITER" record-critique "$A_DIR" --id rv --reviewer alice --verdict fail \
|
|
57
|
+
--summary "found a bug" --timestamp "2026-07-01T00:02:00Z" >/dev/null 2>&1
|
|
58
|
+
flow_agents_node "$WRITER" record-critique "$A_DIR" --id rv --reviewer alice --verdict pass \
|
|
59
|
+
--summary "bug fixed" --timestamp "2026-07-01T00:03:00Z" >/dev/null 2>&1
|
|
60
|
+
|
|
61
|
+
node - "$A_DIR/trust.bundle" << 'NODE'
|
|
62
|
+
const fs = require('fs');
|
|
63
|
+
const b = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
|
64
|
+
const crit = (b.claims||[]).filter(c => c.metadata && c.metadata.origin === 'critique');
|
|
65
|
+
const live = crit.filter(c => !c.metadata.superseded_by);
|
|
66
|
+
const hist = crit.filter(c => c.metadata.superseded_by);
|
|
67
|
+
if (crit.length !== 2) throw new Error('expected 2 critique claims (1 live + 1 history), got ' + crit.length);
|
|
68
|
+
if (live.length !== 1 || live[0].value !== 'pass') throw new Error('expected exactly 1 LIVE critique with value=pass, got ' + JSON.stringify(live.map(c=>c.value)));
|
|
69
|
+
if (hist.length !== 1 || hist[0].value !== 'fail' || hist[0].status !== 'superseded') throw new Error('expected historical fail with status=superseded');
|
|
70
|
+
if (!hist[0].metadata.superseded_by) throw new Error('history missing first-class metadata.superseded_by');
|
|
71
|
+
const ids = (b.claims||[]).map(c=>c.id); const dup = ids.filter((x,i)=>ids.indexOf(x)!==i);
|
|
72
|
+
if (dup.length) throw new Error('duplicate claim ids in bundle: ' + dup.join(','));
|
|
73
|
+
console.log('live=pass, history=fail(superseded), no duplicate ids');
|
|
74
|
+
NODE
|
|
75
|
+
if [[ $? -eq 0 ]]; then _pass "(a) effective state=pass, historical fail retained+superseded, no dup ids"; else _fail "(a) supersession/history assertion failed"; fi
|
|
76
|
+
|
|
77
|
+
TRUST_RECONCILE_COMMANDS="true" node "$RECON" --bundle "$A_DIR/trust.bundle" --repo-root "$TMP/a" >"$TMP/a-recon.log" 2>&1
|
|
78
|
+
if [[ $? -eq 0 ]]; then _pass "(a) trust-reconcile exits 0 (resolved session converges)"; else _fail "(a) trust-reconcile did NOT converge: $(cat "$TMP/a-recon.log")"; fi
|
|
79
|
+
|
|
80
|
+
# ─── (b) HEADLINE: --flow-id session converges ────────────────────────────────
|
|
81
|
+
echo ""
|
|
82
|
+
echo "=== (b) HEADLINE --flow-id builder.build/verify: mixed evidence + critique → reconcile 0 ==="
|
|
83
|
+
B_AROOT="$TMP/b/aroot"; B_SLUG="flowid-converge"; B_DIR="$B_AROOT/$B_SLUG"
|
|
84
|
+
seed "$B_AROOT" "$B_SLUG" --flow-id builder.build --step-id verify
|
|
85
|
+
flow_agents_node "$WRITER" record-evidence "$B_DIR" --verdict pass \
|
|
86
|
+
--check-json '{"id":"k-diff","kind":"diff","status":"pass","summary":"diff excerpt"}' \
|
|
87
|
+
--check-json '{"id":"k-policy","kind":"policy","status":"pass","summary":"policy rule"}' \
|
|
88
|
+
--check-json '{"id":"k-ext","kind":"external","status":"pass","summary":"attested"}' \
|
|
89
|
+
--timestamp "2026-07-01T00:01:00Z" >/dev/null 2>&1
|
|
90
|
+
flow_agents_node "$WRITER" record-critique "$B_DIR" --id code-review --reviewer alice --verdict pass \
|
|
91
|
+
--summary "looks good" --timestamp "2026-07-01T00:02:00Z" >/dev/null 2>&1
|
|
92
|
+
|
|
93
|
+
node - "$B_DIR/trust.bundle" << 'NODE'
|
|
94
|
+
const fs = require('fs');
|
|
95
|
+
const b = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
|
96
|
+
// Type stability: no critique claim may be re-absorbed as a check, and check kinds/evidenceTypes
|
|
97
|
+
// must survive the round-trip (a session-local kind must NOT flip to test_output).
|
|
98
|
+
const checks = (b.claims||[]).filter(c => c.metadata && c.metadata.origin === 'check');
|
|
99
|
+
const crit = (b.claims||[]).filter(c => c.metadata && c.metadata.origin === 'critique');
|
|
100
|
+
if (crit.length !== 1) throw new Error('expected exactly 1 critique claim (no re-absorption/duplication), got ' + crit.length);
|
|
101
|
+
const evByClaim = {}; for (const e of (b.evidence||[])) (evByClaim[e.claimId] ||= []).push(e);
|
|
102
|
+
for (const c of checks) {
|
|
103
|
+
const ets = (evByClaim[c.id]||[]).map(e=>e.evidenceType);
|
|
104
|
+
if (ets.includes('test_output')) throw new Error('session-local check ' + c.id + ' flipped to test_output evidence (round-trip kind instability)');
|
|
105
|
+
}
|
|
106
|
+
console.log(checks.length + ' check claims, ' + crit.length + ' critique claim; no test_output flip');
|
|
107
|
+
NODE
|
|
108
|
+
if [[ $? -eq 0 ]]; then _pass "(b) round-trip type-stable under --flow-id (no critique→check absorption, no evidenceType flip)"; else _fail "(b) round-trip type instability under --flow-id"; fi
|
|
109
|
+
|
|
110
|
+
TRUST_RECONCILE_COMMANDS="true" node "$RECON" --bundle "$B_DIR/trust.bundle" --repo-root "$TMP/b" >"$TMP/b-recon.log" 2>&1
|
|
111
|
+
if [[ $? -eq 0 ]]; then _pass "(b) HEADLINE: --flow-id session trust-reconcile exits 0 (converges)"; else _fail "(b) HEADLINE --flow-id session did NOT converge: $(cat "$TMP/b-recon.log")"; fi
|
|
112
|
+
|
|
113
|
+
# ─── (c) record-evidence after critiques preserves history ────────────────────
|
|
114
|
+
echo ""
|
|
115
|
+
echo "=== (c) record-evidence AFTER a critique preserves critique history (#268) ==="
|
|
116
|
+
flow_agents_node "$WRITER" record-evidence "$B_DIR" --verdict pass \
|
|
117
|
+
--check-json '{"id":"k-diff2","kind":"diff","status":"pass","summary":"another diff"}' \
|
|
118
|
+
--timestamp "2026-07-01T00:04:00Z" >/dev/null 2>&1
|
|
119
|
+
node - "$B_DIR/trust.bundle" << 'NODE'
|
|
120
|
+
const fs = require('fs');
|
|
121
|
+
const b = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
|
122
|
+
const crit = (b.claims||[]).filter(c => c.metadata && c.metadata.origin === 'critique');
|
|
123
|
+
if (crit.length !== 1) throw new Error('critique history dropped by record-evidence — expected 1, got ' + crit.length);
|
|
124
|
+
if (crit[0].value !== 'pass') throw new Error('critique value changed');
|
|
125
|
+
console.log('critique survived record-evidence');
|
|
126
|
+
NODE
|
|
127
|
+
if [[ $? -eq 0 ]]; then _pass "(c) critique history survives a later record-evidence call"; else _fail "(c) record-evidence dropped critique history"; fi
|
|
128
|
+
|
|
129
|
+
# ─── (d) ANTI-GAMING: cross-reviewer cannot supersede a reviewer fail ─────────
|
|
130
|
+
echo ""
|
|
131
|
+
echo "=== (d) ANTI-GAMING: a different reviewer cannot supersede a reviewer's fail ==="
|
|
132
|
+
D_AROOT="$TMP/d/aroot"; D_SLUG="supersede-cross"; D_DIR="$D_AROOT/$D_SLUG"
|
|
133
|
+
seed "$D_AROOT" "$D_SLUG"
|
|
134
|
+
flow_agents_node "$WRITER" record-evidence "$D_DIR" --verdict pass \
|
|
135
|
+
--check-json '{"id":"c1","kind":"diff","status":"pass","summary":"diff check"}' \
|
|
136
|
+
--timestamp "2026-07-01T00:01:00Z" >/dev/null 2>&1
|
|
137
|
+
flow_agents_node "$WRITER" record-critique "$D_DIR" --id rv --reviewer reviewer-bob --verdict fail \
|
|
138
|
+
--summary "reviewer found a real bug" --timestamp "2026-07-01T00:02:00Z" >/dev/null 2>&1
|
|
139
|
+
flow_agents_node "$WRITER" record-critique "$D_DIR" --id rv --reviewer worker-mallory --verdict pass \
|
|
140
|
+
--summary "worker claims fixed" --timestamp "2026-07-01T00:03:00Z" >/dev/null 2>&1
|
|
141
|
+
node - "$D_DIR/trust.bundle" << 'NODE'
|
|
142
|
+
const fs = require('fs');
|
|
143
|
+
const b = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
|
144
|
+
const crit = (b.claims||[]).filter(c => c.metadata && c.metadata.origin === 'critique');
|
|
145
|
+
const live = crit.filter(c => !c.metadata.superseded_by);
|
|
146
|
+
const liveFail = live.filter(c => c.value === 'fail' || c.status === 'disputed');
|
|
147
|
+
if (!liveFail.length) throw new Error('ANTI-GAMING VIOLATION: reviewer fail was superseded by a different reviewer');
|
|
148
|
+
if (crit.some(c => c.metadata.superseded_by)) throw new Error('unexpected supersession across reviewers');
|
|
149
|
+
console.log('reviewer fail stays LIVE (' + liveFail.length + '); cross-reviewer supersession refused');
|
|
150
|
+
NODE
|
|
151
|
+
if [[ $? -eq 0 ]]; then _pass "(d) reviewer's fail is NOT superseded by a different reviewer (stays live)"; else _fail "(d) ANTI-GAMING regression: cross-reviewer supersession occurred"; fi
|
|
152
|
+
TRUST_RECONCILE_COMMANDS="true" node "$RECON" --bundle "$D_DIR/trust.bundle" --repo-root "$TMP/d" >"$TMP/d-recon.log" 2>&1
|
|
153
|
+
if [[ $? -ne 0 ]] && grep -q "session-local-failed" "$TMP/d-recon.log"; then _pass "(d) trust-reconcile still exits 1 (live disputed critique blocks)"; else _fail "(d) reconcile should have blocked on the live reviewer fail"; fi
|
|
154
|
+
|
|
155
|
+
# ─── (e) VALIDATOR (#282): superseded fail tolerated, live fail blocks ────────
|
|
156
|
+
echo ""
|
|
157
|
+
echo "=== (e) VALIDATOR: superseded historical fail tolerated; live fail blocks (#282) ==="
|
|
158
|
+
# Reuse (a)'s superseded bundle: pass top-level with a superseded fail member.
|
|
159
|
+
va_out="$(flow_agents_node validate-workflow-artifacts "$A_AROOT" --require-sidecars --require-critique 2>&1)"
|
|
160
|
+
if echo "$va_out" | grep -q "required critique must pass"; then
|
|
161
|
+
_fail "(e) validator wrongly rejected a superseded historical fail"
|
|
162
|
+
else
|
|
163
|
+
_pass "(e) validator tolerates a superseded historical fail member (no 'required critique must pass')"
|
|
164
|
+
fi
|
|
165
|
+
# Live fail (d's cross-reviewer bundle has a live disputed critique) must still be rejected.
|
|
166
|
+
vd_out="$(flow_agents_node validate-workflow-artifacts "$D_AROOT" --require-sidecars --require-critique 2>&1)"
|
|
167
|
+
if echo "$vd_out" | grep -q "required critique must pass"; then
|
|
168
|
+
_pass "(e) validator still rejects a LIVE (non-superseded) fail critique"
|
|
169
|
+
else
|
|
170
|
+
_fail "(e) validator failed to reject a live fail critique"
|
|
171
|
+
fi
|
|
172
|
+
|
|
173
|
+
# ─── Summary ──────────────────────────────────────────────────────────────────
|
|
174
|
+
echo ""
|
|
175
|
+
echo "────────────────────────────────────────────"
|
|
176
|
+
if [[ $errors -eq 0 ]]; then
|
|
177
|
+
echo "test_critique_supersession_roundtrip: all checks passed."
|
|
178
|
+
exit 0
|
|
179
|
+
else
|
|
180
|
+
echo "test_critique_supersession_roundtrip: $errors check(s) failed."
|
|
181
|
+
exit 1
|
|
182
|
+
fi
|
|
@@ -103,6 +103,151 @@ else
|
|
|
103
103
|
_fail "resolver: CJS require failed"
|
|
104
104
|
fi
|
|
105
105
|
|
|
106
|
+
# Test 6: composed Builder closeout step resolves through builder.publish-learn
|
|
107
|
+
if node --input-type=module << NODEEOF
|
|
108
|
+
import { resolveFlowStep } from '${_RESOLVER_MOD}';
|
|
109
|
+
const r = resolveFlowStep('builder.build', 'pr-open', '${ROOT}');
|
|
110
|
+
if (!r) throw new Error('expected non-null result for builder.build/pr-open');
|
|
111
|
+
if (r.flowId !== 'builder.build') throw new Error('expected active flowId builder.build, got ' + r.flowId);
|
|
112
|
+
if (r.sourceFlowId !== 'builder.publish-learn') throw new Error('expected sourceFlowId builder.publish-learn, got ' + r.sourceFlowId);
|
|
113
|
+
if (r.gateId !== 'builder.publish-learn:pr-open-gate') throw new Error('expected composed gate id, got ' + r.gateId);
|
|
114
|
+
const claim = r.gateExpects.find(e => e.bundle_claim.claimType === 'builder.pr-open.pull-request');
|
|
115
|
+
if (!claim) throw new Error('expected builder.pr-open.pull-request in composed expects');
|
|
116
|
+
NODEEOF
|
|
117
|
+
then
|
|
118
|
+
_pass "resolver: builder.build/pr-open resolves composed builder.publish-learn gate"
|
|
119
|
+
else
|
|
120
|
+
_fail "resolver: builder.build/pr-open composed gate failed"
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# Test 7: composed child gates must export every imported expectation
|
|
124
|
+
COMPOSE_DEFS="$TMP/compose-defs"
|
|
125
|
+
mkdir -p "$COMPOSE_DEFS"
|
|
126
|
+
cat > "$COMPOSE_DEFS/test.parent.flow.json" <<'JSON'
|
|
127
|
+
{
|
|
128
|
+
"id": "test.parent",
|
|
129
|
+
"version": "1.0.0",
|
|
130
|
+
"steps": [{ "id": "compose", "next": null, "uses_flow": "test.child" }],
|
|
131
|
+
"gates": {}
|
|
132
|
+
}
|
|
133
|
+
JSON
|
|
134
|
+
cat > "$COMPOSE_DEFS/test.child.flow.json" <<'JSON'
|
|
135
|
+
{
|
|
136
|
+
"id": "test.child",
|
|
137
|
+
"version": "1.0.0",
|
|
138
|
+
"steps": [{ "id": "compose", "next": null }],
|
|
139
|
+
"exports": ["test.child.allowed"],
|
|
140
|
+
"gates": {
|
|
141
|
+
"compose-gate": {
|
|
142
|
+
"step": "compose",
|
|
143
|
+
"expects": [
|
|
144
|
+
{
|
|
145
|
+
"id": "allowed",
|
|
146
|
+
"kind": "trust.bundle",
|
|
147
|
+
"required": true,
|
|
148
|
+
"bundle_claim": {
|
|
149
|
+
"claimType": "test.child.allowed",
|
|
150
|
+
"subjectType": "flow-step",
|
|
151
|
+
"accepted_statuses": ["trusted", "accepted"]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
JSON
|
|
159
|
+
|
|
160
|
+
if FLOW_AGENTS_FLOW_DEFS_DIR="$COMPOSE_DEFS" node --input-type=module << NODEEOF
|
|
161
|
+
import { resolveFlowStep } from '${_RESOLVER_MOD}';
|
|
162
|
+
const r = resolveFlowStep('test.parent', 'compose', '${ROOT}');
|
|
163
|
+
if (!r) throw new Error('expected exported composition to resolve');
|
|
164
|
+
if (r.sourceFlowId !== 'test.child') throw new Error('expected sourceFlowId test.child, got ' + r.sourceFlowId);
|
|
165
|
+
if (!r.gateExpects.some(e => e.bundle_claim.claimType === 'test.child.allowed')) throw new Error('missing exported claim');
|
|
166
|
+
NODEEOF
|
|
167
|
+
then
|
|
168
|
+
_pass "resolver: composed child exports allow imported gate expectations"
|
|
169
|
+
else
|
|
170
|
+
_fail "resolver: exported composed child claim failed"
|
|
171
|
+
fi
|
|
172
|
+
|
|
173
|
+
cat > "$COMPOSE_DEFS/test.child.flow.json" <<'JSON'
|
|
174
|
+
{
|
|
175
|
+
"id": "test.child",
|
|
176
|
+
"version": "1.0.0",
|
|
177
|
+
"steps": [{ "id": "compose", "next": null }],
|
|
178
|
+
"exports": ["test.child.other"],
|
|
179
|
+
"gates": {
|
|
180
|
+
"compose-gate": {
|
|
181
|
+
"step": "compose",
|
|
182
|
+
"expects": [
|
|
183
|
+
{
|
|
184
|
+
"id": "allowed",
|
|
185
|
+
"kind": "trust.bundle",
|
|
186
|
+
"required": true,
|
|
187
|
+
"bundle_claim": {
|
|
188
|
+
"claimType": "test.child.allowed",
|
|
189
|
+
"subjectType": "flow-step",
|
|
190
|
+
"accepted_statuses": ["trusted", "accepted"]
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
JSON
|
|
198
|
+
|
|
199
|
+
if FLOW_AGENTS_FLOW_DEFS_DIR="$COMPOSE_DEFS" node --input-type=module << NODEEOF
|
|
200
|
+
import { resolveFlowStep } from '${_RESOLVER_MOD}';
|
|
201
|
+
const r = resolveFlowStep('test.parent', 'compose', '${ROOT}');
|
|
202
|
+
if (r !== null) throw new Error('expected non-exported composition to fail closed');
|
|
203
|
+
NODEEOF
|
|
204
|
+
then
|
|
205
|
+
_pass "resolver: non-exported composed child claims fail closed"
|
|
206
|
+
else
|
|
207
|
+
_fail "resolver: non-exported composed child claim was imported"
|
|
208
|
+
fi
|
|
209
|
+
|
|
210
|
+
cat > "$COMPOSE_DEFS/test.child.flow.json" <<'JSON'
|
|
211
|
+
{
|
|
212
|
+
"id": "test.child",
|
|
213
|
+
"version": "1.0.0",
|
|
214
|
+
"steps": [{ "id": "compose", "next": null, "uses_flow": "test.child" }],
|
|
215
|
+
"exports": ["test.child.allowed"],
|
|
216
|
+
"gates": {}
|
|
217
|
+
}
|
|
218
|
+
JSON
|
|
219
|
+
|
|
220
|
+
if FLOW_AGENTS_FLOW_DEFS_DIR="$COMPOSE_DEFS" node --input-type=module << NODEEOF
|
|
221
|
+
import { resolveFlowStep } from '${_RESOLVER_MOD}';
|
|
222
|
+
const r = resolveFlowStep('test.parent', 'compose', '${ROOT}');
|
|
223
|
+
if (r !== null) throw new Error('expected self-cycle composition to return null');
|
|
224
|
+
NODEEOF
|
|
225
|
+
then
|
|
226
|
+
_pass "resolver: composed flow self-cycle returns null"
|
|
227
|
+
else
|
|
228
|
+
_fail "resolver: composed flow self-cycle did not fail closed"
|
|
229
|
+
fi
|
|
230
|
+
|
|
231
|
+
cat > "$COMPOSE_DEFS/test.parent.flow.json" <<'JSON'
|
|
232
|
+
{
|
|
233
|
+
"id": "test.parent",
|
|
234
|
+
"version": "1.0.0",
|
|
235
|
+
"steps": [{ "id": "compose", "next": null, "uses_flow": "../outside" }],
|
|
236
|
+
"gates": {}
|
|
237
|
+
}
|
|
238
|
+
JSON
|
|
239
|
+
|
|
240
|
+
if FLOW_AGENTS_FLOW_DEFS_DIR="$COMPOSE_DEFS" node --input-type=module << NODEEOF
|
|
241
|
+
import { resolveFlowStep } from '${_RESOLVER_MOD}';
|
|
242
|
+
const r = resolveFlowStep('test.parent', 'compose', '${ROOT}');
|
|
243
|
+
if (r !== null) throw new Error('expected invalid uses_flow id to return null');
|
|
244
|
+
NODEEOF
|
|
245
|
+
then
|
|
246
|
+
_pass "resolver: invalid composed uses_flow id returns null"
|
|
247
|
+
else
|
|
248
|
+
_fail "resolver: invalid composed uses_flow id did not fail closed"
|
|
249
|
+
fi
|
|
250
|
+
|
|
106
251
|
echo ""
|
|
107
252
|
echo "── P-d declared-only: session WITH active_flow_id=builder.build / active_step_id=verify ──"
|
|
108
253
|
|
|
@@ -34,11 +34,11 @@ trap cleanup EXIT
|
|
|
34
34
|
# ─── helper: seed a minimal delivered workflow artifact ───────────────────────
|
|
35
35
|
seed_repo() { # $1=dir $2=slug
|
|
36
36
|
local p="$1" slug="$2"
|
|
37
|
-
mkdir -p "$p/.flow-agents/$slug"
|
|
37
|
+
mkdir -p "$p/.kontourai/flow-agents/$slug"
|
|
38
38
|
printf '# Repo\n' > "$p/AGENTS.md"
|
|
39
39
|
printf '%s' "{\"schema_version\":\"1.0\",\"task_slug\":\"$slug\",\"status\":\"delivered\",\"phase\":\"done\",\"updated_at\":\"2026-06-26T00:00:00Z\",\"next_action\":{\"status\":\"done\",\"summary\":\"done\"}}" \
|
|
40
|
-
> "$p/.flow-agents/$slug/state.json"
|
|
41
|
-
cat > "$p/.flow-agents/$slug/$slug--deliver.md" << MD
|
|
40
|
+
> "$p/.kontourai/flow-agents/$slug/state.json"
|
|
41
|
+
cat > "$p/.kontourai/flow-agents/$slug/$slug--deliver.md" << MD
|
|
42
42
|
# $slug
|
|
43
43
|
|
|
44
44
|
branch: main
|
|
@@ -67,12 +67,12 @@ seed_repo "$T1_DIR" "declares-tampered"
|
|
|
67
67
|
|
|
68
68
|
# current.json: active flow
|
|
69
69
|
printf '%s' '{"artifact_dir":"declares-tampered","active_flow_id":"builder.build","active_step_id":"verify"}' \
|
|
70
|
-
> "$T1_DIR/.flow-agents/current.json"
|
|
70
|
+
> "$T1_DIR/.kontourai/flow-agents/current.json"
|
|
71
71
|
|
|
72
|
-
python3 - "$T1_DIR/.flow-agents/declares-tampered/trust.bundle" << 'PY'
|
|
72
|
+
python3 - "$T1_DIR/.kontourai/flow-agents/declares-tampered/trust.bundle" << 'PY'
|
|
73
73
|
import json, sys
|
|
74
74
|
bundle = {
|
|
75
|
-
"schemaVersion":
|
|
75
|
+
"schemaVersion": 5,
|
|
76
76
|
"source": "flow-agents/workflow-sidecar",
|
|
77
77
|
"claims": [{
|
|
78
78
|
"id": "c1",
|
|
@@ -152,12 +152,12 @@ T2_DIR="$TMP/t2"
|
|
|
152
152
|
seed_repo "$T2_DIR" "declares-clean"
|
|
153
153
|
|
|
154
154
|
printf '%s' '{"artifact_dir":"declares-clean","active_flow_id":"builder.build","active_step_id":"verify"}' \
|
|
155
|
-
> "$T2_DIR/.flow-agents/current.json"
|
|
155
|
+
> "$T2_DIR/.kontourai/flow-agents/current.json"
|
|
156
156
|
|
|
157
|
-
python3 - "$T2_DIR/.flow-agents/declares-clean/trust.bundle" << 'PY'
|
|
157
|
+
python3 - "$T2_DIR/.kontourai/flow-agents/declares-clean/trust.bundle" << 'PY'
|
|
158
158
|
import json, sys
|
|
159
159
|
bundle = {
|
|
160
|
-
"schemaVersion":
|
|
160
|
+
"schemaVersion": 5,
|
|
161
161
|
"source": "flow-agents/workflow-sidecar",
|
|
162
162
|
"claims": [{
|
|
163
163
|
"id": "c2",
|
|
@@ -227,12 +227,12 @@ seed_repo "$T3_DIR" "no-flow"
|
|
|
227
227
|
|
|
228
228
|
# No current.json flow keys (empty current.json that is still valid)
|
|
229
229
|
printf '%s' '{"artifact_dir":"no-flow"}' \
|
|
230
|
-
> "$T3_DIR/.flow-agents/current.json"
|
|
230
|
+
> "$T3_DIR/.kontourai/flow-agents/current.json"
|
|
231
231
|
|
|
232
|
-
python3 - "$T3_DIR/.flow-agents/no-flow/trust.bundle" << 'PY'
|
|
232
|
+
python3 - "$T3_DIR/.kontourai/flow-agents/no-flow/trust.bundle" << 'PY'
|
|
233
233
|
import json, sys
|
|
234
234
|
bundle = {
|
|
235
|
-
"schemaVersion":
|
|
235
|
+
"schemaVersion": 5,
|
|
236
236
|
"source": "flow-agents/workflow-sidecar",
|
|
237
237
|
"claims": [{
|
|
238
238
|
"id": "c3",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# test_evidence_capture_hook.sh — Capture-first evidence determinism contracts.
|
|
3
3
|
#
|
|
4
4
|
# Part A: evidence-capture.js deterministically records command executions to
|
|
5
|
-
# .flow-agents/<slug>/command-log.jsonl (machine-recorded, not model-claimed).
|
|
5
|
+
# .kontourai/flow-agents/<slug>/command-log.jsonl (machine-recorded, not model-claimed).
|
|
6
6
|
# Part B: stop-goal-fit.js cross-references evidence.json claimed-pass command
|
|
7
7
|
# checks against the capture log, and re-runs a TRUSTED backstop command
|
|
8
8
|
# only when the log has no execution for a claimed-pass command.
|
|
@@ -23,10 +23,10 @@ _fail() { echo " ✗ $1"; errors=$((errors + 1)); }
|
|
|
23
23
|
# ---- helpers -------------------------------------------------------------
|
|
24
24
|
seed_repo() { # $1 dir, $2 slug
|
|
25
25
|
local p="$1" slug="$2"
|
|
26
|
-
mkdir -p "$p/.flow-agents/$slug"
|
|
26
|
+
mkdir -p "$p/.kontourai/flow-agents/$slug"
|
|
27
27
|
printf '# Repo\n' > "$p/AGENTS.md"
|
|
28
|
-
printf '%s' "{\"schema_version\":\"1.0\",\"task_slug\":\"$slug\",\"status\":\"delivered\",\"phase\":\"done\",\"updated_at\":\"2026-06-23T00:00:00Z\",\"next_action\":{\"status\":\"done\",\"summary\":\"done\"}}" > "$p/.flow-agents/$slug/state.json"
|
|
29
|
-
cat > "$p/.flow-agents/$slug/$slug--deliver.md" <<MD
|
|
28
|
+
printf '%s' "{\"schema_version\":\"1.0\",\"task_slug\":\"$slug\",\"status\":\"delivered\",\"phase\":\"done\",\"updated_at\":\"2026-06-23T00:00:00Z\",\"next_action\":{\"status\":\"done\",\"summary\":\"done\"}}" > "$p/.kontourai/flow-agents/$slug/state.json"
|
|
29
|
+
cat > "$p/.kontourai/flow-agents/$slug/$slug--deliver.md" <<MD
|
|
30
30
|
# $slug
|
|
31
31
|
|
|
32
32
|
branch: main
|
|
@@ -59,7 +59,7 @@ printf '{"hook_event_name":"PostToolUse","tool_name":"Bash","cwd":"%s","tool_inp
|
|
|
59
59
|
# A non-command tool (Write) must NOT be captured.
|
|
60
60
|
printf '{"hook_event_name":"PostToolUse","tool_name":"Write","cwd":"%s","tool_input":{"file_path":"/tmp/x"}}' "$A" | capture
|
|
61
61
|
|
|
62
|
-
LOG="$A/.flow-agents/t1/command-log.jsonl"
|
|
62
|
+
LOG="$A/.kontourai/flow-agents/t1/command-log.jsonl"
|
|
63
63
|
if [[ -f "$LOG" ]]; then _pass "capture writes command-log.jsonl"; else _fail "capture did not write command-log.jsonl"; fi
|
|
64
64
|
|
|
65
65
|
lines=$(wc -l < "$LOG" | tr -d ' ')
|
|
@@ -90,8 +90,8 @@ else _fail "capture should be non-blocking and echo stdin"; fi
|
|
|
90
90
|
# ============================================================================
|
|
91
91
|
echo "Part B1: log contradicts claimed pass → block"
|
|
92
92
|
B="$TMP/contradict"; seed_repo "$B" t1
|
|
93
|
-
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"unit-tests","kind":"command","status":"pass","command":"npm test","summary":"tests passed"}]}' > "$B/.flow-agents/t1/evidence.json"
|
|
94
|
-
printf '%s\n' '{"command":"npm test","observedResult":"fail","exitCode":1,"capturedAt":"2026-06-23T00:00:00Z","source":"postToolUse-capture"}' > "$B/.flow-agents/t1/command-log.jsonl"
|
|
93
|
+
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"unit-tests","kind":"command","status":"pass","command":"npm test","summary":"tests passed"}]}' > "$B/.kontourai/flow-agents/t1/evidence.json"
|
|
94
|
+
printf '%s\n' '{"command":"npm test","observedResult":"fail","exitCode":1,"capturedAt":"2026-06-23T00:00:00Z","source":"postToolUse-capture"}' > "$B/.kontourai/flow-agents/t1/command-log.jsonl"
|
|
95
95
|
|
|
96
96
|
if FLOW_AGENTS_GOAL_FIT_MODE=block FLOW_AGENTS_GOAL_FIT_BACKSTOP=skip node "$GATE" >/dev/null 2>"$TMP/b1.err" <<JSON
|
|
97
97
|
{"hook_event_name":"Stop","cwd":"$B"}
|
|
@@ -109,8 +109,8 @@ fi
|
|
|
109
109
|
# ============================================================================
|
|
110
110
|
echo "Part B2: log confirms claimed pass → satisfied, no re-run"
|
|
111
111
|
C="$TMP/confirm"; seed_repo "$C" t1
|
|
112
|
-
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"unit-tests","kind":"command","status":"pass","command":"npm test","summary":"tests passed"}]}' > "$C/.flow-agents/t1/evidence.json"
|
|
113
|
-
printf '%s\n' '{"command":"npm test","observedResult":"pass","exitCode":0,"capturedAt":"2026-06-23T00:00:00Z","source":"postToolUse-capture"}' > "$C/.flow-agents/t1/command-log.jsonl"
|
|
112
|
+
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"unit-tests","kind":"command","status":"pass","command":"npm test","summary":"tests passed"}]}' > "$C/.kontourai/flow-agents/t1/evidence.json"
|
|
113
|
+
printf '%s\n' '{"command":"npm test","observedResult":"pass","exitCode":0,"capturedAt":"2026-06-23T00:00:00Z","source":"postToolUse-capture"}' > "$C/.kontourai/flow-agents/t1/command-log.jsonl"
|
|
114
114
|
# A poisoned npm on PATH proves the gate does NOT re-run when the log confirms.
|
|
115
115
|
POISON="$TMP/poison"; mkdir -p "$POISON"
|
|
116
116
|
printf '#!/usr/bin/env bash\necho "npm should not run" >&2\nexit 99\n' > "$POISON/npm"; chmod +x "$POISON/npm"
|
|
@@ -127,7 +127,7 @@ else _pass "gate trusts the log on a confirmed pass and does not re-run the back
|
|
|
127
127
|
echo "Part B3: never-captured claim → trusted manifest backstop catches a fail"
|
|
128
128
|
D="$TMP/backstop"; seed_repo "$D" t1
|
|
129
129
|
printf '%s' '{"name":"x","scripts":{"test":"exit 7"}}' > "$D/package.json"
|
|
130
|
-
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"unit-tests","kind":"command","status":"pass","command":"npm test","summary":"tests passed"}]}' > "$D/.flow-agents/t1/evidence.json"
|
|
130
|
+
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"unit-tests","kind":"command","status":"pass","command":"npm test","summary":"tests passed"}]}' > "$D/.kontourai/flow-agents/t1/evidence.json"
|
|
131
131
|
# command-log.jsonl intentionally absent — the command was never actually run.
|
|
132
132
|
|
|
133
133
|
if FLOW_AGENTS_GOAL_FIT_MODE=block node "$GATE" >/dev/null 2>"$TMP/b3.err" <<JSON
|
|
@@ -146,9 +146,10 @@ fi
|
|
|
146
146
|
# ============================================================================
|
|
147
147
|
echo "Part B4: never-captured claim, nothing trusted resolves → NOT_VERIFIED"
|
|
148
148
|
E="$TMP/notverified"; seed_repo "$E" t1
|
|
149
|
-
printf '%s' '{"schema_version":"1.0","task_slug":"t1","
|
|
149
|
+
printf '%s' '{"schema_version":"1.0","task_slug":"t1","status":"in_progress","phase":"verification","updated_at":"2026-06-23T00:00:00Z","next_action":{"status":"continue","summary":"verify command evidence"}}' > "$E/.kontourai/flow-agents/t1/state.json"
|
|
150
|
+
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"custom","kind":"command","status":"pass","command":"./my-thing.sh","summary":"ran custom"}]}' > "$E/.kontourai/flow-agents/t1/evidence.json"
|
|
150
151
|
|
|
151
|
-
if FLOW_AGENTS_GOAL_FIT_MODE=block node "$GATE" >/dev/null 2>"$TMP/b4.err" <<JSON
|
|
152
|
+
if FLOW_AGENTS_GOAL_FIT_MODE=block FLOW_AGENTS_GOAL_FIT_RECHECK=false node "$GATE" >/dev/null 2>"$TMP/b4.err" <<JSON
|
|
152
153
|
{"hook_event_name":"Stop","cwd":"$E"}
|
|
153
154
|
JSON
|
|
154
155
|
then _fail "gate should not silently pass an un-captured, un-verifiable claimed-pass command"
|
|
@@ -164,7 +165,7 @@ fi
|
|
|
164
165
|
# ============================================================================
|
|
165
166
|
echo "Part B5: free-form model command re-run is opt-in only"
|
|
166
167
|
F="$TMP/recheck"; seed_repo "$F" t1
|
|
167
|
-
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"custom","kind":"command","status":"pass","command":"exit 5","summary":"ran custom"}]}' > "$F/.flow-agents/t1/evidence.json"
|
|
168
|
+
printf '%s' '{"schema_version":"1.0","task_slug":"t1","verdict":"pass","checks":[{"id":"custom","kind":"command","status":"pass","command":"exit 5","summary":"ran custom"}]}' > "$F/.kontourai/flow-agents/t1/evidence.json"
|
|
168
169
|
# Opt-in ON: the model's free-form "exit 5" is re-run and fails → block.
|
|
169
170
|
if FLOW_AGENTS_GOAL_FIT_MODE=block FLOW_AGENTS_GOAL_FIT_RECHECK=true node "$GATE" >/dev/null 2>"$TMP/b5.err" <<JSON
|
|
170
171
|
{"hook_event_name":"Stop","cwd":"$F"}
|
|
@@ -21,9 +21,9 @@ json_query() {
|
|
|
21
21
|
node -e 'const fs=require("fs"); let cur=JSON.parse(fs.readFileSync(process.argv[1],"utf8")); for (const part of process.argv[2].split(".")) cur=Array.isArray(cur) ? cur[Number(part)] : cur[part]; console.log(cur);' "$1" "$2"
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "totals.scanned")" == "
|
|
24
|
+
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "totals.scanned")" == "15" ]] && pass "audit scans all fixture groups" || fail "audit scans all fixture groups"
|
|
25
25
|
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "totals.retire_candidates")" == "0" ]] && pass "audit finds no unowned retire candidates" || fail "audit finds no unowned retire candidates"
|
|
26
|
-
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "totals.kept")" == "
|
|
26
|
+
[[ "$(json_query "$TMPDIR_EVAL/audit.json" "totals.kept")" == "15" ]] && pass "audit keeps all owned fixture groups" || fail "audit keeps all owned fixture groups"
|
|
27
27
|
|
|
28
28
|
node - "$TMPDIR_EVAL/audit.json" <<'NODE'
|
|
29
29
|
const fs = require("node:fs");
|