test: clear the python CodeQL results that turned main red #667
DISCLOSURE: LLM-GENERATED TEXT
OpenAI review: 0 findings.
No defects found in the diff. The changed defaults and exact stderr assertions preserve the described test behavior while addressing the reported CodeQL findings.
<sub>3913 in, 603 out tokens. Comments only; this review never blocks a merge.</sub>
<!-- openai-review-run: {"v":2,"workflow_sha":"5aabfe60ec294f8160b70d0a712c561db5e3fa29","coverage":"full-eligible-diff","duration_seconds":7.831,"cache_write_tokens":3910,"cache_write_tokens_details":{"ttl_12h_tokens":0,"ttl_30m_tokens":3910},"model":"gpt-6-luna","effort":"default","input_tokens":3913,"output_tokens":603,"reasoning_tokens":560,"findings":0,"inline":0,"diff_chars":3765,"dropped_files":0,"cached_tokens":0,"unchanged_files":0,"usage_complete":true,"reported_models":["gpt-6-luna"]} -->
<!-- openai-review:4f3807417b16be9f81cb877484614c6565468539 -->
<!-- coderabbit-ai-generated:v1 -->
<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- review_stack_entry_start -->
<a href="https://app.coderabbit.ai/change-stack/Ambiguous-Interactive/fortress-rollback/pull/667?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a>
<!-- review_stack_entry_end -->
<!-- recent_review_start -->
No actionable comments were generated in the recent review.
<!-- review_details_start -->
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/review-details-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/review-details.svg" width="16" height="16" align="absmiddle" alt=""></picture> Recent review details</strong></summary>
<dl>
<dd>
<br>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/clock-alert-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/clock-alert.svg" width="16" height="16" align="absmiddle" alt=""></picture> Context from checks skipped due to timeout: 4</strong></summary>
<dl>
<dd>
<br>
GitHub Check: CodeRabbit
GitHub Check: Fast Gate (Linux)
GitHub Check: Analyze (rust)
GitHub Check: Script Tests & Wiki Dry-Run
</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/layers-plus-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/layers-plus.svg" width="16" height="16" align="absmiddle" alt=""></picture> Additional context used</strong></summary>
<dl>
<dd>
<br>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/book-open-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/book-open.svg" width="16" height="16" align="absmiddle" alt=""></picture> Code guidelines: 2</strong></summary>
<dl>
<dd>
<br>
.agents/skills/scripting/SKILL.md — Agent Skill
.agents/skills/performance/SKILL.md — Agent Skill
</dd>
</dl>
</details><details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/route-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/route.svg" width="16" height="16" align="absmiddle" alt=""></picture> Path-based instructions: 2</strong></summary>
<dl>
<dd>
<br>
<details>
<summary><strong>Source excerpt: Remove unused imports -- linters flag as errors Source excerpt: Prefix unused variables with _ (e.g., _link_text = match.group(1)) Source excerpt: Type hints on all function signatures Source excerpt: path...</strong></summary>
<dl>
<dd>
<br>
CodeRabbit inference engine (.agents/skills/scripting/SKILL.md)
Files:
</dd>
</dl>
</details>
<details>
<summary><strong>Source excerpt: | Technique | Impact | Notes | |-----------|--------|-------| | Faster linker (mold/lld) | 2-10x linking | Always use if available | Source excerpt: | Technique | Impact | Notes | |-----------|--------|-------| | Remove unus...</strong></summary>
<dl>
<dd>
<br>
CodeRabbit inference engine (.agents/skills/performance/SKILL.md)
Files:
</dd>
</dl>
</details>
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<details>
<summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/message-square-off-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/message-square-off.svg" width="16" height="16" align="absmiddle" alt=""></picture> Additional comments: 1</strong></summary>
<dl>
<dd>
<br>
<details>
<summary><strong>scripts/tests/test_session_budget.py: 1</strong></summary>
<dl>
<dd>
<br>
36-36: Functional Correctness
The os.open fakes default to 0o600, which matches every creating call in the reachable lock path. Those calls pass an explicit mode (session-budget.py:107, 227-229, 231-235). The only omitted-mode call, at line 173, opens an existing directory without O_CREAT, so its mode is ignored. The claimed permission mismatch cannot occur on these paths.
<!-- cr-comment:v1:69edd2dfffff7243fd9ed4cc -->
</dd>
</dl>
</details>
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<!-- review_details_end -->
<!-- recent_review_end -->
<!-- walkthrough_start -->
<details>
<summary><strong>Walkthrough</strong></summary>
<dl>
<dd>
<br>
The changes update session-budget test fakes to use a shared 0o600 fallback mode. Two askpass tests now assert the complete error message for rejected prompts.
Changes: Python Test Updates
|Layer / File(s)|Summary|
|:---|:---|
|Lock-owner open-mode test assumptions <br> scripts/tests/test_session_budget.py|Mocked os.open functions use OPEN_FALLBACK_MODE (0o600) as their default mode.|Askpass rejection assertions <br> scripts/tests/test_vscode_github_token.py
||Tests for non-GitHub prompts and malformed URLs assert the complete error text, including its error: prefix and newline.|
Estimated code review effort: 2 (Simple) | ~10 minutes
Possibly related issues
Possibly related PRs
</dd>
</dl>
</details>
<!-- walkthrough_end -->
<details>
<summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>d9b88</code></summary>
<dl>
<dd>
<br>
<!-- final_review_risk_start -->
<!-- final_review_risk_label
Merge Risk: ⚪ Minimal · up to d9b88`
-->
<!-- final_review_risk_coverage:{"sourceCommitId":"d9b8848393e5aa5af1aac027419f2f6bc768cc07","coveredCommitId":"d9b8848393e5aa5af1aac027419f2f6bc768cc07","kind":"reviewed"} -->
This is a test-only fix for static-analysis findings. It does not change runtime behavior and no actionable merge risk remains.
<!-- final_review_risk_end -->
</dd>
</dl>
</details>
<!-- pre_merge_checks_walkthrough_start -->
<details>
<summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary>
<dl>
<dd>
<br>
| Check name | Status | Explanation |
| :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Title check | !Passed | The title names the main change: it clears the Python CodeQL results that made main's CI red. The changeset edits only two test files, changing os.open fake defaults and tightening URL assertions to a… |
| Description check | !Passed | The description states the purpose (fixing seven Python CodeQL findings that failed the gate on main), lists each affected location and the fix, and explains risks, validation, and rollback. It matche… |
| Linked Issues check | !Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | !Passed | Check skipped because no linked issues were found for this pull request. |
<details>
<summary><strong>Full details: Title check</strong></summary>
<dl>
<dd>
<br>
Explanation
The title names the main change: it clears the Python CodeQL results that made main's CI red. The changeset edits only two test files, changing os.open fake defaults and tightening URL assertions to address those seven findings, so the title matches the primary intent. It is a conventional test: prefix, 58 characters, one sentence.
</dd>
</dl>
</details>
<details>
<summary><strong>Full details: Description check</strong></summary>
<dl>
<dd>
<br>
Explanation**
The description states the purpose (fixing seven Python CodeQL findings that failed the gate on main), lists each affected location and the fix, and explains risks, validation, and rollback. It matches the changeset, which modifies the os.open fakes in scripts/tests/test_session_budget.py and the askpass assertions in scripts/tests/test_vscode_github_token.py.
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<!-- pre_merge_checks_walkthrough_end -->
<!-- autopilot:start -->
<!-- autopilot:end -->
DISCLOSURE: LLM-GENERATED TEXT
OpenAI review: 0 findings.
No actionable defects found.
<sub>3745 in, 335 out tokens. Comments only; this review never blocks a merge.</sub>
<!-- openai-review-run: {"v":2,"workflow_sha":"5aabfe60ec294f8160b70d0a712c561db5e3fa29","coverage":"full-eligible-diff","duration_seconds":7.364,"cache_write_tokens":3742,"cache_write_tokens_details":{"ttl_12h_tokens":0,"ttl_30m_tokens":3742},"model":"gpt-6-luna","effort":"default","input_tokens":3745,"output_tokens":335,"reasoning_tokens":314,"findings":0,"inline":0,"diff_chars":3313,"dropped_files":0,"cached_tokens":0,"unchanged_files":0,"usage_complete":true,"reported_models":["gpt-6-luna"]} -->
<!-- openai-review:d9b8848393e5aa5af1aac027419f2f6bc768cc07 -->
Approved these changes.
github-actions[bot]
wallstop
Description
Red-main fix-forward.
CI - CodeQLrun 46225272808 (scheduled Sunday run,mainatfbb6b734) failed theFail on CodeQL findingsstep with seven python results in two test files. The workflow'sjqallow-list only acknowledges four actions results on.github/workflows/ci-release-state.yml, so every python result fails the gate.All seven are false positives in test-only code, and the fix follows the #526 precedent: change the test source so the query stops modelling it, without touching production code or any assertion's intent.
| Result | Location | Why it fires | Fix |
| --- | --- | --- | --- |
|
py/overly-permissive-file×5 |scripts/tests/test_session_budget.py, the fiveos.openfakes | the fake's forwardedmodedefaulted to the stdlib0o777| documentedOPEN_FALLBACK_MODE = 0o600constant ||
py/incomplete-url-substring-sanitization×2 |scripts/tests/test_vscode_github_token.py:627,696|assert "https://github.com" in captured.errlooks like URL sanitization | exact stderr equality (stricter assertion) |The
os.openfakes only forward the mode production passes (session-budget.pyalways passes0o600); their only two-argument call opens an existing directory, where the mode is ignored. No test was deleted, skipped, or weakened — two assertions became stricter, and the focused suites and fullscripts/testslane are unchanged in count.Type of Change
Verification Impact
none— no mapped production path or symbol changed (python3 scripts/verification/model-impact.py affected --base origin/main→ "No mapped verification impact")updated: <spec/proof>waived: <reason + approver>Checklist
Required
cargo fmt && cargo clippy --workspace --all-targets --features tokio,jsonwith no warningscargo nextest runand all tests passIf Applicable
CHANGELOG.mdfor user-facing changes (test-only; not required)examples/directory (N/A)Testing
Red (before,
mainfbb6b734, run 46225272808):Green (this branch head
4f380741, dispatched run 46227765435):Local validation:
| Check | Result |
| --- | --- |
|
.venv/bin/python -m pytest scripts/tests/test_vscode_github_token.py scripts/tests/test_session_budget.py -q| 121 passed (same before/after) ||
.venv/bin/python -m pytest scripts/tests -q| 2687 passed, 1 skipped ||
cargo fmt --all -- --check| pass ||
cargo c(clippy, workspace/all-targets, tokio+json) | clean ||
cargo tf| 3020 passed, 512 skipped ||
cargo tfull| 3821 passed, 77 skipped, 0 failed (35.3s) ||
cargo test --doc| 160 passed, 52 ignored ||
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --features hot-join,tokio,json,sync-send --document-private-items| pass ||
.venv/bin/python scripts/ci/agent-preflight.py --full --auto-fix| all checks passed ||
.venv/bin/ruff checkon both files | pass |Tests added/modified: two URL assertions tightened from substring to exact equality; five fake
os.opendefaults changed. No test added or removed; test counts are identical.Manual testing performed: none beyond the checks above.
Risks and rollback
os.openfakes' fallback no longer mirrors the stdlib default. Production always passes0o600toos.open(scripts/ci/session-budget.py:107,227,231), and the only two-argument call opens an existing directory where the mode is ignored.git revertthe squash commit; the seven results return and the gate goes red again.Related Issues
main:CI - CodeQLrun 46225272808 onfbb6b734rust/cleartext-loggingfalse positive)