Skip to content

Carry forward seam doctor follow-up fixes#4171

Merged
justin808 merged 6 commits into
mainfrom
jg-codex/4121-seam-doctor-followup
Jun 22, 2026
Merged

Carry forward seam doctor follow-up fixes#4171
justin808 merged 6 commits into
mainfrom
jg-codex/4121-seam-doctor-followup

Conversation

@justin808

@justin808 justin808 commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

  • carry forward the post-merge Share agent workflows via installed skills + repo seam #4121 seam-doctor/adoption fixes that landed on the closed branch after Share agent workflows via installed skills + repo seam #4121 was squash-merged at 68db6f1
  • teach agent-workflow-seam-doctor to scan 3+ backtick/tilde executable fences, reject too-short closers, accept same-character closers at least as long as the opener, reject info strings on closing fences, handle CRLF closers, and parse spaced info-string languages
  • clarify user-installed shared skill adoption: install workflows/ with skills/, or keep repo-local workflow copies/launchers for skills that reference .agents/workflows/...
  • document the shared-pack status/upgrade path for Codex and Claude installs
  • keep the React on Rails compatibility copy aligned with shakacode/agent-workflows@d38645b

Rationale

#4121 created and referenced the public shared workflow repo, but two late P2 review findings arrived after the merged head. The shared repo already contains the fixes; this PR keeps the React on Rails compatibility copy and adoption docs in sync with the published pack. Current-head review on this follow-up also tightened the CommonMark closing-fence behavior, now fixed here and in the shared repo.

The shared pack now also includes host-aware install/status/upgrade helpers inspired by the gstack upgrade flow: explicit status tokens, Codex/Claude host targets, network disclosure, rollback if a consumer seam validation fails, and preservation of unrelated user-installed agent files.

Original #4121 review threads:

Changelog

Not user-visible; agent workflow docs/tooling only.

Validation

  • ruby .agents/bin/agent-workflow-seam-doctor-test.rb -> 39 runs, 98 assertions, 0 failures
  • .agents/bin/agent-workflow-seam-doctor --shared /Users/justin/codex/agent-workflows -> PASS
  • (cd /Users/justin/codex/agent-workflows && bin/validate) -> PASS at d38645b
  • git diff --check in both react_on_rails and agent-workflows -> clean
  • bin/ci-local --changed -> docs-only, Docs Sidebar Check passed, no further CI needed
  • pre-commit hook -> trailing newlines, offline markdown links, Prettier passed
  • pre-push hook -> branch RuboCop no offenses; online markdown links 29 OK

Note

Low Risk
Changes are limited to agent workflow tooling and internal documentation; no application runtime, auth, or user-facing product code paths are modified.

Overview
Syncs the repo’s agent-workflow compatibility copy with post-#4121 fixes from shakacode/agent-workflows, focused on seam validation and adoption docs.

