Extracted _autosave_flush_result(app) -> Result[None] helper above the
call site in render_main_interface.
ANTI-SLIMING: full Result[T] propagation (NO except+pass with comment).
The helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17). The 'don't disrupt the GUI loop' intent is
preserved via the data plane (app._last_request_errors) rather than
silent swallow.
The legacy render_main_interface code preserves its behavior, calls the
helper, and drains errors to app._last_request_errors.
Tests: 2 new tests verify both paths (success and OSError).
Audit: L1693 reclassified from INTERNAL_SILENT_SWALLOW (5 sites remaining,
was 6). New helper L1693 is INTERNAL_COMPLIANT.
Extracted _focus_response_window_result() -> Result[None] helper above
the call site in render_main_interface.
ANTI-SLIMING: full Result[T] propagation (NO bare-except+pass). The
helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).
The legacy render_main_interface code preserves its behavior, calls
the helper, drains errors to app._last_request_errors.
Tests: 2 new tests verify both paths (success and RuntimeError).
Audit: L1647 reclassified from INTERNAL_SILENT_SWALLOW (6 sites remaining,
was 7). New helper L1647 is INTERNAL_COMPLIANT.
Extracted _close_vscode_diff_terminate_result(app) -> Result[None]
helper above the App._close_vscode_diff method.
ANTI-SLIMING: full Result[T] propagation (NO except+pass). The helper
returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).
The legacy _close_vscode_diff method preserves its signature, calls
the helper, drains errors to self._last_request_errors, and proceeds
to set self._vscode_diff_process = None (preserving the original
post-error behavior of clearing the handle).
Tests: 2 new tests verify both paths (success and OSError).
Audit: L1466 reclassified from INTERNAL_SILENT_SWALLOW (7 sites remaining,
was 8). New helper L1466 is INTERNAL_COMPLIANT.
Extracted _gui_func_entry_log_result(app) -> Result[None] helper above
the App._gui_func method.
ANTI-SLIMING: full Result[T] propagation (NO except+pass-after-log).
The helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).
The legacy _gui_func method preserves its signature, calls the helper,
drains errors to self._last_request_errors, and proceeds with the
rest of the render loop.
Tests: 2 new tests verify both paths (success and OSError).
Audit: L1152 reclassified from INTERNAL_SILENT_SWALLOW (8 sites remaining,
was 9). New helper L1152 is INTERNAL_COMPLIANT.
Extracted _shutdown_save_ini_result(app) -> Result[None] helper above
the App.shutdown method.
ANTI-SLIMING: full Result[T] propagation (NO bare-except+pass). The
helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).
The legacy shutdown method preserves its signature, calls the helper,
drains errors to self._startup_timeline_errors, and proceeds to
self.controller.shutdown().
Tests: 2 new tests verify both paths (success and OSError).
Audit: L1052 reclassified from INTERNAL_SILENT_SWALLOW (9 sites remaining,
was 10). New helper L1052 is INTERNAL_COMPLIANT.
Extracted _run_immapp_result(app) -> Result[None] helper above the
App.run method.
ANTI-SLIMING: full Result[T] propagation (NO pass-after-print). The
helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17). The legacy run() wrapper sets
controller._gui_degraded_reason and _last_imgui_assert (the canonical
degradation drain), appends to _startup_timeline_errors, and returns
WITHOUT the original stderr.print logging.
Tests: 2 new tests verify both paths (success and RuntimeError).
Audit: L728 reclassified from INTERNAL_SILENT_SWALLOW (10 sites remaining,
was 11). New helper L728 is INTERNAL_COMPLIANT.
Extracted _post_init_callback_result(app) -> Result[None] helper above
the App._post_init method.
ANTI-SLIMING: full Result[T] propagation (NO pass-after-logging). The
helper returns Result(data=None) on success or Result(data=None,
errors=[ErrorInfo]) on exception (logging NOT a drain per the user's
principle 2026-06-17).
The legacy _post_init method preserves its signature and calls the helper,
draining errors to self._startup_timeline_errors.
Tests: 2 new tests verify both paths (success and RuntimeError).
Audit: L612 reclassified from INTERNAL_SILENT_SWALLOW (10 sites remaining,
was 11). New helper L612 is INTERNAL_COMPLIANT.
Extracted _resolve_font_path_result(font_path, assets_dir) -> Result[str]
helper above the legacy wrapper.
ANTI-SLIMING: full Result[T] propagation (NO narrowing+logging). The helper
returns Result(data=resolved_path) on success or Result(data=fallback,
errors=[ErrorInfo]) on exception at Path.is_relative_to (logging NOT a
drain per the user's principle 2026-06-17).
The legacy _resolve_font_path() wrapper preserves its signature and
delegates to the helper. The call site in App._load_fonts invokes the
result helper directly and drains errors to self._startup_timeline_errors.
Tests: 2 new tests verify both paths (relative-under-assets success and
is_relative_to raising ValueError on cross-drive paths).
Audit: L264 reclassified from INTERNAL_SILENT_SWALLOW (11 sites remaining,
was 12). New helper L243 is INTERNAL_COMPLIANT.
Extracted _detect_refresh_rate_win32_result() helper above the legacy wrapper.
ANTI-SLIMING: full Result[T] propagation (NO narrowing+logging). The helper
returns Result(data=rate) on success or Result(data=0.0, errors=[ErrorInfo])
on exception (logging NOT a drain per the user's principle 2026-06-17).
The legacy _detect_refresh_rate_win32() wrapper preserves its signature and
delegates to the helper. The call site in App.__init__ invokes the result
helper directly and drains errors to self._startup_timeline_errors.
Tests: 2 new tests (test_phase_10_l216_detect_refresh_rate_win32_result_success,
test_phase_10_l216_detect_refresh_rate_win32_result_failure) verify both paths.
Audit: L216 reclassified from INTERNAL_SILENT_SWALLOW (12 sites remaining,
was 13). New helper L219 is INTERNAL_COMPLIANT.
CRITICAL ANTI-SLIMING PHASE.
Per the user's principle (2026-06-17) and error_handling.md:530:
'IF ANY PLACE HAS A ERROR LOG IT ALSO NEEDS A RESULT[T]. RESULT[T]
PROPOGATES UNTIL IT REACHED A DRAIN POINT WHERE THE ERROR CAN BE
HANDLED APPROPRIATELY WITHOUT CRASHING THE APP.'
The 13 INTERNAL_SILENT_SWALLOW sites have logging-only except bodies
(sys.stderr.write, print, traceback.print_exc). Per the styleguide,
logging is NOT a drain. These sites MUST be migrated to full
Result[T] propagation. No narrowing + logging; no pass after
logging; no intentional silent recovery.
Migration pattern for Phase 10:
1. Extract a _<site>_result helper that returns Result[bool]
2. The helper's except body converts the exception to ErrorInfo
3. The legacy wrapper drains to the appropriate data plane attr:
- _startup_timeline_errors for startup-time (L216, L241, L567, L684, L971)
- _last_request_errors for render-loop/event handler (L1071, L1501, L1527, L6691, L7026, L7042)
- _worker_errors for background thread callbacks (L4739, L1345)
The 13 sites (per PHASE1_SITE_INVENTORY.md):
- L216 _detect_refresh_rate_win32
- L241 _resolve_font_path
- L567 _post_init
- L684 run
- L971 shutdown
- L1071 _gui_func
- L1345 _close_vscode_diff
- L1501 render_main_interface (auto-save)
- L1527 render_main_interface (auto-save)
- L4739 _on_warmup_complete_callback
- L6691 render_tier_stream_panel
- L7026 render_task_dag_panel
- L7042 render_task_dag_panel
One atomic commit per site. NO sliming heuristics. NO pass-after-logging.
NO 'intentional silent recovery'. Each site becomes a Result[T].
The Phase 6 invariant test was originally written to assert ==3 (the
pre-Phase-7 baseline). After Phases 7-8 migrated the 3 remaining sites,
the count dropped to 0, which broke the strict equality assertion.
Changed to <=3 (matching the Phase 5 invariant test pattern) so the
test passes at every point in the migration timeline. Documented the
robustness rationale in the test docstring.
Adds 2 invariant tests:
- test_phase_9_invariant_helper_utility_count_dropped: pins the count
to exactly 0 (post-Phase-9 baseline; no Phase 9 sites, count should
remain 0 after Phases 7-8 dropped it).
- test_phase_9_invariant_zero_sites_in_phase_9: documents that no
Phase 9 site tests exist (machine-checkable: future agent adding a
Phase 9 site will see this test fail at the count assertion).
Per PHASE1_SITE_INVENTORY.md, the one Phase 9 site (L1398 _close_vscode_diff)
is INTERNAL_SILENT_SWALLOW (the bare-except classification) and will be
handled in Phase 10 (logging NOT a drain per the convention).
Updates state.toml: phase_9 status = completed.
Adds 2 invariant tests:
- test_phase_8_invariant_property_setter_count_dropped: pins the count
to exactly 0 (post-Phase-8 baseline; all 22 INTERNAL_BROAD_CATCH sites
in src/gui_2.py migrated across Phases 3-8).
- test_phase_8_invariant_all_2_migration_sites_have_tests: verifies the
2 migrated sites (L591, L897) have both success and failure tests.
Updates state.toml: phase_8 status = completed.
Migrate the imgui.save_ini_settings_to_memory try/except in
App._capture_workspace_profile (L897) to the canonical Result[T] pattern:
- Extract _capture_workspace_profile_ini_result(app) -> Result[str]
helper into Phase 8 Property Setter / State Result Helpers region.
- The legacy _capture_workspace_profile method calls the helper and
drains errors to app._last_request_errors (per FR-BC-4 event-handler
drain pattern; this is a property setter on the App).
- The original fallback behavior (ini = '' on failure) is preserved
so the legacy WorkspaceProfile still constructs with empty ini_content.
Tests:
- test_phase_8_l897_capture_workspace_profile_ini_result_success
- test_phase_8_l897_capture_workspace_profile_ini_result_failure
Audit: INTERNAL_BROAD_CATCH count in src/gui_2.py is now 0. All 22
INTERNAL_BROAD_CATCH sites originally in src/gui_2.py have been
migrated to Result[T] across Phases 3-8.
Migrate the ini-file-read try/except in App._diag_layout_state (L591) to
the canonical Result[T] pattern:
- Extract _diag_layout_state_ini_text_result(app, ini_path) -> Result[str]
helper into new Phase 8 Property Setter / State Result Helpers region.
- The legacy _diag_layout_state method calls the helper and drains errors
to app._startup_timeline_errors (the Phase 2 drain plane for startup
callbacks).
- The original fallback behavior (early return on read failure, stderr
write for visibility) is preserved.
Tests:
- test_phase_8_l591_diag_layout_state_ini_text_result_success
- test_phase_8_l591_diag_layout_state_ini_text_result_failure
Audit: INTERNAL_BROAD_CATCH count in src/gui_2.py dropped from 2 to 1
(remaining: L896 _capture_workspace_profile, formerly L897 in inventory).
Adds 2 invariant tests:
- test_phase_7_invariant_batch_d_count_dropped: pins the count to <=2
(post-Phase-7 baseline, down from 3 pre-Phase-7).
- test_phase_7_invariant_all_1_migration_sites_have_tests: verifies the
1 migrated site (L4321 worker) has both success and failure tests.
Updates state.toml: phase_7 status = completed.
Migrate the worker() closure in _check_auto_refresh_context_preview (L4321)
to the canonical Result[T] pattern:
- Extract _worker_context_preview_result(app) -> Result[None] helper into
new Phase 7 Worker/Background Result Helpers region.
- The legacy worker() wrapper calls the helper and drains errors to
app.controller._worker_errors (with controller._worker_errors_lock
acquired on append) per sub-track 3 Phase 6 Group 6.5 telemetry drain.
- The try/finally cleanup (setting _is_generating_preview=False and
handling _pending_preview_refresh) is preserved verbatim.
Tests:
- test_phase_7_l4321_worker_context_preview_result_success
- test_phase_7_l4321_worker_context_preview_result_failure
Audit: INTERNAL_BROAD_CATCH count in src/gui_2.py dropped from 3 to 2
(remaining: L591 _diag_layout_state, L897 _capture_workspace_profile).
The lock-protected append ensures thread-safety when multiple worker
threads call _report-style drains concurrently. The helper preserves
the original fallback behavior (app.context_preview_text =
'Error generating context preview.' on failure) so the user-visible
UX is unchanged.
Per PHASE1_SITE_INVENTORY.md, Phase 6 (signal-handler category) has 0
INTERNAL_BROAD_CATCH sites in src/gui_2.py. All sites that might appear
in a signal-handler category were classified into other phases (Phase 8
for startup callbacks, Phase 7 for worker/background).
Adds 2 invariant tests:
- test_phase_6_invariant_signal_handler_count_dropped: pins the count
to exactly 3 (the pre-Phase-7 baseline) before Phases 7-9 migrate.
- test_phase_6_invariant_zero_sites_in_phase_6: documents that no
Phase 6 site tests exist (machine-checkable: future agent adding a
Phase 6 site will see this test fail at the count assertion).
Updates state.toml: phase_6 status = completed.
Extract _render_context_batch_actions_preview_result helper from the
_do_generate preview try/except in render_context_batch_actions. The
imgui.button callback drains errors to app._last_request_errors per FR-BC-4
event-handler pattern.
[pre-audit] L3582 INTERNAL_BROAD_CATCH
[post-audit] V count: 8 -> 7 (L3582 removed)
Extract _render_tool_preset_bias_save_result helper from the BiasProfile
save try/except in render_tool_preset_manager_content. The imgui.button
callback drains errors to app._last_request_errors per FR-BC-4
event-handler pattern.
[pre-audit] L3163 INTERNAL_BROAD_CATCH
[post-audit] V count: 9 -> 8 (L3163 removed)
Extract request_patch_from_tier4_result helper from the
ai_client.run_tier4_patch_generation try/except in App.request_patch_from_tier4.
Legacy wrapper drains errors to app._last_request_errors per FR-BC-4
event-handler pattern.
[pre-audit] L1428 INTERNAL_BROAD_CATCH
[post-audit] V count: 10 -> 9 (L1428 removed)
Extract _apply_pending_patch_result helper from the apply_patch_to_file
try/except in App._apply_pending_patch. Legacy wrapper drains errors to
app._last_request_errors per FR-BC-4 event-handler pattern.
[pre-audit] L1367 INTERNAL_BROAD_CATCH
[post-audit] V count: 12 -> 11 (L1367 removed)
Extract _populate_auto_slices_outline_result helper from the
mcp_client.{py,ts_c,ts_cpp}_get_code_outline try/except in
App._populate_auto_slices. Legacy wrapper drains errors to
app._last_request_errors per FR-BC-4 event-handler pattern.
[pre-audit] L1284 INTERNAL_BROAD_CATCH
[post-audit] V count: 14 -> 13 (L1284 removed)
Per AI Agent Checklist Rule #0 (re-read per phase).
Phase 5 focuses on the 13 INTERNAL_BROAD_CATCH sites inside event handler
functions. Per the spec (FR-BC-4), the drain for event handlers is
to accumulate in app._last_request_errors or a similar per-event
accumulator (not imgui.open_popup, since the event handler is called
from a button click, not a render frame).
Event handler sites (per PHASE1_SITE_INVENTORY.md):
- L1335, L1344 (_populate_auto_slices): mcp_client calls
- L1418 (_apply_pending_patch): patch modal handler
- L1444 (_open_patch_in_external_editor): external editor launch
- L1479 (request_patch_from_tier4): tier4 patch generation
- L3214 (render_tool_preset_manager_content): modal content render
- L3633 (render_context_batch_actions): modal content render
- L5430 (render_operations_hub): tab content render
- L5836 (render_text_viewer_window): window render
- L5970 (render_external_editor_panel): panel render
- L7258 (render_beads_tab): tab render
The legacy wrapper pattern: extract a _<site>_result helper that
returns Result[bool]; the legacy wrapper routes errors to
app._last_request_errors.append((op_name, ErrorInfo(...))).
The Phase 3 invariant test (test_phase_3_invariant_batch_a_count_dropped)
asserted exactly 17 INTERNAL_BROAD_CATCH sites, the post-Phase 3 baseline.
After Phase 4 migrates 3 more sites, the count drops to 14. The test now
asserts <= 17 (the upper bound; the Phase 3 boundary).
Adds test_phase_4_invariant_batch_b_count_dropped: locks in <= 14 sites
(post-Phase 4 baseline; down from 17).
Adds test_phase_4_invariant_all_3_migration_sites_have_tests: ensures each
of the 3 Batch B sites (L3398, L3718, L3740) has both _success and _failure tests.
All 30 tests pass.
Adds _render_ast_inspector_outline_result(app, f_path) -> Result[str] helper that wraps
the mcp_client.configure + outline fetch try/except in render_ast_inspector_modal.
The data field carries the outline string so the legacy wrapper can iterate it
without an additional instance attribute. Errors drain to app._last_request_errors
(per FR-BC-3 modal pattern; data plane attribute).
Audit: BROAD_CATCH count 16 -> 15, COMPLIANT count 21 -> 22. Migration
target count drops by 1. Tests: 2/2 pass.
Tier-2 autonomous sandbox-specific files leaked into the main repo
via an accidental `git add .` in the tier-2 clone. Revert the
selective subset the user identified (not the whole commit):
- Delete .opencode/agents/tier2-autonomous.md and
.opencode/commands/tier-2-auto-execute.md (canonical sources
remain at conductor/tier2/agents/ and conductor/tier2/commands/)
- Restore opencode.json MCP path to manual_slop and restore the
default_agent: tier2-tech-lead
- Restore mcp_paths.toml extra_dirs to ["C:/projects/gencpp"]
The other changes in 00e5a3f2 (4 throwaway scripts under
scripts/tier2/artifacts/, the project_history.toml timestamp) are
out of scope for this fix and remain at HEAD.
The Phase 1 test originally asserted exactly 42 migration-target sites.
After Phase 3 migrated 8 sites, the count dropped to 34. The test
now asserts <= 42 (the starting count) so it passes both at Phase 1
boundary and after subsequent phases migrate sites.
Per-phase invariant tests (added in Phase 3+ test files) verify the
specific expected count per phase.
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.
Adds _render_warmup_status_indicator_result(app) -> Result[dict] helper that
wraps the controller.warmup_status() try/except in
render_warmup_status_indicator. The data field carries the status dict so
the legacy wrapper can use it for rendering without an additional instance
attribute.
render_warmup_status_indicator becomes a thin wrapper that drains errors
to app.controller._worker_errors under the controller's lock (worker error
plane; thread-safe per app_controller pattern).
Audit: BROAD_CATCH count 18 -> 17, COMPLIANT count 19 -> 20. Migration
target count drops from 42 to 34 (8 sites migrated). Tests: 2/2 pass.
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 3.
Adds _handle_history_logic_result(app) -> Result[bool] helper that wraps
the snapshot debounce try/except from App._handle_history_logic. The
_is_applying_snapshot pre-condition guard stays in the legacy wrapper
(not error handling; the original early return has no try/except).
App._handle_history_logic becomes a thin wrapper that drains errors to
_last_request_errors. The drain failure mode is structurally safe
(hasattr check + append) so no outer try/except is required (per the
L1123 wrapper decision; avoiding new INTERNAL_SILENT_SWALLOW violations).
Audit: BROAD_CATCH count 19 -> 18, COMPLIANT count 18 -> 19. Tests: 2/2 pass.