Skip to content

fix(dispatcher): a marker reader trusts bytes it should qualify #205

Closed

Description

@sydevs-bot

Summary

Three marker readers in dispatcher/ act on text without checking who wrote it or where it sits. Anyone who can comment on an issue can silence a dispatcher advisory or seed a forged dispatch record, and a ticket body that documents the Blocked by: format inside a code fence has that example converted into a real relationship. None of the three is reachable only through a new feature; all predate #198, which found them.

Approach

Two parts, one commit each. They share a root — a reader trusting bytes it should qualify — but the qualifications differ: who wrote it for part 1, where it sits for part 2.

1. Qualify the author of a dispatcher-owned marker.

  • commentOnce (dispatcher/apply.mjs:20) dedupes on comments.some((c) => String(c.body || '').startsWith(mark)) (:23) with no author filter. Anyone who can comment on an item can pre-post <!-- sydevs-dispatcher: <key> --> and permanently suppress that advisory — the dispatcher then logs comment "<key>" already posted and moves on.
  • loadRecord (dispatcher/record.mjs:60) returns the first comment parseRecord accepts (:16), which tests only body.startsWith(MARKER) (:18). A comment posted before the dispatcher creates its own record would be read as the record, seeding current, pending, fixCi, continues and dispatches.

The keys are predictable. decide.mjs carries 18 commentOnce keys on main. Two are bare fixed strings: approve-open-questions (decide.mjs:825) and blocked (:524, :558). The other 16 prefix a fixed word with a value anyone reading the item can see — a head sha, a comment id, a PR number — so every one of them is guessable from the item itself. The open-questions advisory on this ticket (:499) is one of them.

Both filters are one clause: the comment's author must be identity.expectedLogin. isBot(login, config) is exported from dispatcher/decide.mjs:43 and already used this way across gather.mjs, sweep.mjs and deps.mjs. The listings both seams already make return user.login, so neither needs a new GitHub call. What each one does need is the login threaded in, because neither function takes config today:

  • commentOnce(gh, t, key, body, dryRun, log) — all four call sites (apply.mjs:164, :329, :344, :440) sit inside apply(), where config is in scope. apply.mjs does not import decide.mjs today; decide.mjs imports only verbs.mjs and ../workflow/lib/railway.mjs, so the import adds no cycle.
  • loadRecord(gh, { owner, repo, number }) — the filter belongs here, not in parseRecord, which sees a body and no author. Three of its four call sites have config in scope (sweep.mjs:57, sweep.mjs:65, gather.mjs:192, where config.identity.expectedLogin is already bound at :187). The fourth, gather.mjs:105, sits in inSetBuild(gh, goal, childRef, lock), which receives only the lock label — its two callers (gather.mjs:230, :318) both pass config.labels.lock with config in scope, so that helper takes the login too.

What the decision settled. A comment the bot wrote under a different login — a renamed bot, a migrated PAT — stops being recognised, so every advisory re-posts once and every record is re-created once on first contact. That one-off duplicate across the open items in five repos is accepted (## Decisions 1). Build no reconciliation path for it.

2. Skip fenced code when reading a blocker line.

parseBlockedBy (dispatcher/markers.mjs:57) has no fence state, unlike parseOpenQuestions (:155), which carries exactly the three lines needed (:157, :161, :162). So a ticket body that shows the marker format as documentation has the example read as live, converted into a native relationship, labelled blocked, and then stripped from the body by stripBlockedBy.

Measured on main (569dd90):

  • A body that is nothing but a fenced Blocked by: line returns that ref from parseBlockedBy, and stripBlockedBy drops the line.
  • Running both readers over every tracked .md in this repo hits exactly one file: workflow/skills/format-ticket/SKILL.md, whose own fenced example would relate sydevs/SahajCloud#632.

No ticket body observed today does this, so the failure is real but unwitnessed — which is why this is filed rather than folded into #198, whose ## Notes scope it explicitly ("This changes nothing about what counts as a blocker").

The seam depends on what has merged. blockerLines does not exist on main — #204 introduces it, and #204 is open. Write the fix against whichever shape is current at build time: the shared blockerLines pass if #204 has merged, else parseBlockedBy's own lines(body) loop (markers.mjs:61). Either way stripBlockedBy (:99) needs the fence flag added independently, because it splits on /(?<=\n)/ so each unit keeps its own line ending — one flag cannot serve both loops.

Decisions

  • 1. How should an author filter treat a marker the bot wrote under a former login? → A, filter on identity.expectedLogin only and accept the one-off duplicate (Ardnived, 2026-10-21)

Acceptance criteria

  • commentOnce treats a comment as already posted only when its author is identity.expectedLogin; a non-bot comment carrying the same marker does not suppress it.
  • loadRecord accepts a status comment only from identity.expectedLogin; a non-bot comment starting with MARKER is skipped, and the record is created as if absent.
  • Every caller of both passes the expected login, inSetBuild included, and no call site reads it from anywhere but config.identity.
  • Neither change adds a GitHub call: both read the login already present on the comments each one lists.
  • parseBlockedBy ignores a Blocked by: line inside a triple-backtick fence, and so does stripBlockedBy, so a fenced line is neither related nor stripped.
  • A Blocked by: line outside a fence behaves exactly as today, fenced content elsewhere in the body notwithstanding — markers.test.mjs's existing shared fixture keeps its current results.
  • Every new test has been watched failing against the unfixed reader before being kept.

Verification checklist

  • node --test dispatcher/test/*.test.mjs
  • claude plugin validate ./workflow --strict && node --test workflow/lib/*.test.mjs
  • The fenced-body probe prints [], where today it prints the ref (F is the fence, built without a backtick so the line pastes into a shell as written):
    node -e "const F=String.fromCharCode(96).repeat(3); import('./dispatcher/markers.mjs').then(m=>console.log(m.parseBlockedBy(F+'markdown\nBlocked by: https://github.com/sydevs/SahajCloud/issues/632\n'+F,'sydevs')))"
  • The same body through stripBlockedBy, with that target related, leaves the fenced line in place — today its dropped is that line:
    node -e "const F=String.fromCharCode(96).repeat(3); import('./dispatcher/markers.mjs').then(m=>console.log(m.stripBlockedBy(F+'markdown\nBlocked by: https://github.com/sydevs/SahajCloud/issues/632\n'+F,'sydevs','Blocked by',[{repo:'SahajCloud',number:632}]).dropped))"
  • Sweep both readers over git ls-files "*.md": no file reports a would-relate target, where workflow/skills/format-ticket/SKILL.md reports SahajCloud#632 today
  • grep -rn "loadRecord\|commentOnce(" dispatcher/*.mjs: every call site passes a login
  • A supervised BOT_DISPATCH=dry dispatch over a scratch issue carrying a hand-posted <!-- sydevs-dispatcher: blocked --> comment from a human login: the planned blocked comment still appears in the run log

Notes

Activity

  1. added theissue type on Oct 21, 2026
  2. moved this from Revising to Proposed in SYDevelopers Technical Roadmapon Oct 21, 2026
  3. added
    proposal
    on Oct 21, 2026
  4. Ardnived commented on Oct 21, 2026

    @Ardnived
    Contributor

    @sydevs-bot implement

  5. added and removed
    proposal
    on Oct 21, 2026
  6. sydevs-bot commented on Oct 21, 2026

    @sydevs-bot
    ContributorAuthor

    Not started: 1 open question(s) in the body still need an answer. Reply @sydevs-bot revise with your choices (for example 1A), then say @sydevs-bot implement again.

    🤖 sydevs dispatcher

  7. Ardnived commented on Oct 21, 2026

    @Ardnived
    Contributor

    @sydevs-bot revise 1A

  8. moved this from Proposed to Revising in SYDevelopers Technical Roadmapon Oct 21, 2026
  9. added
    bot:working
    on Oct 21, 2026
  10. sydevs-bot commented on Oct 21, 2026

    @sydevs-bot
    ContributorAuthor

    🤖 no session running

    recent dispatches
    • 23:59Z implement · attempt 1 · session · done
    • 23:59Z implement · attempt 1 · session
    • 16:47Z revise · attempt 1 · session · done
    • 16:47Z revise · attempt 1 · session

    Written by the sydevs dispatcher. Sessions never edit this comment.

  11. sydevs-bot commented on Oct 21, 2026

    @sydevs-bot
    ContributorAuthor

    Answered 1A: the filter is identity.expectedLogin alone, and the one-off duplicate at a login change is accepted. It is in ## Decisions, folded into Approach part 1, and the "chosen option ships" criterion is gone.

    Three things the code disproved while I was in there:

    • isBot is exported from decide.mjs:43, not gather.mjs, which imports it. apply.mjs does not import decide.mjs today, and adding it makes no cycle.
    • Neither seam takes config, so the login needs threading. gather.mjs:105 is the awkward one — inSetBuild receives only the lock label. A new criterion covers every caller.
    • The old key list came from fix(dispatcher): refuse a Blocked by line that names no issue #204's branch. main has 18 keys, two of them bare strings: approve-open-questions and blocked. The open-questions advisory above is one.

    Part 2's seam waits on #204: blockerLines is not on main yet. The Approach now names both shapes, so this is buildable today. I added no Blocked by: line, so expect a markers.mjs conflict if both run at once.

    No code written. @sydevs-bot implement starts it.

    🤖 Written by the sydevs autonomous loop — see what this is


    Generated by Claude Code

  12. added and removed
    bot:working
    on Oct 21, 2026
  13. Ardnived commented on Oct 26, 2026

    @Ardnived
    Contributor

    @sydevs-bot implement

  14. moved this from Revising to Approved in SYDevelopers Technical Roadmapon Oct 26, 2026
  15. added
    bot:working
    on Oct 26, 2026
  16. removed
    bot:working
    on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    Medium

    Hold Until

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions