fix(portal): Clear button clears the server-side activity log#11
Open
sthomas69 wants to merge 1 commit into
Open
fix(portal): Clear button clears the server-side activity log#11sthomas69 wants to merge 1 commit into
sthomas69 wants to merge 1 commit into
Conversation
The dashboard "Clear" button only emptied the browser DOM. On the next poll the client re-fetched the retained server-side entries, so the activity log immediately reappeared and the Clear never "stuck". - Add a `DELETE /api/log` route that calls `activity_log.clear()`. - Make `clearLog()` issue that DELETE before clearing the DOM / resetting the lastLogTs cursor. This mirrors the fix already running on the bench (the deployed portal), so the behaviour is confirmed: after Clear, the log empties and stays empty across subsequent polls. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR makes the dashboard “Clear” action persist by clearing the server-side activity log, preventing the next polling cycle from re-hydrating previously retained log entries.
Changes:
- Adds a
DELETE /api/logendpoint that clears the server-sideactivity_log. - Updates the UI
clearLog()handler to call the new endpoint before clearing the DOM/resetting the client-side cursor.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1736
to
+1741
| elif path == "/api/log": | ||
| # The dashboard "Clear" button only emptied the browser DOM; the next | ||
| # poll re-fetched the retained entries so the activity log reappeared. | ||
| # Clear the server-side log so the Clear actually sticks. | ||
| activity_log.clear() | ||
| self._send_json({"ok": True}) |
Comment on lines
+3625
to
3631
| async function clearLog() { | ||
| // Clear the server-side log first, else the next poll re-fetches the retained | ||
| // entries (resetting lastLogTs alone pulls the whole log back). | ||
| try { await fetch('/api/log', { method: 'DELETE' }); } catch (e) { /* ignore */ } | ||
| document.getElementById('log-entries').innerHTML = ''; | ||
| lastLogTs = ''; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Activity Log Clear button only emptied the browser DOM. On the next poll the client re-fetched the retained server-side entries, so the activity log immediately reappeared — the Clear never "stuck".
Fix
DELETE /api/logroute that callsactivity_log.clear().clearLog()issue that DELETE before clearing the DOM and resetting thelastLogTscursor.Two small hunks in
pi/portal.py;python -m py_compile pi/portal.pyis clean.Verification
This mirrors the fix already running on my bench portal: after clicking Clear, the log empties and stays empty across subsequent polls.