agent-workflow-seam-doctor now parses Markdown code fences closer to CommonMark: 3+ backtick/tilde openers, closers must match character and be at least as long as the opener (shorter closers stay inside the fence), closing lines with info strings do not close a fence, CRLF closers work via chomp, and spaced info strings (e.g. ``` bash) still mark executable fences. A large new test suite covers long fences, mismatched delimiters, and non-executable fenced content.

Docs/skills broaden “Codex batch” wording to agent / Codex / Claude batches in AGENTS.md, pr-batch, and contributor guides. Adoption and design docs add agent-workflows-status and upgrade-agent-workflows for Codex and Claude hosts, stress installing workflows/ alongside skills/, and link the shared pack’s installation/upgrade guide.

Reviewed by Cursor Bugbot for commit 924b4eb. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The fence-detection regex in agent-workflow-seam-doctor is broadened from exact ``` / ~~~ patterns to accept three-or-more backticks or tildes. A new closing_fence_delimiter? helper compares delimiter characters and lengths to allow flexible fence closure. Three new test classes cover long-delimiter fences, delimiter-length mismatches, and content-scanning edge cases. The adoption guide's Step 4 wording is refined to clarify workflow reference reachability and installation requirements.

Changes

Fence Regex and Delimiter Logic

Layer / File(s) Summary
Fence delimiter logic update
.agents/bin/agent-workflow-seam-doctor
update_fence_state regex is changed from matching exactly ``` or ~~~ to matching 3+ backtick or tilde characters, extracting the full delimiter string and optional language token. A new closing_fence_delimiter? helper is introduced to determine fence closure by checking that the closer starts with the same delimiter character and has length ≥ the opener.
Fence behavior tests
.agents/bin/agent-workflow-seam-doctor-test.rb
New AgentWorkflowSeamDoctorFenceTest, AgentWorkflowSeamDoctorFenceLengthTest, and AgentWorkflowSeamDoctorFenceContentTest test classes verify that placeholders inside long-delimiter executable fences remain unresolved, shorter closing delimiters do not prematurely close longer opening fences, longer closing delimiters correctly close fences, closing fences with info strings remain inside the executable fence scope, CRLF-terminated fences close correctly, and spaced info strings behave as expected on both executable and non-executable fences.

Adoption Guide Update

Layer / File(s) Summary
Step 4 adoption guidance revision
internal/contributor-info/agent-workflow-adoption.md
Step 4 is reworded to add "workflow references reachable" framing, clarify that shared workflow text should not be copied unless installed skills cannot be loaded, ensure workflows/ is installed in installed-skill-only setups, and retain local workflow copies or launchers when skills reference .agents/workflows/....

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

documentation, enhancement, P2, codex

Suggested reviewers

  • alexeyr-ci2
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly relates to the main changes: seam doctor follow-up fixes aligned with published changes from PR #4121, which is the primary objective of this pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg-codex/4121-seam-doctor-followup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR carries forward two post-merge fixes from the agent-workflows shared pack into the React on Rails compatibility copy, keeping it aligned with shakacode/agent-workflows@9a11f7b. The changes are confined to agent workflow tooling and docs with no user-visible impact.

  • Regex fix in agent-workflow-seam-doctor: the fence-detection pattern now matches 3-or-more backtick/tilde delimiters ({3,}) instead of exactly 3, so 4-backtick or longer fences in skill Markdown are properly tracked; the existing exact-delimiter matching logic naturally enforces that a shorter closer cannot prematurely end a longer fence.
  • Test refactor + new tests: fence-specific tests are extracted into a dedicated AgentWorkflowSeamDoctorFenceTest class and two new regression tests cover the long-fence and shorter-closer edge cases.
  • Doc update in agent-workflow-adoption.md: step 4 now explicitly warns against an skills/-only install; adopters must also install workflows/ (or keep local copies) for skills that reference .agents/workflows/....

Confidence Score: 5/5

Safe to merge; all changes are confined to agent workflow tooling and documentation with no effect on the React on Rails application itself.

The regex change is a well-scoped one-liner with direct regression coverage via two new tests. The test class refactor is structurally clean — class boundaries verified, the new class correctly includes the test helpers, and no methods are orphaned. The doc addition is accurate and addresses a real gap in adoption guidance.

No files require special attention.

Important Files Changed

Filename Overview
.agents/bin/agent-workflow-seam-doctor Regex updated to match 3+ backtick/tilde fences instead of exactly 3; the existing exact-delimiter comparison logic correctly enforces matching closers for all fence lengths.
.agents/bin/agent-workflow-seam-doctor-test.rb Fence-specific tests extracted into a new AgentWorkflowSeamDoctorFenceTest class; two new regression tests cover 4-backtick fences and shorter-closer semantics; no orphaned methods, class boundaries verified.
internal/contributor-info/agent-workflow-adoption.md Step 4 clarified to require installing workflows/ alongside skills/ or keeping local copies for skills that reference .agents/workflows/...

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Line from skill Markdown] --> B{update_fence_state\nmatches 3+ backticks or tildes?}
    B -- no match --> C[Not a fence delimiter]
    B -- match --> D{Currently inside a fence?}
    D -- yes --> E{delimiter equals fence_delimiter?}
    E -- no --> F[Mismatched closer - stay inside fence]
    E -- yes --> G[Close fence]
    D -- no --> H[Open new fence, record delimiter]
    H --> I{Language tag executable?}
    I -- yes --> J[executable_fence = true\nScan lines for placeholders]
    I -- no --> K[executable_fence = false\nPlaceholders allowed]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Line from skill Markdown] --> B{update_fence_state\nmatches 3+ backticks or tildes?}
    B -- no match --> C[Not a fence delimiter]
    B -- match --> D{Currently inside a fence?}
    D -- yes --> E{delimiter equals fence_delimiter?}
    E -- no --> F[Mismatched closer - stay inside fence]
    E -- yes --> G[Close fence]
    D -- no --> H[Open new fence, record delimiter]
    H --> I{Language tag executable?}
    I -- yes --> J[executable_fence = true\nScan lines for placeholders]
    I -- no --> K[executable_fence = false\nPlaceholders allowed]
Loading

Reviews (1): Last reviewed commit: "Support long Markdown fences in seam doc..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba955940d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .agents/bin/agent-workflow-seam-doctor Outdated
Comment thread .agents/bin/agent-workflow-seam-doctor Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.agents/bin/agent-workflow-seam-doctor-test.rb (1)

319-352: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Consider adding test coverage for longer closing fences.

The test suite now covers:

  • Mismatched delimiter types (``` vs ~~~)
  • Shorter closing fences not closing longer opening fences

