Skip to content

Release the Bootstrap Lock When a bootstrap.ps1 Run Ends - #3139

Merged
ptr727 merged 2 commits into
developfrom
fix/bootstrap-lock-release-3137
Oct 16, 2026
Merged

ptr727 merged 2 commits into
developfrom
fix/bootstrap-lock-release-3137

Conversation

@ptr727

@ptr727 ptr727 commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #3137. A bootstrap.ps1 run typed at an interactive pwsh prompt runs inside the caller's own process, so the lock stream Lock-Directory opened was left for the process to release and outlived the run. The next run in that session was refused the lock, with an error blaming "another bootstrap run".

  • Unlock-Directory disposes $script:LOCK and clears it.
  • main's finally calls it after the cleanup, as try { Invoke-Cleanup } finally { Unlock-Directory }, so the cleanup still runs under the lock and the release happens even if the cleanup throws.
  • die's path is covered by the same finally, since PowerShell runs a finally on exit from inside a function (checked under pwsh 7.6 and Windows PowerShell 5.1). Every exit before Lock-Directory holds no lock.
  • The stale $LOCK comment ("lasts until this process ends") is removed.

bootstrap.sh takes its flock in its own process and is unaffected.

Test

test_a_run_ending_inside_its_callers_process_releases_the_directory_lock drives two runs in one pwsh process through a driver script, the first through the loader's own main ending in die, the second taking Lock-Directory in the same mode. It fails against the pre-fix loader with the issue's "Could not lock" error, and passes with the fix. The harness's extracted function list gains Unlock-Directory and main.

Verified on Windows: test_bootstrap and test_cli_usage pass, PSScriptAnalyzer and ruff are clean, and the local strict review pass is recorded at the head.

Comments

This carries the comments label for the two new comment lines above Unlock-Directory and the one in main's finally, each stating a reason the code alone does not show.

🤖 Generated with Claude Code

ptr727 and others added 2 commits October 16, 2026 08:08
A run typed at an interactive prompt runs inside the caller's own
process, so the lock stream left for the process to release outlived the
run and refused the next one in that session. main's finally now
disposes it after the cleanup, which also covers die's exit, since exit
runs the finally on its way out.

Fixes #3137

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 16, 2026 15:12
@ptr727 ptr727 added bug Something isn't working comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses labels Oct 16, 2026
@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 293cc239-eccf-45df-9b24-fdaaf1d9bfa7
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved review issues remain.

0 open findings

What changed in this PR

Releases the PowerShell bootstrap directory lock after each run, including interactive sessions.

Changes:

  • Adds lock cleanup in finally.
  • Adds regression coverage for consecutive runs in one process.
File Summary
tests/​test_bootstrap.py Tests lock release across consecutive runs.
host-setup/​bootstrap.ps1 Releases the directory lock after cleanup or failure.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@722a458). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #3139   +/-   ##
==========================================
  Coverage           ?   63.97%           
==========================================
  Files              ?       17           
  Lines              ?     9151           
  Branches           ?        0           
==========================================
  Hits               ?     5854           
  Misses             ?     3297           
  Partials           ?        0           
Flag Coverage Δ
python-3.13 63.97% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727
ptr727 merged commit 19cfddc into develop Oct 16, 2026
14 checks passed
@ptr727
ptr727 deleted the fix/bootstrap-lock-release-3137 branch October 16, 2026 15:24
ptr727 added a commit that referenced this pull request Oct 16, 2026
… Fixes to Main (#3146)

- #3135 makes `gh-write-guard` read a gh write's subcommand and target
the way gh parses them: the subcommand is found past flags before the
command and before the subcommand, an `R` inside a short-option cluster
is read as a target, `GH_REPO` is read as a target, a run-time
repository owner on a write fails closed, and a run-time word where `pr`
or `merge` goes fails closed beside `--admin` or where word splitting
may split it
- #3139 releases the bootstrap lock when a `bootstrap.ps1` run ends
rather than when its process does, so a second run typed at the same
pwsh prompt is no longer refused the lock
- #3130 matches tool names and the `all` keyword by case in the Windows
agents loaders, as the Linux loaders already do
- #3128 reads CodeRabbit's rate limit on a reply to an explicit review
command in `pr_review.py`
- #3126 reconciles VSCode-Server-DotNetCore in the hub after its resync
- #3124 logs the Docker task's build-base leg in to Docker Hub
- #3122 names the carried skill and the skipped review correctly
- #3120 states the subprocess encoding rule in `CODESTYLE.md`, where
carriers read Python style
- #3118 and #3111 move the release-guard tests' workflow-command checks
onto `runner_commands`, and test the alternatives wiring at the
`audit_repo` and `fidelity_pass` call sites
- #3116 stops the doc gates' printed names forging workflow commands
- #3113 adds a catalog snippet for the release-with-smoke caller
- #3109 moves the `workflow_reuse` fetch onto `audit.contents_text`
- #3105 accepts `.codecov.yml` as an alternative to `codecov.yml`
- #3103 adds a pip ecosystem to the carried Dependabot snippet
- #3100 prefers the venv's ruff and pyright for a declared pip directory
- #3098 tracks composite action pins in Dependabot
- #3096 reads an uppercase Markdown suffix as Markdown at every prose
gate branch

After this merges, the host-safety installer payload changes, so the
maintainer runs the installer after promotion.

Closes #1416
Closes #1425
Closes #1578
Closes #1874
Closes #1892
Closes #1899
Closes #2804
Closes #2850
Closes #2852
Closes #2854
Closes #2996
Closes #3065
Closes #3067
Closes #3069
Closes #3079
Closes #3080
Closes #3089
Closes #3093
Closes #3101
Closes #3106
Closes #3107
Closes #3137

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added a pull-request smoke build that runs when relevant release files
change and reports the combined validation and build status.
* Repository audits now recognize `.codecov.yml` as an alternative to
`codecov.yml`.

* **Improvements**
* Python linting and type checks use tools from declared project
environments when available, with fallbacks for missing tools.
* Workflow and lint reports safely display unusual filenames and
command-like text.
* GitHub write-target checks now account for additional command forms
and fail closed when targets cannot be verified.
* Rate-limit detection now recognizes another CodeRabbit response
format.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants