feat(debug): include desktop.log in hermes debug share / /debug / hermes logs (#38203)
The Electron desktop app writes boot failures, backend spawn output, and Python tracebacks to HERMES_HOME/logs/desktop.log, but debug-share only captured agent/errors/gateway — so desktop boot issues never made it into shared debug reports. - logs.py: register desktop -> desktop.log (enables 'hermes logs desktop') - debug.py: capture desktop snapshot, add to summary report, upload full desktop.log in 'share', update privacy notice - gateway /debug inherits the desktop tail via collect_debug_report() - main.py + docs: help text and log-name table (also adds missing gui row) - tests: desktop seed in fixture, new report test, three_pastes -> four_pastes
This commit is contained in:
@@ -31,6 +31,9 @@ def hermes_home(tmp_path, monkeypatch):
|
||||
(logs_dir / "gateway.log").write_text(
|
||||
"2026-04-12 17:00:10 INFO gateway.run: started\n"
|
||||
)
|
||||
(logs_dir / "desktop.log").write_text(
|
||||
"2026-04-12 17:00:15 INFO desktop: backend spawned\n"
|
||||
)
|
||||
|
||||
return home
|
||||
|
||||
@@ -451,6 +454,15 @@ class TestCollectDebugReport:
|
||||
|
||||
assert "--- gateway.log" in report
|
||||
|
||||
def test_report_includes_desktop_log(self, hermes_home):
|
||||
from hermes_cli.debug import collect_debug_report
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"):
|
||||
report = collect_debug_report(log_lines=50)
|
||||
|
||||
assert "--- desktop.log" in report
|
||||
assert "backend spawned" in report
|
||||
|
||||
def test_missing_logs_handled(self, tmp_path, monkeypatch):
|
||||
home = tmp_path / ".hermes"
|
||||
home.mkdir()
|
||||
@@ -526,8 +538,8 @@ class TestRunDebugShare:
|
||||
assert "FULL agent.log" in out
|
||||
assert "FULL gateway.log" in out
|
||||
|
||||
def test_share_uploads_three_pastes(self, hermes_home, capsys):
|
||||
"""Successful share uploads report + agent.log + gateway.log."""
|
||||
def test_share_uploads_four_pastes(self, hermes_home, capsys):
|
||||
"""Successful share uploads report + agent.log + gateway.log + desktop.log."""
|
||||
from hermes_cli.debug import run_debug_share
|
||||
|
||||
args = MagicMock()
|
||||
@@ -549,14 +561,16 @@ class TestRunDebugShare:
|
||||
run_debug_share(args)
|
||||
|
||||
out = capsys.readouterr().out
|
||||
# Should have 3 uploads: report, agent.log, gateway.log
|
||||
assert call_count[0] == 3
|
||||
# Should have 4 uploads: report, agent.log, gateway.log, desktop.log
|
||||
assert call_count[0] == 4
|
||||
assert "paste.rs/paste1" in out # Report
|
||||
assert "paste.rs/paste2" in out # agent.log
|
||||
assert "paste.rs/paste3" in out # gateway.log
|
||||
assert "paste.rs/paste4" in out # desktop.log
|
||||
assert "Report" in out
|
||||
assert "agent.log" in out
|
||||
assert "gateway.log" in out
|
||||
assert "desktop.log" in out
|
||||
|
||||
# Each log paste should start with the dump header
|
||||
agent_paste = uploaded_content[1]
|
||||
@@ -565,6 +579,9 @@ class TestRunDebugShare:
|
||||
gateway_paste = uploaded_content[2]
|
||||
assert "--- hermes dump ---" in gateway_paste
|
||||
assert "--- full gateway.log ---" in gateway_paste
|
||||
desktop_paste = uploaded_content[3]
|
||||
assert "--- hermes dump ---" in desktop_paste
|
||||
assert "--- full desktop.log ---" in desktop_paste
|
||||
|
||||
def test_share_keeps_report_and_full_log_on_same_snapshot(self, hermes_home, capsys):
|
||||
"""A mid-run rotation must not make full agent.log older than the report."""
|
||||
|
||||
Reference in New Issue
Block a user