However, there's no test for the case where a longer closing fence should (or shouldn't) close a shorter opening fence. For example:

```bash
<follow-up prefix>

Per CommonMark, the ````` should close the fence, but the current implementation at line 214 of `agent-workflow-seam-doctor` requires an exact match. Adding this test case would help document whether the tool intentionally deviates from CommonMark or if this is an edge case to address.





<details>
<summary>📝 Suggested test case</summary>

```ruby
def test_longer_closing_fence_closes_shorter_opening_fence
  with_repo do |root|
    write_agents(root)
    write_skill(root, <<~MARKDOWN)
      ```bash
      gh issue create --title "safe command"
      `````
      <follow-up prefix>
    MARKDOWN

    out, status = run_doctor(root)

    # If longer fences should close per CommonMark: expect success
    # If exact match is intentional: expect failure and update comment
    assert status.success?, "longer closing fence should close shorter opening fence"
  end
end
```

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.agents/bin/agent-workflow-seam-doctor-test.rb around lines 319 - 352, Add
missing test coverage for the edge case where a longer closing fence encounters
a shorter opening fence. Create a new test method called
test_longer_closing_fence_closes_shorter_opening_fence that writes a skill with
a three-backtick opening fence for bash and a five-backtick closing fence, then
runs the doctor and asserts the appropriate behavior (either success if longer
fences should close per CommonMark, or failure if the implementation requires
exact fence matching). This will document whether the tool intentionally
deviates from CommonMark specification or if this is an edge case needing
attention.
```

</details>

<!-- cr-comment:v1:adab66c089c71f50dd8559af -->

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

```
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.agents/bin/agent-workflow-seam-doctor-test.rb:
- Around line 319-352: Add missing test coverage for the edge case where a
longer closing fence encounters a shorter opening fence. Create a new test
method called test_longer_closing_fence_closes_shorter_opening_fence that writes
a skill with a three-backtick opening fence for bash and a five-backtick closing
fence, then runs the doctor and asserts the appropriate behavior (either success
if longer fences should close per CommonMark, or failure if the implementation
requires exact fence matching). This will document whether the tool
intentionally deviates from CommonMark specification or if this is an edge case
needing attention.
```

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: Organization UI

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `7a38a02b-3dca-46e2-b375-11fefe296a7d`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between d92d92c1b8e105e7dc8e22c61680936e1e8c371a and ba955940d86886bc850083f562c3598e08ae21b3.

</details>

<details>
<summary>📒 Files selected for processing (3)</summary>

* `.agents/bin/agent-workflow-seam-doctor`
* `.agents/bin/agent-workflow-seam-doctor-test.rb`
* `internal/contributor-info/agent-workflow-adoption.md`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@claude

claude Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Code review complete - see inline comment at line 209. Summary: The regex change correctly extends fence detection to 3+ backtick/tilde sequences per CommonMark spec. Test class reorganization is clean, and the two new tests cover the important cases. Docs update adds the missing nuance about workflow references. One spec gap: the closing-fence comparison uses exact string equality, so a longer closer (5 backticks closing a 4-backtick opener) is not recognized as a valid closer per CommonMark 4.5. Negligible in practice for skill files. Overall verdict: approve.

@justin808 justin808 force-pushed the jg-codex/4121-seam-doctor-followup branch from 222a282 to 86e331b Compare June 22, 2026 04:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86e331bb8b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .agents/bin/agent-workflow-seam-doctor Outdated
@claude

claude Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Code Review

Summary: Follow-up to #4121 — teaches the seam doctor CommonMark-compliant code fence parsing (3+ backtick/tilde openers, same-character closers at least as long as the opener) and clarifies shared-workflow adoption docs. Low risk, agent-tooling only.

Implementation: The regex change to {3,} quantifiers plus the new closing_fence_delimiter? helper correctly implement the CommonMark rule: the closing fence must use the same character as the opener and be at least as long. delimiter[0] is safe — the regex guarantees at least 3 characters for both opener and closer.

Tests: Splitting into AgentWorkflowSeamDoctorFenceTest is a good organisational improvement. The three new cases cover: 4-backtick fence detected as executable; 3-backtick closer failing to close a 4-backtick opener; and a 5-backtick closer correctly ending a 4-backtick opener. Minor gap: no symmetric tilde test for the length rule (e.g. four tildes closing a three-tilde opener). The code handles it correctly via the same closing_fence_delimiter? path — a mirror tilde test would complete the suite but is not a blocker.

Documentation: The added sentence in step 4 fills a real gap: installing only skills/ without workflows/ leaves .agents/workflows/... references broken at runtime. The heading tweak accurately previews the expanded guidance.

Verdict: Approve. The CommonMark fence fix is correct, test coverage of the new behaviour is solid, and the doc update addresses a concrete adoption pitfall.

Comment thread .agents/bin/agent-workflow-seam-doctor-test.rb

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e67784bbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .agents/bin/agent-workflow-seam-doctor
Comment thread .agents/bin/agent-workflow-seam-doctor Outdated
@claude

claude Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Code Review

Overview

This PR carries forward two post-merge P2 fixes that landed on the closed branch after #4121 was squash-merged. The changes teach agent-workflow-seam-doctor to correctly implement CommonMark closing-fence rules (variable-length fences, character-type matching, info-string rejection on closers), add test coverage for the new edge cases, and clarify adoption docs.


Code Quality: update_fence_state refactor

The structural split — handling the in-fence path entirely before the opening-fence path — is a clear improvement over the old mixed-branch approach. The logic is now easy to follow in both directions.

Closing-fence regex change is correct:

# Before: only matched exactly 3 chars
/^ {0,3}(```|~~~)([[:alnum:]_-]*)(?:\s.*)?$/

