fix(tracing): reuse the dashboard port only when it is our own viewer#141
Merged
Conversation
`raven tracing` treated any listener on the dashboard port as a running
viewer and pointed the browser at it. A stale viewer from an older layout
(or an unrelated server) holding the port answered every request with 404,
so /tracing opened a "Not found" page. Probe /api/health before reusing:
reuse only when it returns {"ok": true}, otherwise start on the next free
port. Readiness now waits on health rather than a bare TCP connect.
Co-authored-by: Claude (claude-opus-4-8) <noreply@anthropic.com>
0xKT
approved these changes
Jul 17, 2026
12 tasks
cyfyifanchen
added a commit
that referenced
this pull request
Jul 19, 2026
## Summary Bump Raven package metadata from 0.1.5 to 0.1.6 so the release tag can build a wheel from the current main branch. This release carries the changes merged after v0.1.5: - Version display now derives from installed package metadata (#139). - Tracing dashboard port reuse avoids taking over non-Raven viewers (#141). - CLI startup defers LiteLLM imports for faster cold start (#147). - Self-evolution stack and AppWorld benchmark entry points are included (#140). - TUI render delay is reduced by deferring provider and memory loading (#157). ## Type - [ ] Fix - [ ] Feature - [ ] Docs - [ ] CI / tooling - [ ] Refactor - [x] Other ## Verification - [x] Relevant tests pass locally - [x] Relevant lint / type checks pass locally - [ ] User-facing docs or screenshots are updated when needed Commands run: - `PYTHONPATH=. uv run pytest tests/test_cli_smoke.py::test_version_flag_matches_installed_metadata -q` - `make check-commits COMMIT_RANGE=origin/main..HEAD` - `PYTHONPATH=. uv run python scripts/check_commit_file.py /tmp/raven-commit-msg.txt` No user-facing docs or screenshots were needed for this version metadata bump; release notes will be published with the GitHub Release. ## Risk - [x] Security impact considered - [x] Backward compatibility considered - [x] Rollback path is clear for risky changes This changes package metadata only. Rollback is to delete the v0.1.6 tag/release if publication fails before users upgrade, or publish a follow-up patch release if a released package issue is found. ## Related Issues N/A
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.
Summary
Harden
raven tracingso it never opens the browser onto a "Not found" page.The launcher treated any listener on the dashboard port as its own running
viewer:
_open_dashboardonly checked whether the TCP port was live, thenpointed the browser at it. A stale viewer from an older on-disk layout (its
index.htmlwas later replaced by an inlinedshell.js) -- or an unrelatedserver -- holding that port answered every request with
404 Not found, so/tracingopened a broken page.Fix: probe
GET /api/healthbefore reusing a live port.{"ok": true}(our viewer's signature; aforeign or stale server does not).
instead of clashing (or error clearly if none is free nearby).
/api/healthsucceeding rather than a bare TCPconnect, so we only open the browser once the viewer actually serves.
Type
Verification
Commands run:
uv run pytest tests/test_cli_tracing_commands.py -q-> 4 passed(health false when nothing listening / false for a foreign 404 server / true
for our viewer / free-port scan skips an occupied port).
uv run ruff check raven/cli/tracing_commands.py tests/test_cli_tracing_commands.py-> clean.4318 and returned
404 Not foundfor/; with this change the launcherdetects it is not our viewer and moves to a free port.
Risk
Backward-compatible: same behavior when the port is free or already hosts our
viewer; only the "foreign process on the port" case changes (previously a broken
page, now a working viewer on another port). No API or schema change.
Related Issues
N/A -- follow-up hardening on the tracing viewer merged in #135.