feat(directives): harvest 2 directives from docs/guide_state_lifecycle.md (undo/redo 100-snapshot, reset preserves project path)

This commit is contained in:
ed
2026-07-02 23:56:33 -04:00
parent a758f0a4c9
commit 454fac1bff
4 changed files with 77 additions and 0 deletions
@@ -0,0 +1,7 @@
# reset_session_preserves_project_path
## v1
**Why this iteration:** Lifted verbatim from `docs/guide_state_lifecycle.md:217-244 (§3 Reset)`.
**Source:** `docs/guide_state_lifecycle.md:217-244 (§3 Reset)`
**Lifted:** 2026-07-02 (Phase A expansion harvest; user directive 2026-07-02)
@@ -0,0 +1,27 @@
## _handle_reset_session field-clear contract
`src/app_controller.py:3286-3356 _handle_reset_session` is the **nuclear** reset, called from the Reset Session button in the message panel. It clears 30+ state buckets:
- **AI client**: `ai_client.reset_session()` + `clear_comms_log()`
- **Tool stats**: `_tool_log.clear()`, `_tool_stats.clear()`, `_comms_log.clear()`
- **Discussion**: `self.disc_entries.clear()`; for each discussion in project: `discussions[d_name]["history"] = []`
- **Files**: `self.files.clear()`, `self.context_files.clear()`
- **Tracks**: `self.tracks.clear()`
- **Project dict (full replacement)**: `self.project = project_manager.default_project(...)`
- **Project paths**: `self.project_paths = []`
- **AI status**: `ai_status = "session reset"`, `ai_response = ""`
- **UI inputs**: `ui_ai_input = ""`, `ui_manual_approve = False`, `ui_auto_add_history = False`
- **MMA**: `active_track = None`, `active_tier = None`, `mma_status = "idle"`, ...
- **Provider/model**: `_current_provider = "gemini"`, `_current_model = "gemini-2.5-flash-lite"`
- **Locks + queues**: `_pending_history_adds.clear()`, `_api_event_queue.clear()`, `_pending_gui_tasks.clear()`
- **Prompts**: `ui_use_default_base_prompt = True`, all 3 system prompts = `''`
- **Persona/tool settings**: `ui_active_persona = ''`, `ui_active_tool_preset = None`, ...
- **Generation params**: `temperature = 0.0`, `top_p = 1.0`, `max_tokens = 8192`
## What It Does NOT Touch (the preserve list)
| Field | Why preserved |
|---|---|
| `self.active_project_path` | `_do_project_switch` writes to this path; clearing it would cause OSError on next switch and an infinite re-switch loop. The 2026-06-08 regression test `test_context_sim_live` documents this. |
| `self.history` (the `HistoryManager`) | The undo stack survives a reset. Ctrl+Z after a reset can restore the pre-reset state. This may be a bug or a feature. |
| The on-disk `manual_slop.toml` | The saved project TOML is not deleted or rewritten. Switching projects after reset reloads from disk. |