# After (closing path): requires ≥3 chars, rejects info strings via [ \t]*$
/^ {0,3}(`{3,}|~{3,})[ \t]*$/

Per CommonMark spec §4.5, a closing fence must be the same character, at least as long as the opening, and may not have an info string. All three constraints are now enforced.

closing_fence_delimiter? is a clean extraction. Character-type check ([0]) plus length check covers both constraints correctly. The nil-safety concern is handled by the caller: fence_delimiter is only non-nil while in_fence is true (the [false, false, nil] return resets both together).

Opening fence regex is consistent:

/^ {0,3}(`{3,}|~{3,})([[:alnum:]_-]*)(?:\s.*)?$/

{3,} for both delimiters closes the gap where `````bash(4-backtick) fences weren't recognized by the old(```|~~~)` pattern.

One minor observation: the tool's opening-fence pattern (([[:alnum:]_-]*)) is intentionally more conservative than the CommonMark spec (which allows any character except backtick in backtick-fence info strings). This means an info string like ```rust/no_run (slash in info) won't be recognized as a fence at all. This is fine for the real-world content this tool audits (agent skill Markdown), and being conservative avoids false negatives. Worth noting in case someone reports this as a bug later.


Tests

The reorganization into focused Minitest::Test classes (FenceTest, FenceLengthTest, FenceContentTest) makes the intent of each test group obvious without sacrificing discoverability — Minitest prints the class name on failures.

