chore(conductor): Add new track 'Advanced Log Management and Session Restoration'

This commit is contained in:
2026-03-08 12:53:42 -04:00
parent c11df55a25
commit 5e6a38a790
5 changed files with 120 additions and 18 deletions

View File

@@ -0,0 +1,5 @@
# Track log_session_overhaul_20260308 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)

View File

@@ -0,0 +1,8 @@
{
"track_id": "log_session_overhaul_20260308",
"type": "feature",
"status": "new",
"created_at": "2026-03-08T12:53:00Z",
"updated_at": "2026-03-08T12:53:00Z",
"description": "Move comms log's load log button to log management. Make it load an entire session's log instead of just comms. Rework loading implementation for reliability. Handle and filter MMA agent logs in comms log. Offload generated scripts and tool output to separate files with ID referencing. Relocate performance warnings from discussion to transient diagnostic logs."
}

View File

@@ -0,0 +1,38 @@
# Implementation Plan: Advanced Log Management and Session Restoration
## Phase 1: Storage Optimization (Offloading Data)
- [ ] Task: Implement file-based offloading for scripts and tool outputs.
- [ ] Update `src/session_logger.py` to include `log_tool_output(session_id, output)` which saves output to a unique file in the session directory and returns the filename.
- [ ] Modify `src/session_logger.py:log_tool_call` to ensure scripts are consistently saved and return a unique filename/ID.
- [ ] Update `src/app_controller.py` to use these unique IDs/filenames in the `payload` of comms and tool logs instead of raw content.
- [ ] Task: Verify that logs are smaller and scripts/outputs are correctly saved to the session directory.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Storage Optimization' (Protocol in workflow.md)
## Phase 2: Session-Level Restoration & UI Relocation
- [ ] Task: Relocate the "Load Log" button.
- [ ] Remove the "Load Log" button from `_render_comms_history_panel` in `src/gui_2.py`.
- [ ] Add the "Load Log" button to the "Log Management" panel in `src/gui_2.py`.
- [ ] Task: Rework `cb_load_prior_log` for session-level loading.
- [ ] Update `src/app_controller.py:cb_load_prior_log` to allow selecting a session directory or the main session log file.
- [ ] Implement logic to load all related logs (comms, mma, tools) for that session.
- [ ] Ensure that for entries referencing external files (scripts/outputs), the content is loaded on-demand or during the restoration process.
- [ ] Task: Implement "Historical Replay" UI mode.
- [ ] In `src/gui_2.py`, implement logic to tint the UI (as already partially done for comms) when `is_viewing_prior_session` is True.
- [ ] Populate `disc_entries`, `_comms_log`, and MMA Dashboard states from the loaded session logs.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Session-Level Restoration' (Protocol in workflow.md)
## Phase 3: Diagnostic Log & Discussion Cleanup
- [ ] Task: Clean up discussion history and implement Diagnostic Tab.
- [ ] Add `self.diagnostic_log` (a list of transient messages) to `AppController`.
- [ ] Update `src/app_controller.py:_on_performance_alert` to append to `self.diagnostic_log` instead of `disc_entries`.
- [ ] Update `src/ai_client.py` (and other areas) to redirect "SYSTEM WARNING" and similar performance-related messages to the diagnostic log via a new event type.
- [ ] Add a "Diagnostics" tab to the Log Management panel in `src/gui_2.py` to render `self.diagnostic_log`.
- [ ] Ensure `diagnostic_log` is NOT persisted to `manual_slop.toml` or restored during session loads.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Diagnostic Log & Cleanup' (Protocol in workflow.md)
## Phase 4: MMA Log Integration & Filtering
- [ ] Task: Improve MMA log visibility and filtering.
- [ ] Ensure MMA sub-agent `log_comms` calls include sufficient metadata (tier, role) for filtering.
- [ ] Update `_render_comms_history_panel` in `src/gui_2.py` to ensure MMA logs are clearly distinct and correctly filtered based on existing UI toggles.
- [ ] Task: Final end-to-end verification of session restoration and log management.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: MMA Log Integration' (Protocol in workflow.md)

View File

@@ -0,0 +1,47 @@
# Specification: Advanced Log Management and Session Restoration
## Overview
This track focuses on centralizing log management, improving the reliability and scope of session restoration, and optimizing log storage by offloading large data blobs (scripts and tool outputs) to external files. It also aims to "clean" the discussion history by moving transient system warnings to a dedicated diagnostic log.
## Functional Requirements
### 1. Centralized Log Management
- Move the "Load Log" functionality from the Comms Log panel to the **Log Management** panel.
- Update the "Load Log" action to load an **entire session** (Comms, MMA Agent logs, and Tool Execution logs) instead of just the Comms log.
### 2. Session Replay Mode
- When a previous session is loaded, the UI should enter a "Historical/Replay" mode:
- Apply a visual tint to the UI to clearly distinguish it from an active session.
- Populate all respective panels (Discussion, MMA Dashboard, Operation Logs) with the data from the loaded session logs as if they were live.
- Fix the existing broken implementation for loading and parsing historical comms logs.
### 3. Log Storage Optimization
- **Script Offloading:** AI-generated PowerShell scripts must be saved into the session's directory with a unique identifier naming scheme.
- **Output Offloading:** Output from tool executions (e.g., shell command results) must be saved to separate files within the session directory.
- **ID Referencing:** Log entries in the `.jsonl` files should reference these external files by their filenames instead of embedding the full content.
### 4. MMA Agent Log Integration
- Ensure MMA sub-agent communications are correctly captured and filterable within the main Comms Log view.
- Utilize existing filter criteria (e.g., role, status) to manage the display of these logs.
### 5. Diagnostic Log Rework
- Remove system performance warnings and transient notifications from the **Discussion History**.
- Relocate these warnings to a new **Diagnostic Tab** within the Log Management panel.
- **Transient Diagnostics:** Diagnostic logs should not be restored or re-populated during session history loads; they are relevant only to the active runtime environment.
## Non-Functional Requirements
- **Efficiency:** Significantly reduce the size of individual log files by offloading large content strings.
- **Maintainability:** Decouple log visualization from the main execution logic to ensure robust session replay.
## Acceptance Criteria
- [ ] The "Load Log" button is successfully relocated and initiates a full session restoration.
- [ ] Loaded sessions correctly tint the UI and populate historical data into their original panels.
- [ ] Comms logs contain filename references for scripts and outputs rather than the raw text.
- [ ] Discussion history remains clear of performance-related system messages.
- [ ] MMA sub-agent logs are visible and correctly filtered in the Comms view.
- [ ] The new Diagnostic Tab correctly displays real-time system warnings.
## Out of Scope
- Real-time "playback" (animating the session as it happened); only static restoration is required.
- Editing or modifying historical session logs.
- Exporting sessions to formats other than the native log structure.