Spaces:
Running
Running
Link the demo's trace to exact lines of code
#2
by lewtun HF Staff - opened
What
Exact-line links in the demo's trace, instead of whole files:
- Reply text: "the reply's text is in knowledge/science.py, line 2,911" links to that line (the gravity answer; the same line the video shows).
- Winning module: its name links to its own
respond()inbot/modules/<name>.py(e.g.answers.py#L8331-L8577). - File map: clicking a highlighted file opens the reply's line, the winner's
respond(), or the first function the winner ran in that file. The hover text says which.
Why
Lewis asked whether the demo could point at the code that ran, not just the file (option 1 of the three discussed on the board).
How
pybot_web.py: the existingsys.monitoringtrace now also records each function's line range. It unwraps the bot's decorators to find each handler's ownrespond(): 97 of 97 found. The reply-text match becomes a line number.build/build_bundle.py: the bundle gainslines.json(letters/digits per line), +0.6 MB (22.2 MB). It's renamedpybot-24cbc0439e07-c4076a39.zipso browsers fetch it instead of a cached copy. Same bot:bot/at24cbc04, from huggingface/pybot.tree.json:refis the commit7d63c7finstead ofmain, so line links don't drift whenmainchanges.index.html: only the explanation line's two names become underlined links, plus the hover text. Layout, fonts and colours are unchanged.
Testing
- 40 recorded conversations from the leaderboard's
24cbc04run replay byte-identically in the new bundle. - In headless Chromium: the gravity, joke and tea replies link to the lines holding their text (checked against the source at
7d63c7f), with no page errors. tree.jsonmatches the GitHub files at7d63c7f(528 files, same line counts).
๐ค Generated with Claude Code
lewtun changed pull request status to open
lewtun changed pull request status to merged