The new coverage is good and targeted:

Test What it pins
test_executable_placeholder_in_long_code_fence_fails 4-backtick opener is now recognized
test_shorter_closing_fence_does_not_close_long_executable_fence shorter closer stays inside
test_shorter_closing_tilde_fence_does_not_close_long_tilde_fence same for tilde
test_longer_closing_fence_closes_long_executable_fence longer closer is valid
test_longer_closing_tilde_fence_closes_long_tilde_fence same for tilde
test_closing_fence_with_info_string_stays_inside_executable_fence info string on closer is rejected

One gap: there's no test for a backtick closer attempting to close a tilde-opener or vice versa when the lengths match (e.g., ~~~bash / ```). The test_mismatched_fence_delimiter_does_not_close_executable_fence covers tilde-close-of-backtick, but not backtick-close-of-tilde. The closing_fence_delimiter? logic handles it correctly via delimiter[0] == fence_delimiter[0], so this is a minor coverage gap, not a bug.


Documentation

The Step 4 rewrite is clear and actionable. The added sentence — "Do not run an installed-skill-only setup with only skills/: install workflows/ too, or keep repo-local workflow copies/launchers for skills that still reference .agents/workflows/..." — directly addresses the real failure mode (#4121 review threads linked in the PR). The prose is a bit dense but no worse than the surrounding guidance.


Validation

The PR's validation checklist is thorough: 36 tests / 93 assertions / 0 failures, RuboCop clean, git diff --check clean, shared-repo validate pass. Nothing is left for CI to catch here.


Summary

  • Logic is correct and aligns with the CommonMark spec for closing fences
  • The refactor is strictly better than the original — easier to reason about, no behavior regressions
  • Test coverage is solid; the one missing inverse-mismatch test is not worth blocking on
  • Docs change is accurate and useful

Approved with one suggestion: consider adding a test_backtick_closer_does_not_close_tilde_fence to round out the symmetric case, but this can be a follow-up if the author prefers to keep the PR scoped.

@claude

claude Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Code Review

Overview

This PR carries forward two post-merge review findings from #4121 and tightens the CommonMark closing-fence behavior in agent-workflow-seam-doctor. The changes affect only internal agent-workflow tooling — no runtime product paths.

The three files changed are:

  1. .agents/bin/agent-workflow-seam-doctor — fence parser logic
  2. .agents/bin/agent-workflow-seam-doctor-test.rb — expanded test coverage
  3. internal/contributor-info/agent-workflow-adoption.md — doc clarification

Fence Parser (update_fence_state)

Correctness: good. The refactored branch structure is cleaner than the old single-regex approach. The two branches (in-fence / not-in-fence) each apply a purpose-fit regex, which avoids the bug that previously let a shorter or info-string-bearing line prematurely close a long fence.

CommonMark compliance: correct. The closing fence regex /^ {0,3}({3,}|~{3,})[ \t]*$/correctly rejects closers that carry an info string, andclosing_fence_delimiter?` enforces same-character + at-least-as-long rules per spec.

CRLF handling: correct. line.chomp at the top of update_fence_state normalizes CRLF before fence matching. The raw (un-chomped) line still reaches placeholders_from_line, which is fine because strip inside executable_line? handles \r, and SEAM_PLACEHOLDER is not anchored at end-of-line.

Minor style note: Reassigning the method parameter (line = line.chomp) works but can surprise readers. A local variable (chomped = line.chomp) used throughout the method body would signal intent more clearly without any behavioral change.

Edge case — fence_delimiter nil-safety: closing_fence_delimiter? calls delimiter[0] and fence_delimiter[0]. Because fence_delimiter is only non-nil when in_fence is true, and the method is only called inside the in_fence branch, this is safe in practice. No issue, just worth noting for future readers.


Opening Fence Regex

The two key changes to the opening fence regex are correct:

  • {3,} instead of the literal three-char alternative correctly accepts 4-backtick / 5-tilde openers.
  • (?:[ \t]*([[:alnum:]_-]+))? (optional, requires alnum start) combined with (?:[ \t].*)?$ correctly extracts only the first word of a spaced info string ( ```` bash → language=bash).
  • Switching from \s to [ \t] in the info-string guard means a bare newline can no longer act as a separator between fence chars and language — correct per CommonMark.

Test Coverage

Test reorganization into focused classes (FenceTest, FenceLengthTest, FenceContentTest) is a clear improvement. New cases cover:

Scenario Test
4-backtick opener detected test_executable_placeholder_in_long_code_fence_fails
Shorter closer does not close longer fence (backtick) test_shorter_closing_fence_does_not_close_long_executable_fence
Shorter closer does not close longer fence (tilde) test_shorter_closing_tilde_fence_does_not_close_long_tilde_fence
Longer closer DOES close a long fence (backtick) test_longer_closing_fence_closes_long_executable_fence
Longer closer DOES close a long fence (tilde) test_longer_closing_tilde_fence_closes_long_tilde_fence
Info-string closer stays inside fence test_closing_fence_with_info_string_stays_inside_executable_fence
CRLF line endings test_crlf_closing_fence_closes_executable_fence
Spaced info string — non-executable test_spaced_info_string_on_long_non_executable_fence_is_not_executable
Spaced info string — executable test_spaced_info_string_on_long_executable_fence_is_executable

One minor gap: there is no test for a tilde fence closed by a backtick closer (the reverse of the existing test_mismatched_fence_delimiter_does_not_close_executable_fence). The code handles it correctly (delimiter[0] == fence_delimiter[0] would be ` == ~, which is false), but the mirror case is absent. Not a blocker.


