fix(docs): rewrite env README relative links in generated stubs - #1101
fix(docs): rewrite env README relative links in generated stubs#1101Cunninger wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
The current five generated stubs are corrected, but the new general-purpose link rewriter has three confirmed input-handling defects that should be covered before merge:
- A whitespace-only href such as
[text]( )reachesurl.split()[0]and raisesIndexError. - Relative Markdown links inside fenced code blocks are rewritten, silently changing code examples.
- Optional Markdown link titles are discarded (
[text](path "title")loses"title").
Please make the rewriter code-span/fence aware, handle empty tokenization safely, preserve title suffixes, and add focused regressions. The pre-existing OpenCode README link that resolves to missing DOCS/HF/hf_inference_providers_logprobs.md should also be corrected or explicitly tracked, but it is separate from the parser blockers.
The branch is behind but merge-tree clean. Standard CI never ran (action_required), so after the fixes it also needs a current-main refresh and exact-head Tests/Package CI/docs checks.
Sent by Cursor Automation: Release


Fixes #1095
scripts/sync_env_docs.pyinlined each env README intodocs/source/environments/<slug>.mdbut only rewrote HTMLsrc="assets/"image paths. Markdown links such as[example](../../examples/foo.py)stayed relative, so they resolved from the docs stub (wrong depth) on the published site.This extends stub generation to rewrite markdown links that escape
envs/<env>/into GitHub blob/tree URLs (the conventionbrowsergym/pelican_svgalready use by hand). Extra../segments that walk out of the repo (e.g.git_env's../../../examples/...) are stripped so they still map to the intended path.--checkalready treats rewritten stubs as the expected content, so leftover relative links fail CI until--fixis run. Regenerated the currently affected stubs (agent_world_model,carla,git,opencode,repl).Tests:
9 passed;
--checkis clean.RFC: not required (docs generator only, no public API / core change).
Note
Low Risk
Docs sync tooling and generated markdown only; no runtime API or environment behavior changes.
Overview
Fixes broken example and RFC links on the published docs site when env READMEs are inlined into
docs/source/environments/*.md(issue #1095). Previously only HTMLassets/image paths were absolutized; markdown links like../../examples/foo.pystayed relative and resolved from the wrong path.scripts/sync_env_docs.pynow rewrites markdown links that point outsideenvs/<env>/into GitHubblob/treeURLs (andrawfor images), including normalizing over-long../chains (e.g.git_env’s../../../examples/...). Stub generation calls this duringgenerate_stub, so--checkin CI expects the rewritten output.Regenerated affected stubs (agent_world_model, carla, git, opencode, repl) and added
tests/scripts/test_sync_env_docs.pyfor path resolution, link rewriting, and integration viagenerate_stub.Reviewed by Cursor Bugbot for commit 99e46a9. Bugbot is set up for automated code reviews on this repo. Configure here.