Skip to content

Harden bridge author metadata provenance#43

Draft
mike-remakerdigital wants to merge 1 commit into
mainfrom
codex/bridge-author-metadata-fixes-main
Draft

Harden bridge author metadata provenance#43
mike-remakerdigital wants to merge 1 commit into
mainfrom
codex/bridge-author-metadata-fixes-main

Conversation

@mike-remakerdigital

Copy link
Copy Markdown
Contributor

Summary

This PR isolates the verified WI-4938/WI-4939/WI-4940 bridge author-metadata fixes onto a clean origin/main branch.

Outage Root Cause

Bridge status-bearing artifacts could be written or accepted with missing, synthetic, or non-unique author provenance. The OpenRouter and Ollama harness paths propagated placeholder session IDs such as openrouter-harness-f and ollama-harness-d, while the bridge writer/finalizer and compliance hook did not consistently reject those placeholders before artifacts reached disk. The new audit scanner confirms there is also a legacy population of bridge files with missing or weak metadata that needs to remain visible during future cleanup.

Hardening Changes

  • Added shared author metadata validation and synthetic-session detection in scripts/bridge_author_metadata.py.
  • Updated OpenRouter and Ollama harness flows to propagate runtime session IDs instead of hardcoded placeholders.
  • Added write-time hard blocks in .claude/hooks/bridge-compliance-gate.py, groundtruth-kb/templates/hooks/bridge-compliance-gate.py, scripts/gtkb_bridge_writer.py, and .claude/skills/verify/helpers/write_verdict.py.
  • Added schema-compatible bridge applicability preflight handling for older current_specifications tables without a type column.
  • Optimized bridge hook scan behavior so pending-proposal checks reuse a single bridge entry scan.
  • Refreshed the dev-environment inventory baseline for the protected hook surface with bridge review evidence present.

Audit Coverage Added

  • Added scripts/bridge_metadata_audit.py and gt bridge audit metadata for deterministic read-only bridge metadata auditing.
  • Added regression coverage for metadata audit classification, synthetic session rejection, bridge writer/finalizer enforcement, and Codex compliance adapter behavior.

Verification

  • python -m ruff check scripts/bridge_metadata_audit.py platform_tests/scripts/test_bridge_metadata_audit.py groundtruth-kb/src/groundtruth_kb/cli.py
  • python -m ruff format --check scripts/bridge_metadata_audit.py platform_tests/scripts/test_bridge_metadata_audit.py groundtruth-kb/src/groundtruth_kb/cli.py
  • python -m pytest platform_tests/scripts/test_bridge_metadata_audit.py -q --no-header -v --basetemp work/pytest-wi4938 - 4 passed
  • gt bridge audit metadata --json - completed successfully; 877 artifacts scanned
  • python -m ruff check scripts/bridge_author_metadata.py scripts/openrouter_harness.py scripts/ollama_harness.py platform_tests/scripts/test_bridge_author_metadata.py
  • python -m ruff format --check scripts/bridge_author_metadata.py scripts/openrouter_harness.py scripts/ollama_harness.py platform_tests/scripts/test_bridge_author_metadata.py
  • python -m pytest platform_tests/scripts/test_bridge_author_metadata.py platform_tests/scripts/test_openrouter_harness.py platform_tests/scripts/test_ollama_harness.py -q --no-header --basetemp work/pytest-wi4939 - 56 passed
  • python scripts/bridge_applicability_preflight.py --bridge-id gtkb-wi4940-bridge-metadata-write-time-enforcement
  • python scripts/adr_dcl_clause_preflight.py --bridge-id gtkb-wi4940-bridge-metadata-write-time-enforcement
  • python -m ruff check groundtruth-kb/templates/hooks/bridge-compliance-gate.py .claude/hooks/bridge-compliance-gate.py scripts/gtkb_bridge_writer.py .claude/skills/verify/helpers/write_verdict.py scripts/bridge_applicability_preflight.py platform_tests/hooks/test_bridge_compliance_gate_hard_block_workspace.py platform_tests/scripts/test_codex_bridge_compliance_gate.py
  • python -m ruff format --check groundtruth-kb/templates/hooks/bridge-compliance-gate.py .claude/hooks/bridge-compliance-gate.py scripts/gtkb_bridge_writer.py .claude/skills/verify/helpers/write_verdict.py scripts/bridge_applicability_preflight.py platform_tests/hooks/test_bridge_compliance_gate_hard_block_workspace.py platform_tests/scripts/test_codex_bridge_compliance_gate.py
  • python -m py_compile groundtruth-kb/templates/hooks/bridge-compliance-gate.py .claude/hooks/bridge-compliance-gate.py scripts/gtkb_bridge_writer.py .claude/skills/verify/helpers/write_verdict.py scripts/bridge_applicability_preflight.py
  • python -m pytest platform_tests/hooks/test_bridge_compliance_gate_hard_block_workspace.py -q --timeout=120 --basetemp work/pytest-wi4940-hooks - 16 passed
  • python -m pytest platform_tests/scripts/test_codex_bridge_compliance_gate.py -vv --timeout=120 --basetemp work/pytest-wi4940-codex - 7 passed
  • scripts/check_dev_environment_inventory_drift.py --staged --allow-review-evidence --json
  • git diff --cached --check

verdict_path = project_root / verdict_rel_path
try:
verdict_path.unlink()
except FileNotFoundError:
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

🧪 Test & Coverage Report

Coverage

Metric Value
Tests 0
Failures 0
Coverage 76.8%
Statements 40058
Missed lines 9287

Lowest Coverage

Module Cover
agents/containers/analytics_collector_app.py 0%
agents/containers/co_pilot_app.py 0%
agents/containers/critic_supervisor_app.py 0%
agents/containers/escalation_handler_app.py 0%
agents/containers/intent_classifier_app.py 0%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant