Add "Copy for LLM" button for error occurrences - #1
Merged
Conversation
Adds `GET /errors/:error_id/occurrences/:id.md`, which renders a single occurrence as an LLM-ready prompt: the fault in XML-ish tags (class, message, backtrace, source context for application frames, request context) plus instructions to investigate and fix it. Served as text/plain so browsers display it inline rather than downloading it, and rendered through the `text` format so ActionView's ERB handler skips HTML escaping. The buttons are anchors, not buttons: the click handler only calls preventDefault when it can actually reach the clipboard, so non-secure origins, JS failures, and cmd-click all fall through to the readable page. One appears in the error action bar (newest occurrence) and one in each occurrence's summary. Mounts the engine in the dummy app so request tests are possible. Co-Authored-By: Bruno Valentino <brunovalentino@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
rickychilcott
force-pushed
the
copy-for-llm
branch
from
July 31, 2026 14:46
5b47cc6 to
d26439f
Compare
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.
A rework of upstream fractaledmind/solid_errors#97 by @bvalentino. Same idea — one click gets you an error in a form you can paste into an LLM — different plumbing.
What changed vs. fractaledmind#97
A real URL instead of an inline
<template>.GET /errors/:error_id/occurrences/:id.mdrenders the prompt. fractaledmind#97 embedded the whole document in every error page, which meant a secondBacktrace.parseplus aFile.openper application frame on every page view whether or not anyone clicked. Now that work only happens when someone asks for it, and you cancurlthe URL or paste it to a coworker.A view, not a model method. fractaledmind#97 added
Error#to_markdown, 35 lines ofmd << "...". This usesapp/views/solid_errors/occurrences/show.text.erb, so the formatting sits next to the HTML formatting it mirrors and the model is untouched.XML-ish tags and instructions, matching the shape Honeybadger emits. Delimited blocks also dodge a real escaping problem: an exception message containing
##or a source snippet containing triple-backticks corrupts a heading-based markdown document, and solid_errors stores raw exception messages.Per-occurrence, not "the latest one". A button in each occurrence's summary copies that failure; the action-bar button copies the newest.
Degrades instead of dying. fractaledmind#97's
.catchnever fires — on a non-secure originnavigator.clipboardisundefined, sonavigator.clipboard.writeTextthrows aTypeErrorsynchronously and the button silently does nothing. Plenty of people reach a mounted engine dashboard over plain HTTP. Here the buttons are anchors and the handler only callspreventDefault()when it can actually reach the clipboard, so a non-secure origin, a JS failure, or a cmd-click all fall through to the readable page.Notes
text/plain, nottext/markdown— browsers have no renderer fortext/markdownand download the file instead of showing it, which would break both the navigable URL and the fallback. GitHub serves raw.mdthe same way.textformat also means ActionView's ERB handler skips HTML escaping, so backtraces and messages survive verbatim.Sample output
Testing
test/integration/solid_errors/markdown_test.rbcovers the route, content type, unescaped output, the 404 on a mismatched error/occurrence pair, and the links on the error page. Full suite: 8 runs, 34 assertions, 0 failures.🤖 Generated with Claude Code