From 1d1ae399bf54e23c52c53a6a9a343fcf7258f0ba Mon Sep 17 00:00:00 2001 From: Egor Merkushev Date: Wed, 18 Feb 2026 22:27:02 +0300 Subject: [PATCH 1/8] Branch for FU-P13-T2-2: move pid file write after successful upstream launch From d3b87e5e69d3b6b5f2507a9adda9caf7ba2a6ec4 Mon Sep 17 00:00:00 2001 From: Egor Merkushev Date: Wed, 18 Feb 2026 22:27:53 +0300 Subject: [PATCH 2/8] Select task FU-P13-T2-2: Move PID file write to after successful upstream launch --- SPECS/INPROGRESS/next.md | 24 ++++++++++++------------ SPECS/Workplan.md | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/SPECS/INPROGRESS/next.md b/SPECS/INPROGRESS/next.md index 21053f35..1861dd1c 100644 --- a/SPECS/INPROGRESS/next.md +++ b/SPECS/INPROGRESS/next.md @@ -1,16 +1,16 @@ -# No Active Task +# Next Task: FU-P13-T2-2 — Move PID file write to after successful upstream launch -## Recently Archived +**Priority:** P3 +**Phase:** Phase 13: Persistent Broker & Shared Xcode Session +**Effort:** 1 hour +**Dependencies:** P13-T2 +**Status:** Selected -- 2026-02-18 — FU-P13-T2-1: Replace run_forever() polling loop with asyncio.Event-based wait (PASS) -- 2026-02-18 — FU-P13-T4-2: Implement or remove reconnect parameter in BrokerProxy (PASS) -- 2026-02-18 — FU-P13-T4-1: Fix asyncio.get_event_loop() deprecation in BrokerProxy (PASS) -- 2026-02-18 — P13-T6: Document broker mode configuration, migration, and rollback (PASS) -- 2026-02-18 — P13-T5: Validate prompt reduction and multi-client stability (PARTIAL) -- 2026-02-18 — P13-T4: Add stdio proxy mode for compatibility with existing MCP clients (PASS) +## Description -## Suggested Next Tasks +Move PID file write in `BrokerDaemon.start()` to execute only after `_launch_upstream()` +completes successfully, preventing stale live-PID locks when launch fails mid-startup. -- P13-T5 follow-up — Complete interactive prompt verification in a desktop session (P1) -- FU-P13-T2-2 — Move PID file write to after successful upstream launch (P3) -- FU-BUG-T7-1 — Cap `pending_methods` map to guard against unbounded growth (P3) +## Next Step + +Run the PLAN command to generate the implementation-ready PRD. diff --git a/SPECS/Workplan.md b/SPECS/Workplan.md index 83753a03..bedc5f33 100644 --- a/SPECS/Workplan.md +++ b/SPECS/Workplan.md @@ -2020,7 +2020,7 @@ Phase 9 Follow-up Backlog --- -#### FU-P13-T2-2: Move PID file write to after successful upstream launch +#### FU-P13-T2-2: Move PID file write to after successful upstream launch **INPROGRESS** - **Type:** Robustness - **Priority:** P3 - **Discovered:** 2026-02-17 (REVIEW_P13-T2) From 6a7f78807aafe879ff24c8b5cf96f1771596ec12 Mon Sep 17 00:00:00 2001 From: Egor Merkushev Date: Wed, 18 Feb 2026 22:28:21 +0300 Subject: [PATCH 3/8] Plan task FU-P13-T2-2: Move PID file write to after successful upstream launch --- ...ite_to_after_successful_upstream_launch.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 SPECS/INPROGRESS/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md diff --git a/SPECS/INPROGRESS/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md b/SPECS/INPROGRESS/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md new file mode 100644 index 00000000..1ce37520 --- /dev/null +++ b/SPECS/INPROGRESS/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md @@ -0,0 +1,66 @@ +# PRD: FU-P13-T2-2 — Move PID file write to after successful upstream launch + +**Task ID:** FU-P13-T2-2 +**Priority:** P3 +**Phase:** Phase 13: Persistent Broker & Shared Xcode Session +**Dependencies:** P13-T2 +**Status:** Planned + +## Objective + +Eliminate a startup race in `BrokerDaemon.start()` where the PID file can be written before +`_launch_upstream()` succeeds. If startup fails between these operations, the wrapper can leave a +live-process PID lock that blocks future starts. The fix is to move PID-file persistence so it +runs only after upstream launch has completed successfully. + +## Success Criteria + +- PID file is created only after `_launch_upstream()` succeeds. +- Failure paths during upstream launch do not leave a PID file behind. +- Existing stale-lock behavior and cleanup flows remain unchanged. +- Current broker daemon tests remain green, and coverage for this behavior is explicit. + +## Acceptance Tests + +1. Existing test coverage for successful startup still passes. +2. Existing test coverage for startup failures still passes. +3. Add or update a unit test that proves no PID file is written when `_launch_upstream()` raises. +4. Verify lock/PID cleanup behavior remains correct after stop or failed start. + +## Test-First Plan + +1. Inspect `tests/unit/test_broker_daemon.py` around startup/lifecycle tests and identify current + assertions for PID file timing. +2. Add/adjust a failing test asserting PID file write happens after successful upstream launch and + does not happen on launch failure. +3. Run focused tests for broker daemon to confirm the new test fails before implementation. + +## Implementation Plan + +### Phase 1: Validate current startup order +- **Inputs:** `src/mcpbridge_wrapper/broker/daemon.py`, existing broker daemon tests. +- **Outputs:** Confirmed execution order and concrete edit target in `start()`. +- **Verification:** Readable call order documented in PR notes. + +### Phase 2: Move PID write after upstream launch +- **Inputs:** `BrokerDaemon.start()`. +- **Outputs:** Refactored startup sequence with unchanged external behavior. +- **Verification:** New/updated test passes and no regressions in daemon lifecycle tests. + +### Phase 3: Run required quality gates + report +- **Inputs:** Updated source and tests. +- **Outputs:** Passing `pytest`, `ruff check src/`, `mypy src/`, and `pytest --cov` results plus + `SPECS/INPROGRESS/FU-P13-T2-2_Validation_Report.md`. +- **Verification:** Command outputs captured with PASS/FAIL summary and coverage percentage. + +## Risks and Mitigations + +- **Risk:** Changing startup ordering could break assumptions in lock handling. + **Mitigation:** Keep lock acquisition timing unchanged and rely on existing stale-lock tests. +- **Risk:** Test fixtures may mock PID writes loosely. + **Mitigation:** Add explicit assertions around PID path existence and write invocation order. + +## Notes + +- If behavior changes are not user-visible, no documentation updates are required. +- If startup semantics or troubleshooting guidance changes, update `docs/troubleshooting.md`. From c57acf653ae6b40e2ef74f21b5a01dd3d8f2bf59 Mon Sep 17 00:00:00 2001 From: Egor Merkushev Date: Wed, 18 Feb 2026 22:30:04 +0300 Subject: [PATCH 4/8] Implement FU-P13-T2-2: move PID file write after upstream launch --- .../FU-P13-T2-2_Validation_Report.md | 44 +++++++++++++++++++ src/mcpbridge_wrapper/broker/daemon.py | 9 ++-- tests/unit/test_broker_daemon.py | 18 ++++++++ 3 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 SPECS/INPROGRESS/FU-P13-T2-2_Validation_Report.md diff --git a/SPECS/INPROGRESS/FU-P13-T2-2_Validation_Report.md b/SPECS/INPROGRESS/FU-P13-T2-2_Validation_Report.md new file mode 100644 index 00000000..b5aee7ba --- /dev/null +++ b/SPECS/INPROGRESS/FU-P13-T2-2_Validation_Report.md @@ -0,0 +1,44 @@ +# Validation Report — FU-P13-T2-2 + +**Task:** FU-P13-T2-2 — Move PID file write to after successful upstream launch +**Date:** 2026-02-18 +**Verdict:** PASS + +## Scope + +- Updated startup ordering in `BrokerDaemon.start()` so PID file is written only + after `_launch_upstream()` succeeds. +- Added regression test for launch-failure path to ensure no PID lock file is + created when upstream start fails. + +## Test-First Evidence + +1. Added test: `test_start_does_not_write_pid_file_when_launch_fails`. +2. Ran before implementation: + - `pytest tests/unit/test_broker_daemon.py -k "start_does_not_write_pid_file_when_launch_fails" -q` + - Result: **FAIL** (PID file existed unexpectedly). +3. Implemented startup-order fix. +4. Re-ran focused test and broker daemon suite: + - Focused test: **PASS** + - `pytest tests/unit/test_broker_daemon.py -q`: **28 passed**. + +## Required Quality Gates + +- `pytest -q` + Result: **PASS** (`580 passed, 5 skipped, 2 warnings`) +- `ruff check src/` + Result: **PASS** (`All checks passed!`) +- `mypy src/` + Result: **PASS** (`Success: no issues found in 18 source files`) +- `pytest --cov=src/mcpbridge_wrapper --cov-report=term-missing` + Result: **PASS** (`580 passed, 5 skipped`, total coverage **92.25%**, threshold 90%) + +## Acceptance Criteria Status + +- [x] PID file is written only after `_launch_upstream()` succeeds. +- [x] Stale-lock/startup tests continue to pass. + +## Notes + +- Two existing third-party deprecation warnings were observed during full test + runs (`websockets`/`uvicorn`) and are unrelated to this task. diff --git a/src/mcpbridge_wrapper/broker/daemon.py b/src/mcpbridge_wrapper/broker/daemon.py index a5842f94..b480ec7f 100644 --- a/src/mcpbridge_wrapper/broker/daemon.py +++ b/src/mcpbridge_wrapper/broker/daemon.py @@ -95,7 +95,7 @@ def status(self) -> dict[str, Any]: } async def start(self) -> None: - """Start the broker: validate lock, write PID file, launch upstream. + """Start the broker: validate lock, launch upstream, then write PID file. Raises: RuntimeError: If another broker instance is already running (live PID found). @@ -105,12 +105,13 @@ async def start(self) -> None: # Stale-lock / duplicate-instance check self._check_and_clear_stale_lock() - # Write own PID + # Launch upstream subprocess + await self._launch_upstream() + + # Persist PID only after upstream launch succeeds. self._config.pid_file.write_text(str(os.getpid())) logger.debug("PID file written: %s", self._config.pid_file) - # Launch upstream subprocess - await self._launch_upstream() self._state = BrokerState.READY logger.info( "Broker READY (upstream PID %s)", diff --git a/tests/unit/test_broker_daemon.py b/tests/unit/test_broker_daemon.py index eb8dd8e2..d403dff8 100644 --- a/tests/unit/test_broker_daemon.py +++ b/tests/unit/test_broker_daemon.py @@ -117,6 +117,24 @@ async def test_start_writes_pid_file(self, tmp_path: Path) -> None: if daemon._read_task and not daemon._read_task.done(): daemon._read_task.cancel() + @pytest.mark.asyncio + async def test_start_does_not_write_pid_file_when_launch_fails( + self, + tmp_path: Path, + ) -> None: + cfg = _make_config(tmp_path) + daemon = BrokerDaemon(cfg) + + with patch.object( + daemon, + "_launch_upstream", + new=AsyncMock(side_effect=OSError("launch failed")), + ): + with pytest.raises(OSError, match="launch failed"): + await daemon.start() + + assert not cfg.pid_file.exists() + @pytest.mark.asyncio async def test_start_creates_data_dir(self, tmp_path: Path) -> None: nested = tmp_path / "a" / "b" / "c" From 4dd03fa6ee76f93cb7ff725512b9081bdb688865 Mon Sep 17 00:00:00 2001 From: Egor Merkushev Date: Wed, 18 Feb 2026 22:31:10 +0300 Subject: [PATCH 5/8] Archive task FU-P13-T2-2: Move PID file write to after successful upstream launch (PASS) --- ...ite_to_after_successful_upstream_launch.md | 4 ++++ .../FU-P13-T2-2_Validation_Report.md | 0 SPECS/ARCHIVE/INDEX.md | 4 +++- SPECS/INPROGRESS/next.md | 24 +++++++++---------- SPECS/Workplan.md | 7 +++--- 5 files changed, 23 insertions(+), 16 deletions(-) rename SPECS/{INPROGRESS => ARCHIVE/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch}/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md (98%) rename SPECS/{INPROGRESS => ARCHIVE/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch}/FU-P13-T2-2_Validation_Report.md (100%) diff --git a/SPECS/INPROGRESS/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md b/SPECS/ARCHIVE/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md similarity index 98% rename from SPECS/INPROGRESS/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md rename to SPECS/ARCHIVE/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md index 1ce37520..52e9ca08 100644 --- a/SPECS/INPROGRESS/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md +++ b/SPECS/ARCHIVE/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch.md @@ -64,3 +64,7 @@ runs only after upstream launch has completed successfully. - If behavior changes are not user-visible, no documentation updates are required. - If startup semantics or troubleshooting guidance changes, update `docs/troubleshooting.md`. + +--- +**Archived:** 2026-02-18 +**Verdict:** PASS diff --git a/SPECS/INPROGRESS/FU-P13-T2-2_Validation_Report.md b/SPECS/ARCHIVE/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch/FU-P13-T2-2_Validation_Report.md similarity index 100% rename from SPECS/INPROGRESS/FU-P13-T2-2_Validation_Report.md rename to SPECS/ARCHIVE/FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch/FU-P13-T2-2_Validation_Report.md diff --git a/SPECS/ARCHIVE/INDEX.md b/SPECS/ARCHIVE/INDEX.md index a776c092..0eb4c847 100644 --- a/SPECS/ARCHIVE/INDEX.md +++ b/SPECS/ARCHIVE/INDEX.md @@ -1,6 +1,6 @@ # mcpbridge-wrapper Tasks Archive -**Last Updated:** 2026-02-18 (FU-P13-T2-1) +**Last Updated:** 2026-02-18 (FU-P13-T2-2) ## Archived Tasks @@ -113,6 +113,7 @@ | FU-P13-T4-1 | [FU-P13-T4-1_Fix_asyncio_get_event_loop_deprecation_in_BrokerProxy/](FU-P13-T4-1_Fix_asyncio_get_event_loop_deprecation_in_BrokerProxy/) | 2026-02-18 | PASS | | FU-P13-T4-2 | [FU-P13-T4-2_Implement_or_remove_reconnect_parameter_in_BrokerProxy/](FU-P13-T4-2_Implement_or_remove_reconnect_parameter_in_BrokerProxy/) | 2026-02-18 | PASS | | FU-P13-T2-1 | [FU-P13-T2-1_Replace_run_forever_polling_with_Event_wait/](FU-P13-T2-1_Replace_run_forever_polling_with_Event_wait/) | 2026-02-18 | PASS | +| FU-P13-T2-2 | [FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch/](FU-P13-T2-2_Move_PID_file_write_to_after_successful_upstream_launch/) | 2026-02-18 | PASS | ## Historical Artifacts @@ -332,3 +333,4 @@ | 2026-02-18 | FU-P13-T4-2 | Archived REVIEW_FU-P13-T4-2_broker_proxy_reconnect report | | 2026-02-18 | FU-P13-T2-1 | Archived Replace_run_forever_polling_with_Event_wait (PASS) | | 2026-02-18 | FU-P13-T2-1 | Archived REVIEW_FU-P13-T2-1_event_wait_shutdown report | +| 2026-02-18 | FU-P13-T2-2 | Archived Move_PID_file_write_to_after_successful_upstream_launch (PASS) | diff --git a/SPECS/INPROGRESS/next.md b/SPECS/INPROGRESS/next.md index 1861dd1c..74ac283a 100644 --- a/SPECS/INPROGRESS/next.md +++ b/SPECS/INPROGRESS/next.md @@ -1,16 +1,16 @@ -# Next Task: FU-P13-T2-2 — Move PID file write to after successful upstream launch +# No Active Task -**Priority:** P3 -**Phase:** Phase 13: Persistent Broker & Shared Xcode Session -**Effort:** 1 hour -**Dependencies:** P13-T2 -**Status:** Selected +## Recently Archived -## Description +- 2026-02-18 — FU-P13-T2-2: Move PID file write to after successful upstream launch (PASS) +- 2026-02-18 — FU-P13-T2-1: Replace run_forever() polling loop with asyncio.Event-based wait (PASS) +- 2026-02-18 — FU-P13-T4-2: Implement or remove reconnect parameter in BrokerProxy (PASS) +- 2026-02-18 — FU-P13-T4-1: Fix asyncio.get_event_loop() deprecation in BrokerProxy (PASS) +- 2026-02-18 — P13-T6: Document broker mode configuration, migration, and rollback (PASS) +- 2026-02-18 — P13-T5: Validate prompt reduction and multi-client stability (PARTIAL) -Move PID file write in `BrokerDaemon.start()` to execute only after `_launch_upstream()` -completes successfully, preventing stale live-PID locks when launch fails mid-startup. +## Suggested Next Tasks -## Next Step - -Run the PLAN command to generate the implementation-ready PRD. +- P13-T5 follow-up — Complete interactive prompt verification in a desktop session (P1) +- FU-BUG-T7-1 — Cap `pending_methods` map to guard against unbounded growth (P3) +- FU-P12-T1-1 — Remove or document `MCPInitializeParams` in schemas (P3) diff --git a/SPECS/Workplan.md b/SPECS/Workplan.md index bedc5f33..ed8787c8 100644 --- a/SPECS/Workplan.md +++ b/SPECS/Workplan.md @@ -2020,15 +2020,16 @@ Phase 9 Follow-up Backlog --- -#### FU-P13-T2-2: Move PID file write to after successful upstream launch **INPROGRESS** +#### ✅ FU-P13-T2-2: Move PID file write to after successful upstream launch +- **Status:** ✅ Completed (2026-02-18) - **Type:** Robustness - **Priority:** P3 - **Discovered:** 2026-02-17 (REVIEW_P13-T2) - **Component:** BrokerDaemon.start() - **Description:** PID file is currently written before upstream subprocess is launched. A crash between write and launch leaves a live-PID lock that blocks future starts until the owning process dies. Move the write to after successful launch. - **Acceptance Criteria:** - - [ ] PID file is written only after `_launch_upstream()` succeeds - - [ ] Stale-lock tests continue to pass + - [x] PID file is written only after `_launch_upstream()` succeeds + - [x] Stale-lock tests continue to pass --- From 9d6fa669743a7225ba433382f7be018d26e8da3f Mon Sep 17 00:00:00 2001 From: Egor Merkushev Date: Wed, 18 Feb 2026 22:31:30 +0300 Subject: [PATCH 6/8] Review FU-P13-T2-2: pid write order --- .../REVIEW_FU-P13-T2-2_pid_write_order.md | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 SPECS/INPROGRESS/REVIEW_FU-P13-T2-2_pid_write_order.md diff --git a/SPECS/INPROGRESS/REVIEW_FU-P13-T2-2_pid_write_order.md b/SPECS/INPROGRESS/REVIEW_FU-P13-T2-2_pid_write_order.md new file mode 100644 index 00000000..f953f808 --- /dev/null +++ b/SPECS/INPROGRESS/REVIEW_FU-P13-T2-2_pid_write_order.md @@ -0,0 +1,33 @@ +## REVIEW REPORT — FU-P13-T2-2 pid write order + +**Scope:** origin/main..HEAD +**Files:** 7 + +### Summary Verdict +- [x] Approve +- [ ] Approve with comments +- [ ] Request changes +- [ ] Block + +### Critical Issues +- None. + +### Secondary Issues +- None. + +### Architectural Notes +- The startup sequence in `BrokerDaemon.start()` now aligns with lock-file safety expectations: + lock check → upstream launch → PID write. This removes the stale-lock window called out in the + follow-up without changing lifecycle state transitions. + +### Tests +- Added regression test `test_start_does_not_write_pid_file_when_launch_fails`. +- Required gates executed and passing: + - `pytest -q` + - `ruff check src/` + - `mypy src/` + - `pytest --cov=src/mcpbridge_wrapper --cov-report=term-missing` +- Coverage remains above threshold (92.25% ≥ 90%). + +### Next Steps +- No actionable findings. FOLLOW-UP is skipped for this review. From 5af4a934cb69aed82e40e9ca1314b6bec0794a3b Mon Sep 17 00:00:00 2001 From: Egor Merkushev Date: Wed, 18 Feb 2026 22:31:59 +0300 Subject: [PATCH 7/8] Archive REVIEW_FU-P13-T2-2_pid_write_order report --- SPECS/ARCHIVE/INDEX.md | 4 +++- .../_Historical}/REVIEW_FU-P13-T2-2_pid_write_order.md | 0 2 files changed, 3 insertions(+), 1 deletion(-) rename SPECS/{INPROGRESS => ARCHIVE/_Historical}/REVIEW_FU-P13-T2-2_pid_write_order.md (100%) diff --git a/SPECS/ARCHIVE/INDEX.md b/SPECS/ARCHIVE/INDEX.md index 0eb4c847..f6e841e3 100644 --- a/SPECS/ARCHIVE/INDEX.md +++ b/SPECS/ARCHIVE/INDEX.md @@ -1,6 +1,6 @@ # mcpbridge-wrapper Tasks Archive -**Last Updated:** 2026-02-18 (FU-P13-T2-2) +**Last Updated:** 2026-02-18 (REVIEW_FU-P13-T2-2) ## Archived Tasks @@ -190,6 +190,7 @@ | [REVIEW_FU-P13-T4-1_broker_proxy_loop.md](_Historical/REVIEW_FU-P13-T4-1_broker_proxy_loop.md) | Review report for FU-P13-T4-1 | | [REVIEW_FU-P13-T4-2_broker_proxy_reconnect.md](_Historical/REVIEW_FU-P13-T4-2_broker_proxy_reconnect.md) | Review report for FU-P13-T4-2 | | [REVIEW_FU-P13-T2-1_event_wait_shutdown.md](_Historical/REVIEW_FU-P13-T2-1_event_wait_shutdown.md) | Review report for FU-P13-T2-1 | +| [REVIEW_FU-P13-T2-2_pid_write_order.md](_Historical/REVIEW_FU-P13-T2-2_pid_write_order.md) | Review report for FU-P13-T2-2 | ## Archive Log @@ -334,3 +335,4 @@ | 2026-02-18 | FU-P13-T2-1 | Archived Replace_run_forever_polling_with_Event_wait (PASS) | | 2026-02-18 | FU-P13-T2-1 | Archived REVIEW_FU-P13-T2-1_event_wait_shutdown report | | 2026-02-18 | FU-P13-T2-2 | Archived Move_PID_file_write_to_after_successful_upstream_launch (PASS) | +| 2026-02-18 | FU-P13-T2-2 | Archived REVIEW_FU-P13-T2-2_pid_write_order report | diff --git a/SPECS/INPROGRESS/REVIEW_FU-P13-T2-2_pid_write_order.md b/SPECS/ARCHIVE/_Historical/REVIEW_FU-P13-T2-2_pid_write_order.md similarity index 100% rename from SPECS/INPROGRESS/REVIEW_FU-P13-T2-2_pid_write_order.md rename to SPECS/ARCHIVE/_Historical/REVIEW_FU-P13-T2-2_pid_write_order.md From c2bc1daa49d5cafcae78a31b414d9dd7636f9e6d Mon Sep 17 00:00:00 2001 From: Egor Merkushev Date: Wed, 18 Feb 2026 22:34:09 +0300 Subject: [PATCH 8/8] Fix FU-P13-T2-2 CI lint: combine nested with statements --- tests/unit/test_broker_daemon.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_broker_daemon.py b/tests/unit/test_broker_daemon.py index d403dff8..09d3bc63 100644 --- a/tests/unit/test_broker_daemon.py +++ b/tests/unit/test_broker_daemon.py @@ -129,9 +129,8 @@ async def test_start_does_not_write_pid_file_when_launch_fails( daemon, "_launch_upstream", new=AsyncMock(side_effect=OSError("launch failed")), - ): - with pytest.raises(OSError, match="launch failed"): - await daemon.start() + ), pytest.raises(OSError, match="launch failed"): + await daemon.start() assert not cfg.pid_file.exists()