Documentation

The Step 4 update is clear and fixes a real footgun: users who followed the old advice and installed only skills/ (without workflows/) would break skills that reference .agents/workflows/.... The new wording makes the either/or explicit.


Summary

Approve. The logic is correct, the test coverage is thorough, and the doc improvement fills a genuine gap. The only suggestions are a style nit (local variable over parameter reassignment) and one missing mirror test case — neither is a blocker.

@cursor

cursor Bot commented Jun 22, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_2f40337a-7ae3-4405-9ddf-8934c70ebafa)

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cursor

cursor Bot commented Jun 22, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_7211630b-2efa-40aa-aac7-3ad98015a347)

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@justin808 justin808 merged commit ce775fc into main Jun 22, 2026
33 checks passed
@justin808 justin808 deleted the jg-codex/4121-seam-doctor-followup branch June 22, 2026 08:29
@claude

claude Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Code Review

Note: This PR is already merged. Review provided for the record and any follow-up consideration.

Overview

This is a focused, well-scoped follow-up to #4121 that improves CommonMark compliance in agent-workflow-seam-doctor and broadens the adoption docs to cover both Codex and Claude Code hosts. The risk surface is narrow — no production runtime, auth, or user-facing product code is touched.


agent-workflow-seam-doctor — Fence Parsing Refactor

The refactoring of update_fence_state is a clear improvement. Splitting the in_fence and opening-fence paths into separate branches eliminates the awkward double-match that the original code used for both purposes. The resulting logic directly mirrors the CommonMark spec sections on fenced code blocks:

  • 3+ character openers/closers ({3,} quantifiers) — correct.
  • Closing fence must not have an info string ([ \t]*$ with no capture group) — correct.
  • Closing fence must match opener character and be at least as long (closing_fence_delimiter?) — correct.
  • CRLF support (line.chomp at method entry) — correct and necessary; without it \r would prevent [ \t]*$ from matching CRLF line endings.

