Skip to content

Show a link to debug.log in the agentic UI when the file exists - #4761

Merged
wojtekn merged 7 commits into
trunkfrom
stu-2404-show-link-to-debuglog-when-it-exists-in-the-agentic-ui
Sep 3, 2026
Merged

Show a link to debug.log in the agentic UI when the file exists#4761
wojtekn merged 7 commits into
trunkfrom
stu-2404-show-link-to-debuglog-when-it-exists-in-the-agentic-ui

Conversation

@wojtekn

@wojtekn wojtekn commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code wrote the implementation and tests, and drove the browser verification below. I reviewed the diff, directed the button styling and other improvements.

Proposed Changes

Studio Classic offers an Open log file link in site Settings once a site has actually written a wp-content/debug.log. The agentic UI had the Enable debug log toggle but no way to get to the file it produces, so you had to go find it in the site folder yourself. This ports that shortcut, as a button under the toggle, matching the mockup on the issue.

CleanShot 2026-09-03 at 12 16 04@2x

Testing Instructions

Browser UI:

npm run cli:build:ui && node apps/cli/dist/cli/main.mjs ui --no-open

Then at http://localhost:8081 → a site → Settings → Debugging. Repeat the same steps on the desktop app (npm start) — both front ends are in scope.

  1. On a site with no wp-content/debug.log, there's no button.
  2. On a site that has one, Open log file appears below the toggle's description; the description itself is still there.
  3. Click it — the log opens in the OS default app (TextEdit/Notepad), not your configured editor.
  4. rm wp-content/debug.log, then navigate to another site and back — the button is gone. Restore the file and it returns.
  5. Check both light and dark mode.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@wpmobilebot

wpmobilebot commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 40d892e vs trunk

app-size

Metric trunk 40d892e Diff Change
App Size (Mac) 1425.96 MB 1425.96 MB 0.00 MB ⚪ 0.0%

site-editor

Metric trunk 40d892e Diff Change
load 1188 ms 1305 ms +117 ms 🔴 9.8%

site-startup

Metric trunk 40d892e Diff Change
siteCreation 7517 ms 7548 ms +31 ms ⚪ 0.0%
siteStartup 3371 ms 3369 ms 2 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@youknowriad

Copy link
Copy Markdown
Contributor

Tested in the browser UI, works as described, and the code is clean: both connectors covered, good wire-contract tests. 👍

One edge case worth a look: when the user unchecks the toggle and saves, the query is disabled but React Query keeps the cached true, so the Open log file button stays visible until a reload.

Minor nits, take or leave:

  • Classic still hardcodes 'wp-content/debug.log' in content-tab-settings.tsx — could use the new DEBUG_LOG_RELATIVE_PATH since that's what it's for.
  • Other "open" actions fire a Tracks event; this one doesn't. Fine to skip if we don't need the data.

A few things maybe worth cutting/removing from the PR to keep things lean:

  • The enabled param on useDebugLogExists, removing this also fixes the stale-button bug above. Always run the check when openInOS is true.
  • The 4 IPC connector tests feels unnecessary to. me.
  • Hosted connector's siteDebugLogExists could throw UnsupportedError like the other similar functions.
  • One of the two "404s for an unknown site" route tests (they check the same thing).

@wojtekn

wojtekn commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@youknowriad thanks for review.

I fixed the query so it depends only on whether the file exists - this also means the button now shows for sites that have a debug.log but logging turned off, what is consistent with classic UI.

I also applied a few proposed cleanup and quality things.

@wojtekn
wojtekn merged commit 01806ad into trunk Sep 3, 2026
13 checks passed
@wojtekn
wojtekn deleted the stu-2404-show-link-to-debuglog-when-it-exists-in-the-agentic-ui branch September 3, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants