diff --git a/src/cbb_refresh_verify/residual_sessions.py b/src/cbb_refresh_verify/residual_sessions.py index d55201d..ad54e07 100644 --- a/src/cbb_refresh_verify/residual_sessions.py +++ b/src/cbb_refresh_verify/residual_sessions.py @@ -839,11 +839,11 @@ def _request_close(row, *, stop=None): return {'release_status':'WAITING','detail':'取消启动会话的用户或 Windows 会话未确认'} if stop is not None and stop.is_set(): return {'release_status':'CANCELLED','detail':'已停止释放'} - if proof['job'].get('diagnostic_only') is False: - return _ordinary_startup_close(row,handle,proof,stop=stop) from .session_record import handoff_session record_path = Path(proof['record_path']) handoff_session(record_path, evidence_root=record_path.parent, observe_only=False) + if proof['job'].get('diagnostic_only') is False: + return _ordinary_startup_close(row,handle,proof,stop=stop) from .operation_queue import native_phase # This confirmed no-write native cleanup has its own single bounded # budget; metadata inactivity must not abandon it between No and Close. diff --git a/tests/test_observer_startup_cleanup.py b/tests/test_observer_startup_cleanup.py index 901dd41..54ff9ad 100644 --- a/tests/test_observer_startup_cleanup.py +++ b/tests/test_observer_startup_cleanup.py @@ -82,6 +82,14 @@ def test_retained_phase_never_repeats_worker_no_on_still_visible_prompt(tmp_path assert not messages and records and 30<=state['ticks']<30.2 +def test_explicit_ordinary_release_promotes_cold_observer_before_native_action(tmp_path,monkeypatch): + job,row,records,messages,state=fixture(tmp_path,monkeypatch) + assert residual_sessions._request_close(row)['release_status']=='RELEASED' + assert state['observer_requests'] + path,actions,options=state['observer_requests'][0] + assert path==tmp_path/'session.json' and actions==[] and options['observe_only'] is False + + @pytest.mark.parametrize('obstacle',['unknown','hidden_document','revoked']) def test_late_observer_preserves_unknown_or_changed_loaded_state_before_claim(tmp_path,monkeypatch,obstacle): job,row,records,messages,state=fixture(tmp_path,monkeypatch)