Agency Guide
Client Debug Reporter
Pinned debug icon for client and admin sessions — submit bug reports with screenshots
Overview
The client debug reporter is the pinned bottom-right bug icon in the admin and client portal shells. It is off by default and can be enabled per-environment.
Environment Setup
On the API service:
GITHUB_ISSUE_TOKEN=github_pat_with_issues_write
CLIENT_DEBUG_REPORTER_ENABLED=true
# Optional when REDIRECT_URL is not the public API origin used by GitHub.
CLIENT_DEBUG_PUBLIC_API_URL=https://api.v2.affinitydesign.ca
CLIENT_DEBUG_SCREENSHOT_TTL_DAYS=90
On the web service:
NEXT_PUBLIC_CLIENT_DEBUG_TOOL=true
Restart or redeploy both services after changing the values.
Runtime Behavior
- Authenticated admin, user, and client sessions can submit reports to
POST /debug/client-report. - Browser errors and unhandled promise rejections open the reporter automatically. Recoverable render errors that React's own error boundary already recovered from (error #185 "Maximum update depth exceeded" and the boundary-recovery log) are still captured in the console log buffer and increment the badge, but no longer auto-open the panel.
- Manual reports can be submitted from the pinned bug icon.
- Reports include the note, current page, viewport, user agent, recent clicks and navigation events, recent console warnings/errors, and a compressed page screenshot.
- Screenshots are stored in MongoDB with a random token and linked into the GitHub issue as a normal HTTPS image URL. GitHub does not render inline
data:image/...URLs in issue bodies. - Sensitive values such as bearer tokens, JWTs, API keys, passwords, secrets, and email addresses are redacted before the issue is created.
- The GitHub issue is labelled
auto-reported,client-reported, andclient-debug, so the existing Copilot auto-fix workflow can pick it up. - The reporter tries to create the required labels automatically. If GitHub rejects label creation, create
bug,auto-reported,client-reported, andclient-debugmanually in the repository labels page.
Agent Assignment
The issue creation token and the Copilot assignment token are separate:
GITHUB_ISSUE_TOKENlives on the API service and only creates issues.COPILOT_AGENT_TOKENlives in GitHub repository secrets and lets the workflow assign Copilot cloud agent.
See Self-Healing Agent Loop for the full loop setup.
Validation Checklist
- Confirm the API has
GITHUB_ISSUE_TOKENandCLIENT_DEBUG_REPORTER_ENABLED=true. - Confirm the web bundle was built with
NEXT_PUBLIC_CLIENT_DEBUG_TOOL=true. - Sign in to the portal or admin app.
- Click the bottom-right bug icon, add a short note, and submit.
- Confirm a new issue appears in
Affinity-Design/af-gemini-connectwith theclient-debuglabel. - Confirm the screenshot section renders an image and the
Open screenshotlink points at the public API host.
