-
Notifications
You must be signed in to change notification settings - Fork 0
fix(noema): classify and bound malformed-verdict repair failures #1617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8155d50
test(noema): reproduce malformed verdict failure classification
seonghobae 35a0f4b
chore(noema): stage exact #1617 source repair
seonghobae 145cc5f
chore(noema): run and retire #1617 source repair
seonghobae adcf7da
chore(noema): use explicit 24.04 repair runner
seonghobae 161f06e
test(noema): align repair timeout fixture with new contract
seonghobae b4ec3b0
test(noema): execute repair-timeout fixture update
seonghobae 7a06865
fix(noema): preserve no-timeout repair contract
seonghobae 859491e
test(noema): add true wall-clock repair deadline regression
seonghobae d7a78c7
fix(ci): make Noema repair workflow fail-closed and self-cleaning
seonghobae 59e3151
test(noema): close repair deadline coverage gaps
seonghobae f380904
fix(ci): verify all Noema repair deadline branches
seonghobae fbe6024
fix(noema): close reviewed model-output repair gaps
seonghobae 8721ccf
fix(ci): bind Noema repair to exact head and reviewed scope
seonghobae d8bb1ff
fix(ci): harden Noema 1617 repair writer boundary
seonghobae ed2a5fe
fix(noema): align stable repair diagnostics
seonghobae 4a7005d
fix(noema): preserve actionable safe repair diagnostics
seonghobae 312df94
fix(noema): repair changelog transform drift
seonghobae 11b6b4e
fix(noema): make repair trace updates drift-safe
seonghobae b7fc695
fix(noema): preserve request-changes structural diagnostic
seonghobae aa4ec46
fix(noema): document repair deadline callback
seonghobae 0b33b0b
fix(ci): grant one-shot Noema repair writer token
seonghobae 17c28a8
chore(ci): retrigger verified Noema repair writer
seonghobae 430a007
fix(noema): bound and classify malformed-verdict repair
github-actions[bot] ae75b1d
test(noema): preserve existing process alarm authority
seonghobae 5bc790d
Merge current main into Noema model-output repair
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| name: TEMP repair Noema model-output boundary 1617 | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - fix/noema-model-output-retry-20260901 | ||
|
|
||
| concurrency: | ||
| group: repair-noema-model-output-1617 | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
github-advanced-security[bot] marked this conversation as resolved.
Fixed
devin-ai-integration[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| jobs: | ||
| repair: | ||
| if: >- | ||
| github.repository == 'ContextualWisdomLab/.github' && | ||
| github.actor == 'seonghobae' && | ||
| github.triggering_actor == 'seonghobae' | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 60 | ||
| steps: | ||
| - name: Checkout triggering repair head without credentials | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| ref: ${{ github.sha }} | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Bind the single-writer branch to the triggering head | ||
| run: | | ||
| set -euo pipefail | ||
| writer_ref='refs/heads/fix/noema-model-output-retry-20260901' | ||
| remote_head="$(git ls-remote origin "$writer_ref" | awk '{print $1}')" | ||
| test "$remote_head" = "$GITHUB_SHA" | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | ||
| with: | ||
| python-version: '3.14' | ||
|
|
||
| - name: Install repository-pinned quality tools | ||
| run: python -m pip install --require-hashes -r requirements-opencode-review-ci-hashes.txt | ||
|
|
||
| - name: Apply typed-evidence, deadline, coverage, and reviewed follow-up repairs | ||
| run: | | ||
| set -euo pipefail | ||
| PYTHONPATH=. python scripts/ci/repair_noema_model_output_1617.py | ||
| PYTHONPATH=. python scripts/ci/repair_noema_wall_clock_1617.py | ||
| PYTHONPATH=. python scripts/ci/repair_noema_coverage_1617.py | ||
| PYTHONPATH=. python scripts/ci/repair_noema_model_output_followup_1617.py | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Remove temporary repair machinery before verification | ||
| run: | | ||
| rm -f scripts/ci/repair_noema_model_output_1617.py | ||
| rm -f scripts/ci/repair_noema_timeout_fixture_1617.py | ||
| rm -f scripts/ci/repair_noema_wall_clock_1617.py | ||
| rm -f scripts/ci/repair_noema_coverage_1617.py | ||
| rm -f scripts/ci/repair_noema_model_output_followup_1617.py | ||
| rm -f .github/workflows/repair-noema-model-output-1617.yml | ||
| test ! -e .github/workflows/repair-noema-model-output-1617.yml | ||
|
|
||
| - name: Verify repair scope and required semantic targets | ||
| run: | | ||
| set -euo pipefail | ||
| python - <<'PY' | ||
| import subprocess | ||
| allowed = { | ||
| '.github/workflows/repair-noema-model-output-1617.yml', | ||
| 'ARCHITECTURE.md', | ||
| 'CHANGELOG.md', | ||
| 'docs/doctoring/noema-model-output-repair-boundary.md', | ||
| 'docs/product-technical-gap-baseline.md', | ||
| 'scripts/ci/noema_review_gate.py', | ||
| 'scripts/ci/repair_noema_coverage_1617.py', | ||
| 'scripts/ci/repair_noema_model_output_1617.py', | ||
| 'scripts/ci/repair_noema_model_output_followup_1617.py', | ||
| 'scripts/ci/repair_noema_timeout_fixture_1617.py', | ||
| 'scripts/ci/repair_noema_wall_clock_1617.py', | ||
| 'tests/test_noema_model_output_failure_classification.py', | ||
| } | ||
| changed = set(subprocess.check_output(['git', 'diff', '--name-only'], text=True).splitlines()) | ||
| unexpected = changed - allowed | ||
| if unexpected: | ||
| raise SystemExit(f'unexpected repair paths: {sorted(unexpected)}') | ||
| required = { | ||
| 'scripts/ci/noema_review_gate.py', | ||
| 'tests/test_noema_model_output_failure_classification.py', | ||
| } | ||
| missing = required - changed | ||
| if missing: | ||
| raise SystemExit(f'required repair targets unchanged: {sorted(missing)}') | ||
| print('verified repair scope:', *sorted(changed), sep='\n- ') | ||
| PY | ||
|
|
||
| - name: Verify focused Noema regressions | ||
| run: PYTHONPATH=. python -m pytest -q tests/test_noema_model_output_failure_classification.py tests/test_noema_review_gate.py | ||
|
|
||
| - name: Verify complete suite, source coverage, docs, and diff hygiene | ||
| run: | | ||
| set -euo pipefail | ||
| PYTHONPATH=. coverage run -m pytest tests -q | ||
| coverage report --show-missing | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
Outdated
|
||
| interrogate | ||
| git diff --check | ||
| test ! -e .github/workflows/repair-noema-model-output-1617.yml | ||
| test ! -e scripts/ci/repair_noema_model_output_1617.py | ||
| test ! -e scripts/ci/repair_noema_timeout_fixture_1617.py | ||
| test ! -e scripts/ci/repair_noema_wall_clock_1617.py | ||
| test ! -e scripts/ci/repair_noema_coverage_1617.py | ||
| test ! -e scripts/ci/repair_noema_model_output_followup_1617.py | ||
|
|
||
| - name: Commit verified production repair with an allowlisted scope | ||
| run: | | ||
| set -euo pipefail | ||
| git config user.name 'github-actions[bot]' | ||
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | ||
| git add -A -- \ | ||
| .github/workflows/repair-noema-model-output-1617.yml \ | ||
| ARCHITECTURE.md \ | ||
| CHANGELOG.md \ | ||
| docs/doctoring/noema-model-output-repair-boundary.md \ | ||
| docs/product-technical-gap-baseline.md \ | ||
| scripts/ci/noema_review_gate.py \ | ||
| scripts/ci/repair_noema_coverage_1617.py \ | ||
| scripts/ci/repair_noema_model_output_1617.py \ | ||
| scripts/ci/repair_noema_model_output_followup_1617.py \ | ||
| scripts/ci/repair_noema_timeout_fixture_1617.py \ | ||
| scripts/ci/repair_noema_wall_clock_1617.py \ | ||
| tests/test_noema_model_output_failure_classification.py | ||
| git diff --cached --check | ||
| test -z "$(git diff --name-only)" | ||
| git diff --cached --name-only | grep -Fx 'scripts/ci/noema_review_gate.py' | ||
| git diff --cached --name-only | grep -Fx 'tests/test_noema_model_output_failure_classification.py' | ||
| git commit -m 'fix(noema): bound and classify malformed-verdict repair' | ||
|
|
||
| - name: Guard and push only the verified exact-head commit | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
|
github-actions[bot] marked this conversation as resolved.
Outdated
|
||
| run: | | ||
| set -euo pipefail | ||
| test -n "${GH_TOKEN:-}" | ||
| writer_branch='fix/noema-model-output-retry-20260901' | ||
| writer_ref="refs/heads/${writer_branch}" | ||
| remote_head="$(git ls-remote origin "$writer_ref" | awk '{print $1}')" | ||
| test "$remote_head" = "$GITHUB_SHA" | ||
| gh auth setup-git | ||
| git push origin HEAD:"$writer_branch" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| #!/usr/bin/env python3 | ||
| """Add fail-closed coverage for PR #1617's temporary production transform. | ||
|
|
||
| This one-shot helper is removed by the repair workflow before the verified | ||
| production commit is created. | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
|
|
||
|
|
||
| ROOT = Path(__file__).resolve().parents[2] | ||
| TEST = ROOT / "tests/test_noema_model_output_failure_classification.py" | ||
|
|
||
|
|
||
| def main() -> None: | ||
| text = TEST.read_text(encoding="utf-8") | ||
| marker = "def test_repair_wall_clock_deadline_defensive_fail_closed_paths" | ||
| if marker in text: | ||
| raise RuntimeError("#1617 deadline coverage regressions already present") | ||
| text += r''' | ||
|
|
||
|
|
||
| def test_repair_wall_clock_deadline_defensive_fail_closed_paths(monkeypatch) -> None: | ||
| """Invalid budgets/platform state fail closed instead of weakening the bound.""" | ||
| import signal | ||
|
|
||
| with pytest.raises(ValueError, match="must be positive"): | ||
| with gate._repair_wall_clock_deadline(0): | ||
| pass | ||
|
|
||
| if not hasattr(signal, "setitimer"): | ||
| pytest.skip("remaining cases require POSIX setitimer") | ||
|
|
||
| monkeypatch.delattr(gate.signal, "setitimer") | ||
| with pytest.raises(RuntimeError, match="requires POSIX setitimer support"): | ||
| with gate._repair_wall_clock_deadline(1): | ||
| pass | ||
|
|
||
|
|
||
| def test_repair_wall_clock_deadline_refuses_existing_process_alarm() -> None: | ||
| """Noema never overwrites another caller's active process alarm.""" | ||
| import signal | ||
|
|
||
| if not hasattr(signal, "setitimer"): | ||
| pytest.skip("POSIX process timer is required by the Linux review runner") | ||
| signal.setitimer(signal.ITIMER_REAL, 30) | ||
| try: | ||
| with pytest.raises(RuntimeError, match="refused to overwrite"): | ||
| with gate._repair_wall_clock_deadline(1): | ||
| pass | ||
| finally: | ||
| signal.setitimer(signal.ITIMER_REAL, 0) | ||
|
|
||
|
|
||
| def test_repair_wall_clock_deadline_rejects_non_main_thread_signal_context(monkeypatch) -> None: | ||
| """A signal handler that cannot be installed fails closed before any timer starts.""" | ||
| import signal | ||
|
|
||
| if not hasattr(signal, "setitimer"): | ||
| pytest.skip("POSIX process timer is required by the Linux review runner") | ||
|
|
||
| def reject_signal(*_args, **_kwargs): | ||
| raise ValueError("signal only works in main thread") | ||
|
|
||
| monkeypatch.setattr(gate.signal, "signal", reject_signal) | ||
| with pytest.raises(RuntimeError, match="process main thread"): | ||
| with gate._repair_wall_clock_deadline(1): | ||
| pass | ||
| assert signal.getitimer(signal.ITIMER_REAL)[0] == 0 | ||
|
|
||
|
|
||
| def test_repair_unexpected_runtime_failure_preserves_initial_model_evidence(monkeypatch) -> None: | ||
| """Unexpected corrective parser/runtime failures keep the first trusted diagnostic.""" | ||
| import json | ||
|
|
||
| monkeypatch.setenv("NOEMA_LLM_API_URL", "https://llm.example/v1/chat/completions") | ||
| monkeypatch.setenv("NOEMA_LLM_API_KEY", "test-key") | ||
| head_sha = "e" * 40 | ||
|
|
||
| class Response: | ||
| def __enter__(self): | ||
| return self | ||
|
|
||
| def __exit__(self, *_args): | ||
| return None | ||
|
|
||
| def read(self): | ||
| return json.dumps( | ||
| {"choices": [{"message": {"content": json.dumps(_verdict())}}]} | ||
| ).encode() | ||
|
|
||
| monkeypatch.setattr( | ||
| gate.urllib.request.OpenerDirector, | ||
| "open", | ||
| lambda *_args, **_kwargs: Response(), | ||
| ) | ||
| monkeypatch.setattr(gate, "fetch_pr", lambda _repo, _number: {"headRefOid": head_sha}) | ||
| original_decode = gate.decode_llm_response_body | ||
| decode_calls = 0 | ||
|
|
||
| def decode_once_then_fail(raw_bytes): | ||
| nonlocal decode_calls | ||
| decode_calls += 1 | ||
| if decode_calls == 2: | ||
| raise RuntimeError("repair parser invariant failed") | ||
| return original_decode(raw_bytes) | ||
|
|
||
| monkeypatch.setattr(gate, "decode_llm_response_body", decode_once_then_fail) | ||
|
|
||
| with pytest.raises(RuntimeError) as exc_info: | ||
| gate.call_llm( | ||
| "owner/repo", | ||
| 7, | ||
| {"title": "test", "headRefOid": head_sha}, | ||
| DIFF, | ||
| False, | ||
| head_sha, | ||
| changed_paths=("README.md",), | ||
| ) | ||
|
|
||
| message = str(exc_info.value) | ||
| assert "Noema repair failed closed" in message | ||
| assert "outcome must be falsified or confirmed" in message | ||
| assert "repair parser invariant failed" in message | ||
| assert decode_calls == 2 | ||
| ''' | ||
| TEST.write_text(text, encoding="utf-8") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.