One implicit precondition worth documenting: closing_fence_delimiter? calls fence_delimiter[0], which assumes fence_delimiter is never nil when in_fence is true. This invariant holds because the caller (executable_placeholder_issues) only sets in_fence = true via a return value that simultaneously sets fence_delimiter to a non-nil regex capture. It's correct but relies on the call-site contract rather than being expressed in the method signature. A guard or comment here would make it safer for future editors.

Subtle preservation of existing behavior: the opening-fence regex change from ([[:alnum:]_-]*) (zero-or-more, always captures) to (?:[ \t]*([[:alnum:]_-]+))? (optional group, one-or-more) means an unlabeled fence still resolves to language = "". Since EXECUTABLE_FENCE_LANGS includes "", unlabeled fences remain executable — consistent with before, but the mechanism is now via nil.to_s rather than an empty string capture. Worth a comment near EXECUTABLE_FENCE_LANGS if this intent isn't already documented elsewhere.

Minor: line = line.chomp reassigns the parameter at the top of the method, but the caller (executable_placeholder_issues) continues using the original (un-chomped) line object for placeholders_from_line. This is harmless because SEAM_PLACEHOLDER scanning is unaffected by a trailing \r, but having the two callers work on different versions of the same line is a subtle coupling. Returning the chomped line or chomping at the call site would make the data flow explicit.


Test Coverage

The new test suite is excellent. Breaking tests into three focused Minitest::Test subclasses (…FenceTest, …FenceLengthTest, …FenceContentTest) is a good organizational choice that will make failures much easier to diagnose. Coverage includes:

  • Long fence openers (4-backtick) ✓
  • Shorter closers that do not close a longer opener ✓
  • Longer closers that do close a shorter opener ✓
  • Closing fence with info string (stays inside fence) ✓
  • CRLF line endings ✓
  • Spaced info strings for executable (bash) and non-executable (markdown) languages ✓
  • Tilde fence variants mirroring each backtick case ✓

39 tests, 98 assertions, 0 failures per the PR description. The only gap I can see is a test for a fence that spans end-of-file without a closing delimiter — a stray opener that never closes. This isn't a new gap introduced by this PR, and the existing behavior (treat rest-of-file as inside the fence) is likely intentional, but a test documenting that behavior would help future readers.


Documentation

The AGENTS.md, adoption guide, and seam-design doc changes are clear and consistent. The addition of agent-workflows-status / upgrade-agent-workflows references with stable status tokens (UP_TO_DATE, UPGRADE_AVAILABLE, NOT_INSTALLED, CHECK_FAILED) and a rollback narrative is a useful operational addition.

The pr-batch description update to include "agent batch" / "Claude batch" alongside "Codex batch" is a small but meaningful expansion that will route more users to the right skill.


Summary

Area Assessment
Fence parsing correctness ✅ Correct per CommonMark spec
CRLF support ✅ Properly handled via chomp
Test coverage ✅ Comprehensive; minor gap on unclosed fences
closing_fence_delimiter? safety ⚠️ Implicit nil precondition; safe today, fragile if call site changes
Caller/callee line chomping ⚠️ Two code paths use different line forms; harmless but subtle
Documentation ✅ Clear, actionable, consistent
Security / production risk ✅ None; tooling-only changes

Overall: solid work. The two ⚠️ items are minor and do not block anything — noting them for possible follow-up hardening.

[true, EXECUTABLE_FENCE_LANGS.include?(language), delimiter]
end

def closing_fence_delimiter?(delimiter, fence_delimiter)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method assumes fence_delimiter is never nil (it calls fence_delimiter[0]). That invariant holds today because the only code path that sets in_fence = true simultaneously sets fence_delimiter to a non-nil regex capture in executable_placeholder_issues. Consider adding a guard or a comment expressing the precondition so a future refactor doesn't silently introduce a NoMethodError:

Suggested change
def closing_fence_delimiter?(delimiter, fence_delimiter)
def closing_fence_delimiter?(delimiter, fence_delimiter)
# fence_delimiter is guaranteed non-nil when in_fence is true (set by the opening-fence branch).
delimiter[0] == fence_delimiter[0] && delimiter.length >= fence_delimiter.length
end

