Repository navigation
fix(noema): stage reviewed exact-file canary route #2661
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
base: main
Are you sure you want to change the base?
Changes from all commits
f66bd5c
b7b2751
cbf46c1
22d6dac
1aaeae2
27c319c
ca8ce62
4c2c4b0
3b56c6c
657acdc
f47ab13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,6 +74,15 @@ on: | |
| - "tests/test_contextual_orchestrator_review_launcher.py" | ||
| - "tests/test_review_auto_route.py" | ||
| - "tests/test_personal_review_route.py" | ||
| - "tests/test_noema_paid_auto_authorization.py" | ||
| - "tests/test_noema_exact_canary.py" | ||
| - "tests/test_noema_complete_auto_input.py" | ||
| - "tests/fixtures/noema_canary_cli_fixture.py" | ||
| - "tests/fixtures/noema_canary_github_fixture.py" | ||
| - "tests/test_noema_canary_publication.py" | ||
| - "tests/fixtures/noema_canary_publication_fixture.py" | ||
| - "scripts/ci/noema_exact_canary.py" | ||
| - "scripts/ci/noema_review_gate.py" | ||
| - "tests/test_tokyo_review_consumer.py" | ||
| - "tests/test_review_auto_cost_admission.py" | ||
| - "tests/test_review_ai_app_independence.py" | ||
|
|
@@ -222,6 +231,7 @@ jobs: | |
| review_repair_suite=true | ||
| ;; | ||
| .github/workflows/noema-review.yml|\ | ||
| scripts/ci/noema_review_gate.py|\ | ||
| .github/actions/noema-review/two_phase.py|\ | ||
| tests/test_noema_reviewer_token_lifetime.py|\ | ||
| tests/test_noema_two_phase_handoff.py|\ | ||
|
|
@@ -234,6 +244,7 @@ jobs: | |
| tests/test_noema_document_review_context.py|\ | ||
| docs/doctoring/noema-review-token-lifetime.md) | ||
| noema_suite=true | ||
| review_repair_suite=true | ||
| ;; | ||
| .github/workflows/opencode-review-dispatch.yml|\ | ||
| scripts/ci/ensure_rust_llvm19.sh|\ | ||
|
|
@@ -304,6 +315,14 @@ jobs: | |
| tests/test_contextual_orchestrator_review_launcher.py|\ | ||
| tests/test_review_auto_route.py|\ | ||
| tests/test_personal_review_route.py|\ | ||
| tests/test_noema_paid_auto_authorization.py|\ | ||
| tests/test_noema_exact_canary.py|\ | ||
| tests/test_noema_complete_auto_input.py|\ | ||
| tests/fixtures/noema_canary_cli_fixture.py|\ | ||
| tests/fixtures/noema_canary_github_fixture.py|\ | ||
| tests/test_noema_canary_publication.py|\ | ||
| tests/fixtures/noema_canary_publication_fixture.py|\ | ||
| scripts/ci/noema_exact_canary.py|\ | ||
| tests/test_tokyo_review_consumer.py|\ | ||
| tests/test_review_auto_cost_admission.py|\ | ||
| tests/test_review_ai_app_independence.py|\ | ||
|
|
@@ -504,6 +523,10 @@ jobs: | |
| tests/test_contextual_orchestrator_review_launcher.py \ | ||
| tests/test_review_auto_route.py \ | ||
| tests/test_personal_review_route.py \ | ||
| tests/test_noema_paid_auto_authorization.py \ | ||
| tests/test_noema_exact_canary.py \ | ||
| tests/test_noema_complete_auto_input.py \ | ||
| tests/test_noema_canary_publication.py \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔎 Supported by static analysis
현재 테스트는 helper 함수 일부를 in-process로 호출합니다. CLI 경로는 별도 프로세스에서 실행하며, 그 프로세스의 coverage를 부모 pytest에 병합하지 않습니다. 따라서 현재 테스트에 먼저 두 함수를 in-process로 호출하는 테스트를 추가하거나 subprocess coverage 병합을 구성하세요. 그 후 다음 목록을 추가하세요. ♻️ 제안 수정
|
||
| tests/test_tokyo_review_consumer.py \ | ||
| tests/test_review_auto_cost_admission.py \ | ||
| tests/test_review_ai_app_independence.py \ | ||
|
|
@@ -539,6 +562,11 @@ jobs: | |
| scripts/ci/contextual_orchestrator_review_policy.py \ | ||
| scripts/ci/contextual_orchestrator_review_launcher.py | ||
| python -m compileall -q \ | ||
| scripts/ci/noema_review_gate.py \ | ||
| scripts/ci/noema_exact_canary.py \ | ||
| tests/fixtures/noema_canary_cli_fixture.py \ | ||
| tests/fixtures/noema_canary_github_fixture.py \ | ||
| tests/fixtures/noema_canary_publication_fixture.py \ | ||
| scripts/ci/pr_review_conflict_scope.py \ | ||
| scripts/ci/pr_review_autofix_context.py \ | ||
| tests/test_pr_review_conflict_scope.py \ | ||
|
|
@@ -550,6 +578,10 @@ jobs: | |
| tests/test_contextual_orchestrator_review_launcher.py \ | ||
| tests/test_review_auto_route.py \ | ||
| tests/test_personal_review_route.py \ | ||
| tests/test_noema_paid_auto_authorization.py \ | ||
| tests/test_noema_exact_canary.py \ | ||
| tests/test_noema_complete_auto_input.py \ | ||
| tests/test_noema_canary_publication.py \ | ||
| tests/test_tokyo_review_consumer.py \ | ||
| tests/test_review_auto_cost_admission.py \ | ||
| tests/test_review_ai_app_independence.py \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Exact non-ZDR canary (default disabled) | ||
|
|
||
| Direct user consent covers ONLY ContextualWisdomLab/traveling-agent PR4, | ||
| head bf85ddde01f871f0e713db54aae5a16883777d9f, added file | ||
| `.github/workflows/docker-ephemeral-canary.yml`, SHA256 | ||
| 5427ca0c17d818d49f9af91b5cd495ab4599c969b894cb2467b794d674a96d3d. | ||
|
|
||
| Consent includes disclosed gateway prompt/response storage without an established | ||
| finite deletion period and the external classifier/provider/fallback chain. | ||
| It is NOT ZDR, an upstream no-training claim, or organization-wide consent. | ||
| Never enable PERSONAL_REVIEW_ZDR_ATTESTED on this basis. | ||
|
|
||
| Trusted variable NOEMA_EXACT_CANARY_NON_ZDR defaults false. Its true mode requires | ||
| a separate NOEMA_EXACT_CANARY_API_KEY Secret: no fallback to or overwrite of the | ||
| unresolved central Secret. Dedicated issuance/install must have authorized issuer | ||
| custody receipts before activation. No dedicated Secret has been installed by | ||
| this patch. The existing App publisher and exact-head verification are unchanged. | ||
| The canary requires native GitHub App selection. If NOEMA_REVIEW_TOKEN would | ||
| preempt the App, or only OIDC is available, credential selection explicitly rejects | ||
| before model work; ambient GH_TOKEN is never borrowed. Normal mode retains its | ||
| existing credential precedence. Activation must resolve this prerequisite without | ||
| silently replacing any existing Secret. | ||
|
|
||
| Workflow changes require two distinct probes under the existing substantive | ||
| validator. The emitted schema and fixed approval instruction require two as well; | ||
| one-probe responses remain rejected rather than weakening that validator. | ||
|
|
||
| Admission authenticates current head, one added path and exact content digest. | ||
| The HTTP producer repeats these checks and serializes only the approved YAML, | ||
| fixed instructions/identities and fixed verdict schema; PR title, review threads, | ||
| base source and caller diff do not enter the outgoing canary payload. The local | ||
| verdict validator receives a reconstructed new-file diff for line validation. | ||
| All other targets in this mode fail closed. Normal mode keeps existing private | ||
| retention admission unchanged. This patch does not authorize deployment/merge. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Noema paid auto cost authorization (source proposal) | ||
|
|
||
| The October 25 CI request authorizes paid inference without a monetary cap on | ||
| `https://litellm.poinnetworks.net`, model `auto`. It does not require zero cost. | ||
| `NOEMA_REVIEW_PAID_AUTO_AUTHORIZED` is a separate, default-false cost authorization | ||
| for the existing Noema route. It does not attest privacy, select another key, | ||
| change endpoint/model, or relax private/internal visibility admission. Existing | ||
| OpenCode/Strix callers omit the new argument and keep their behavior. | ||
|
|
||
| Private/internal requests still require the existing real retention evidence and | ||
| `PERSONAL_REVIEW_ZDR_ATTESTED`. Do not set that value merely because a key has no | ||
| expiry, unlimited budget, no configured logging integration, or successful HTTP | ||
| responses. The variable's legacy PERSONAL name does not identify the key's owner. | ||
|
|
||
| Operational adoption requires normal independent source review and protected | ||
| shipment, purpose-bound existing central Secret custody, then truthful supplier | ||
| retention evidence for the gateway and every eligible downstream/fallback of its | ||
| literal auto route. No settings or Secrets are changed by this proposal. If the | ||
| supplier retains content, obtain an explicit privacy-policy decision instead of | ||
| calling it ZDR or silently falling back to another provider. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| """Explicit non-ZDR consent for one immutable YAML, never ZDR attestation. | ||
|
|
||
| Consent includes disclosed gateway storage (no established finite deletion period) | ||
| and external classifier/provider/fallback recipients. No other private input is | ||
| covered. This module is inert unless the trusted Noema caller selects it. | ||
| """ | ||
| import hashlib | ||
| import json | ||
|
|
||
| REPOSITORY = 'ContextualWisdomLab/traveling-agent' | ||
| NUMBER = 4 | ||
| HEAD = 'bf85ddde01f871f0e713db54aae5a16883777d9f' | ||
| PATH = '.github/workflows/docker-ephemeral-canary.yml' | ||
| DIGEST = '5427ca0c17d818d49f9af91b5cd495ab4599c969b894cb2467b794d674a96d3d' | ||
| SYSTEM = 'Return strict JSON only. Do not include markdown.' | ||
| INSTRUCTION = ('Independently review this exact YAML for correctness and security. ' | ||
| 'Return the declared response schema. Cite changed RIGHT-side lines. ' | ||
| 'For approval falsify at least two distinct concrete regression hypotheses; ' | ||
| 'for request_changes confirm a concrete finding. This is a complete ' | ||
| 'new file; no other repository context is authorized.\n' | ||
| f'Repository: {REPOSITORY}\nPR: {NUMBER}\nHead: {HEAD}\nPath: {PATH}\n') | ||
|
|
||
|
|
||
| def require_target(repo, number, head): | ||
| """Reject any repository, pull request or head outside exact consent.""" | ||
| if repo != REPOSITORY or type(number) is not int or number != NUMBER or head != HEAD: | ||
| raise RuntimeError('Non-ZDR canary scope mismatch') | ||
|
Comment on lines
+24
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Canary helpers fail the docstring gate Running Learn moreThe repository's Example: Run Recommended fix: Add concise docstrings to all three functions, then run the configured interrogate gate against the module. Was this helpful? React with 👍 or 👎 to provide feedback.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verified fixed on exact current head Fresh local execution of |
||
|
|
||
|
|
||
| def require_content(content): | ||
| """Admit only UTF-8 text with the explicitly consented content digest.""" | ||
| if type(content) is not str or hashlib.sha256(content.encode('utf-8')).hexdigest() != DIGEST: | ||
| raise RuntimeError('Non-ZDR canary content scope mismatch') | ||
|
|
||
|
|
||
| def messages(content): | ||
| """Build fixed instructions plus the digest-admitted file and nothing else.""" | ||
| require_content(content) | ||
| return [{'role': 'system', 'content': SYSTEM}, | ||
| {'role': 'user', 'content': INSTRUCTION + content}] | ||
|
|
||
|
|
||
| def validate_payload(payload): | ||
| """Verify complete actual JSON payload; no title, threads or extra context.""" | ||
| if type(payload) is not dict or set(payload) != {'model', 'response_format', 'messages'}: | ||
| raise RuntimeError('Non-ZDR canary payload scope mismatch') | ||
| from scripts.ci.noema_review_gate import _noema_verdict_response_format, _required_probe_count | ||
| if payload['response_format'] != _noema_verdict_response_format(_required_probe_count('', (PATH,))): | ||
| raise RuntimeError('Non-ZDR canary schema scope mismatch') | ||
| if payload['model'] != 'auto': | ||
| raise RuntimeError('Non-ZDR canary model scope mismatch') | ||
| rows = payload['messages'] | ||
| if type(rows) is not list or len(rows) != 2 or rows[0] != {'role': 'system', 'content': SYSTEM}: | ||
| raise RuntimeError('Non-ZDR canary messages scope mismatch') | ||
| row = rows[1] | ||
| if type(row) is not dict or set(row) != {'role', 'content'} or row['role'] != 'user': | ||
| raise RuntimeError('Non-ZDR canary message scope mismatch') | ||
| text = row['content'] | ||
| if type(text) is not str or not text.startswith(INSTRUCTION): | ||
| raise RuntimeError('Non-ZDR canary instruction scope mismatch') | ||
| require_content(text[len(INSTRUCTION):]) | ||
|
|
||
|
|
||
| def serialize_payload(content, response_format): | ||
| """Serialize only approved input and fixed caller-owned schema.""" | ||
| payload = {'model': 'auto', 'response_format': response_format, 'messages': messages(content)} | ||
| raw = json.dumps(payload).encode('utf-8') | ||
| validate_payload(json.loads(raw)) | ||
| return raw | ||
|
|
||
|
|
||
| def main(): | ||
| """Authenticate exact target content through the existing GitHub reader.""" | ||
| import argparse | ||
| from scripts.ci import noema_review_gate as gate | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument('--repo', required=True) | ||
| parser.add_argument('--pr-number', required=True, type=int) | ||
| parser.add_argument('--expected-head', required=True) | ||
| args = parser.parse_args() | ||
| require_target(args.repo, args.pr_number, args.expected_head) | ||
| pr = gate.fetch_pr(args.repo, args.pr_number) | ||
| gate.require_expected_head(pr, HEAD) | ||
| if gate.fetch_changed_files(args.repo, args.pr_number) != [(PATH, 'added')]: | ||
| raise RuntimeError('Non-ZDR canary changed-file scope mismatch') | ||
| require_content(gate.fetch_file_content_at_ref(args.repo, PATH, HEAD)) | ||
|
|
||
|
|
||
| def run_private_cli(callback): | ||
| """Keep canary CLI failures finite without rendering private exceptions.""" | ||
| import sys | ||
| try: | ||
| return callback() | ||
| except BaseException as exc: | ||
| if isinstance(exc, SystemExit) and (exc.code is None or type(exc.code) is int): | ||
| raise SystemExit(exc.code) from None | ||
| if isinstance(exc, KeyboardInterrupt): | ||
| print('::error::Non-ZDR canary interrupted; private diagnostics withheld.', file=sys.stderr) | ||
| raise SystemExit(130) from None | ||
| print('::error::Non-ZDR canary failed closed; private diagnostics withheld.', file=sys.stderr) | ||
| raise SystemExit(1) from None | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| run_private_cli(main) | ||
Uh oh!
There was an error while loading. Please reload this page.