← Back to Pull requests

fix(daemon): keep an edited seat-skills line at down, and don't write it through a link #1859

Closed
unknown closed this pull request without merging on Oct 23, 2026 16:52 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 15:29 UTC
Author

What a user gets

Four protections for the seat-skills line, the one line OpenRig can add to a seat's CLAUDE.md or AGENTS.md when a person opts in with rig setup --router-line yes:

  • An edit to the line is kept.

  • - Before this, rig down removed the line's block even when the person had changed it, and the next start replaced it.
    - Now rig down leaves an edited block in place and names it: Kept 1 edited OpenRig block(s) in guidance files; remove them by hand if you don't want them:, followed by <file>: <block id>.
    - A start leaves an edited block as it is, reports the file as edited, and warns seat_skills_line_edited.
    - An unedited line is still removed by rig down, back to the file's original bytes.
  • A linked guidance file isn't written through.

  • - Before this, a CLAUDE.md or AGENTS.md that is a symbolic link received the line through the link, often into a file outside the project, and the start said it was delivered.
    - Now the start leaves the link and its target alone, reports the file as linked with a seat_skills_line_linked warning, and starts the seat without the line.
  • A resume honours the answer. Before this, rig up --existing (an exact resume) wrote the line back whenever it was missing, even after a no, or with no answer at all. Now it puts the line back only with a yes, and never through a link.

  • Setup says what is actually written.

  • - The promise is "one line, plus OpenRig's markers so it can be removed cleanly".
    - The preview shows the exact text written (the line between OpenRig's markers), printed as written and in JSON as written.
    - It also shows where that text goes: added at the end of the file after two newlines, or as the whole file when there's none.

    The change

    One rule for "edited" (managed-blocks.ts):

  • managedBlockBodyMatches compares a block's body with what OpenRig writes. It uses the exact bytes, ignoring only the writer's own framing (newlines at either end, and CRLF line endings). A person's spaces count, so an indented line is an edit.

  • rig down and a start both use it, so they agree on what is edited.
  • At rig down (rig-teardown.ts): removeManagedBlocksFromFile takes the bodies OpenRig writes for named blocks.

  • The seat-skills block: teardown passes its body (SEAT_SKILLS_BOOTSTRAP_LINE, which the guidance asset carries exactly). An edited block is kept in place, reported as keptGuidance, and printed by rig down.

  • Other managed blocks (culture, the identity pointer, onboarding, team guidance) have no recorded body and are removed as before.
  • At a start (startup-orchestrator.ts, footprint-choice.ts):

  • Before delivering the line, the start checks the guidance file on disk:

  • - if the file itself is a symbolic link, the outcome is linked;
    - if it holds an edited seat-skills block, the outcome is edited.
    - Either way, nothing is written.
  • The new outcomes sit beside delivered, skipped and unwritable.

  • Startup paths: the check reads the file directly, so every startup path applies it, including the starts a restore runs.
  • At an exact resume (restore-guidance.ts, restore-orchestrator.ts):

  • The rule: applySeatSkillsLineRule leaves the seat-skills block out of the saved guidance unless the saved answer is yes and the file isn't a link. So the repair doesn't write it, and the post-restore guidance check doesn't report it missing.

  • A linked file is reported.

  • Settings: the answer is read from the OpenRig settings (skills.router_line.enabled), as at a start.
  • What setup shows (seat-skill-storage.ts, setup.ts):

  • The exact text: the footprint now carries written (the line between the markers, built by managedBlockText, the helper mergeManagedBlock writes with), appended (the bytes added to an existing file) and placement.

  • Where the promise changed: setup, the config help and the getting-started guide say "one line, plus OpenRig's markers".
  • Limits, stated:

  • Only the seat-skills line. OpenRig's other managed blocks are still written through a linked guidance file, and teardown still strips through one. Many setups link CLAUDE.md to AGENTS.md on purpose, and refusing there would stop all of OpenRig's guidance for them.

  • Only the file itself. A link elsewhere on the path, such as a linked project folder, isn't checked.
  • Tests

  • rig-teardown.test.ts: for a Claude seat's CLAUDE.md and a Codex seat's AGENTS.md, the blocks are written with the real writer, then a real teardown runs on a real filesystem.

  • - An unedited line returns the file to its original bytes.
    - An appended word and an indented line are each kept in place and named in keptGuidance.
    - The culture block beside them is still removed.
  • startup-orchestrator.test.ts, each through the real Codex and Claude adapters:

  • - A linked guidance file: the file outside the project is unchanged, and the outcome is linked.
    - An edited line: it is left byte for byte, and the outcome is edited.
    - A yes: the start writes exactly the previewed bytes, both into an existing file and into a new one.
  • restore-guidance-after-down.test.ts: down, then an exact resume. After a no, the line isn't written and there's no guidance gap; after a yes, it is put back.

  • setup.test.ts: the preview's written is the exact block, and setup prints it as written.

  • down.test.ts: rig down prints each kept block.
  • Proof

    Each test run was at an exact commit, on a clean, network-off build of the repository.

  • First commit (b679db51):

  • - Before the fix (main ebfc0fb5 plus the new tests): daemon 195 of 200 and CLI 44 of 45. All five failures are the new cases; the one skip is an existing one.
    - With the fix: daemon 393 of 394 (the same skip) and CLI 129 of 129, across 13 files.
  • Second commit (3ce6ca2b):

  • - Before (the first commit plus the new tests): CLI 58 of 59 and daemon 125 of 130. The five failures are the new preview and written-bytes cases.
    - With it: daemon 397 of 398 (the same skip) and CLI 226 of 226, across 13 files.
  • Third commit (9fdbd6e6, this head):

  • - Before (the second commit plus the new tests): daemon 222 of 228. The five failures are the new cases: the resume after a no, the indented line at down, and an edited line at a start for each harness. The resume after a yes passes.
    - With the start test's byte check moved first: both edited-start cases fail on the person's bytes, because the start replaced the edit.
    - With it: daemon 674 of 675 (the same skip) and CLI 118 of 118, across 14 files, including the restore orchestrator and per-seat role restore suites.
  • Build: no type errors in any run.
  • 🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Setup previews show the exact marked guidance text, where it will be placed, and what happens if you decline.
    Startup reports when guidance files are linked or contain edited lines, and leaves those files unchanged.
    rig down reports edited guidance blocks it preserves.
    Bug Fixes
    Teardown preserves edited setup guidance while removing other managed guidance.
    * Saved seat-skills guidance is restored only when the setup choice was “yes”; linked guidance files are not written through.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: mvschwarz Review duration: 83m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 650 lines diff across 8 files
    0.57
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1859"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 57% (MEDIUM) · Higher = larger blast radius
    57%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%