@@ -206,18 +206,31 @@ module AgentWorkflowSeamDoctor
end

def update_fence_state(line, in_fence, fence_delimiter)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line.chomp is correctly applied here for CRLF support, but the caller (executable_placeholder_issues) continues to use the original un-chomped line object when it calls placeholders_from_line. This is harmless today (a trailing \r doesn't confuse SEAM_PLACEHOLDER scanning), but it means the two code paths operate on slightly different forms of the same line. If this method ever starts doing more string comparisons, this inconsistency could produce subtle bugs. One option is to chomp at the call site instead:

# In executable_placeholder_issues:
File.binread(path).force_encoding("UTF-8").scrub.each_line.with_index do |line, index|
  line = line.chomp
  ...
end

justin808 added a commit that referenced this pull request Jun 22, 2026
…ck-comparison-doc

* origin/main:
  Bump version to 17.0.0.rc.6
  docs: fix dead undici link and silence flaky GitHub links in lychee check (#4165)
  Update changelog for 17.0.0.rc.6 (#4174)
  Reduce PR security preflight false positives for CI metadata (#4170)
  [codex] Document targeted agent coordination reads (#4166)
  Carry forward seam doctor follow-up fixes (#4171)
  Unskip Rspack RSC e2e tests on react-on-rails-rsc 19.2 (rc.3) (#4173)
  Revert "docs: add accessibility best-practices guide (RoR + RSC) (#4086)"
  docs: rsc-css render-blocking links + end-of-head cascade trap (#4138) (#4143)
  Fix RSC-safe locale default messages output (#4146)
  Share agent workflows via installed skills + repo seam (#4121)
  Codify degraded agent-coord batch fallback (#4161)
  [codex] Document flagship demo coordination (#4164)
  Enrich deferred-render RSC errors with the bundle diagnostic (#3475) (#4100)
justin808 added a commit that referenced this pull request Jun 23, 2026
…tion-path

* origin/main:
  docs(agents): make completing an authorized merge the expected close-out (#4156)
  docs: add accessibility best-practices guide (RoR + RSC) (#3927) (#4179)
  Bump version to 17.0.0.rc.6
  docs: fix dead undici link and silence flaky GitHub links in lychee check (#4165)
  Update changelog for 17.0.0.rc.6 (#4174)
  Reduce PR security preflight false positives for CI metadata (#4170)
  [codex] Document targeted agent coordination reads (#4166)
  Carry forward seam doctor follow-up fixes (#4171)
  Unskip Rspack RSC e2e tests on react-on-rails-rsc 19.2 (rc.3) (#4173)
  Revert "docs: add accessibility best-practices guide (RoR + RSC) (#4086)"
  docs: rsc-css render-blocking links + end-of-head cascade trap (#4138) (#4143)
  Fix RSC-safe locale default messages output (#4146)
  Share agent workflows via installed skills + repo seam (#4121)
  Codify degraded agent-coord batch fallback (#4161)
justin808 added a commit that referenced this pull request Jun 23, 2026
…a-lane

* origin/main:
  docs(agents): make completing an authorized merge the expected close-out (#4156)
  docs: add accessibility best-practices guide (RoR + RSC) (#3927) (#4179)
  Bump version to 17.0.0.rc.6
  docs: fix dead undici link and silence flaky GitHub links in lychee check (#4165)
  Update changelog for 17.0.0.rc.6 (#4174)
  Reduce PR security preflight false positives for CI metadata (#4170)
  [codex] Document targeted agent coordination reads (#4166)
  Carry forward seam doctor follow-up fixes (#4171)
  Unskip Rspack RSC e2e tests on react-on-rails-rsc 19.2 (rc.3) (#4173)
  Revert "docs: add accessibility best-practices guide (RoR + RSC) (#4086)"
  docs: rsc-css render-blocking links + end-of-head cascade trap (#4138) (#4143)
  Fix RSC-safe locale default messages output (#4146)

# Conflicts:
#	.agents/skills/plan-pr-batch/SKILL.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant