Improve merge-request-flow.md: clarify triggers, state, and edge cases #1
Labels
No labels
implementing
planned
planning
triaging
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
zak.pub/tantalus#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Several areas in
merge-request-flow.mdcan be tightened to reduce ambiguity and prevent agent missteps.Issues
1. Phase 1 trigger is too narrow
"An unassigned issue exists" excludes issues filed by maintainers who auto-assign to themselves (common default on GitHub/Forgejo). Agents will silently skip these.
Suggestion: Change the trigger to "An issue exists that is not assigned to another agent" or introduce an explicit opt-in mechanism (e.g. an
agentlabel) so maintainers can request agent work on any issue regardless of assignment.2. "Agent's domain" is undefined
Phase 1 says the issue must match "the agent's domain" but the document never defines what a domain is or how the agent determines whether an issue falls within it.
Suggestion: Either define domain selection (e.g. based on repo, labels, or config) or remove the qualifier if agents should process all issues in a repo.
3. Platform detection is underspecified
The doc says "determine the platform from the local repo's git remote" but doesn't handle edge cases: multiple remotes, ambiguous URL formats, or remotes pointing to different platforms.
Suggestion: Specify which remote to use (e.g.
originby default, overridable) and what to do when the URL can't be matched to a known platform.4. Approval reaction is not verified against permissions
Phase 4 requires a thumbs-up from "a maintainer" but doesn't specify how the agent should verify the reactor actually has maintainer permissions. On GitHub/Forgejo, anyone can add reactions.
Suggestion: Add a step to verify the reactor's role via the platform API (e.g. check repository collaborator permissions) before treating the reaction as approval.
5. Concurrency rules assume persistent state
The "up to 3 issues" rule and "check in-flight issues" pattern assume the agent remembers state across loop iterations. The document doesn't specify how this state is tracked.
Suggestion: Specify the state mechanism — labels on the issues themselves (stateless agent, recommended) or a local state file. If labels are the mechanism, the current label scheme already supports this and just needs to be called out explicitly.
6. No timeout or escalation for waiting phases
Phases 4 (waiting for approval) and 7 (waiting for review) have no maximum wait time. An issue could sit indefinitely with no escalation.
Suggestion: Define a timeout (e.g. "if no response after 7 days, comment pinging the maintainer") or at least recommend one.
7. Label cleanup between phases could be clearer
Label transitions are consistent but scattered across phases. It's easy to miss one — e.g. Phase 2 to 3 removes
triagingand addsplanning, Phase 3 to 4 removesplanningand addsplanned, but this has to be pieced together from gate criteria.Suggestion: Add a label state transition table or diagram showing the expected label at each phase.
I've picked up this issue and I'm reviewing it now.
Triage Assessment
I've read the issue, the current
merge-request-flow.md, and evaluated each of the 7 suggestions. Here's my assessment:What's clear: All 7 items identify real gaps in the document. The suggestions are specific and actionable. The scope is well-bounded — this is a single-file change to
merge-request-flow.md.Evaluation of each item:
Phase 1 trigger too narrow — Agreed. The current wording would cause agents to skip issues filed by maintainers who auto-assign. An opt-in label or "not assigned to another agent" would fix this cleanly.
"Agent's domain" undefined — Agreed. This term is used but never defined. Removing it (agent processes all issues in its repo) is the simplest fix; alternatively, a brief definition tied to repo/labels/config would work.
Platform detection underspecified — Agreed. Specifying
originas default remote and handling ambiguous cases would be a small but useful addition.Approval reaction not verified against permissions — Agreed, though this is the most complex item. The verification approach is necessarily platform-specific, so the doc should outline the principle and give examples rather than exhaustive API calls.
Concurrency rules assume persistent state — Agreed. The label-based state mechanism is already implied by the label table but calling it out explicitly would remove ambiguity.
No timeout for waiting phases — Agreed. A recommended timeout with escalation (e.g., ping after N days) would prevent indefinite stalls.
Label cleanup could be clearer — Agreed. A label state transition table would make the flow easier to follow at a glance.
No clarifying questions — the issue is clear and well-scoped. I'll proceed to planning.
Plan
Goal: Clarify ambiguous sections of
merge-request-flow.mdto reduce agent missteps by addressing all 7 items from this issue.Approach: Edit
merge-request-flow.mddirectly, making targeted changes to the affected sections. Each item maps to a specific location in the document.Tasks:
Phase 1 trigger — Change "An unassigned issue exists that matches the agent's domain" to "An open issue exists that is not assigned to another agent and has no agent labels". This covers both unassigned issues and maintainer-self-assigned issues.
Remove "agent's domain" — Remove the qualifier "that matches the agent's domain" from Phase 1, since it is undefined and the simplest model is one agent per repo. If multi-domain is needed later, it can be added with a proper definition.
Platform detection — In the "Working Context" section, specify that
originis the default remote (overridable by agent config), and add guidance for when the URL format is unrecognized: log a warning and fall back to the Forgejo API as a generic Git forge default, or halt and ask.Approval reaction verification — In Phase 4, add a step after detecting a 👍 reaction to verify the reactor has maintainer/write permissions via the platform API. Provide brief examples for GitHub (
GET /repos/{owner}/{repo}/collaborators/{user}/permission) and Forgejo (GET /repos/{owner}/{repo}/collaborators/{user}). State the principle: "Do not treat reactions from users without write access as approval."State mechanism — In the "Concurrency" section, add a paragraph clarifying that the agent tracks issue state via labels on the issues themselves (stateless agent model). The label table already exists; this just makes the mechanism explicit.
Waiting phase timeouts — Add a "Timeouts" subsection or note to Phases 4 and 7: "If no response is received within 7 days, post a comment pinging the maintainer. If no response after 14 days, unassign yourself and remove labels."
Label state transition table — Add a table or diagram after the existing Labels section showing:
(none) → triaging → planning → planned → implementing → (none)with the phase transitions that trigger each change.Risks:
Test strategy:
Implementation complete. Merge request created: #4
All 7 items have been addressed in a single commit. Waiting for review.