Skip to content

One module for what a Run is asked: its command's flags, else the User config #304

Closed

Description

@JacobStephens2

What to build

What a Run is asked comes from two places: its command's flags, and, for whatever the command says nothing about, the User config. Today that resolution has no home. It is written out separately for a Run started on an Issue URL, for the Spec run or Run an Architect run dispatches, for the one a Pickup run dispatches, and for each of those two runs' own Run notification. The rule for a child Run (a Ticket's Run in a Spec run, or a Base fix) sits beside them in the entry point, and the command that retries a Run with a Base fix allowed has to be rebuilt by each caller from the flags as the command gave them, kept apart from the resolved values by hand.

Build one module that owns this: given the flags as the command gave them, the User config, and what the run is (started on an Issue URL, a child Run, an Architect plan being dispatched, or a Ready issue being dispatched), it returns everything the run is asked, resolved. The entry point and the Run take that one value. Nothing a user sees changes: same flags, same defaults, same progress lines, same retry command, same Run notifications.

The rules move out of end-to-end tests that start the whole binary and into a table of unit tests on the module.

Acceptance criteria

  • One module resolves what a run is asked: whether it is a Merge run, its Run notification, how many Tickets a Spec run runs at once and whether the command asked for that, what it asks about a Base fix (with the retry command where nobody decided), and whether it first brings the Launch directory's checkout of the Base branch up to date.
  • The flags a Run, an Architect run and a Pickup run share are one type, as the command gave them. The three near-identical flag structs are gone.
  • The module resolves a Run started on an Issue URL, a child Run, a dispatched Architect plan and a dispatched Ready issue, and the Run notification ask of an Architect run or a Pickup run itself.
  • The child Run rule is in the module and nowhere else: always a Merge run, no Run notification, the Launch directory left alone, no Base fix unless it was given one or the command to offer one.
  • A dispatched run's asks say it sends no Run notification of its own.
  • A Pickup run's parallel being ignored for a Ready issue that is not a Spec, in the asks and in the retry command, is in the module, not in the entry point.
  • The retry command is built inside the module from the flags as given. No caller keeps a copy of a flag beside its resolved value to build it.
  • The Run takes the resolved asks as one value. The entry point no longer resolves any ask itself, and the one-line default helpers on the User config and the Spec run's parallelism constructor are folded into the module.
  • Unit tests on the module cover: each ask with the flag given, with only the User config deciding, and with neither; the child Run rule; the retry command for each kind of run, read back by the argument parser into the same flags with a Base fix allowed; a dispatched run sending no notification; parallel ignored for a Ready issue that is not a Spec.
  • The end-to-end tests keep one case per ask per path it travels (command to Run, Spec run to a Ticket's Run, Architect run to its dispatched run, Pickup run to its dispatched run). The cases that only vary whether a flag or the User config decides are removed, as the unit tests now cover them.
  • No behaviour changes: the remaining end-to-end tests pass unedited apart from those removed, and the generated prompts/ directory is unchanged.
  • CONTEXT.md and docs/adr/ are unchanged: see Decisions.

Blocked by

None (can start immediately).

Decisions

  1. The module is named for the asks, and holds two types: the flags as given, and the asks as resolved. The code already calls each of these an ask (the notification ask, the Base fix ask), and CONTEXT.md already says a Run does "what its command asks for". Keeping "as given" and "resolved" as two types is what removes the hand-kept copy of the email flag: the retry command needs the first, the Run needs the second.
  2. No new CONTEXT.md term and no ADR. "Asks" names code, using words the glossary's User config, Merge run and Run notification entries already use; the Day shift needs no new word. The change is easy to reverse and involves no trade-off, so it is not worth an ADR, and it contradicts none.
  3. One constructor per kind of run, not one with options. A Run on an Issue URL (child or not), a dispatched Architect plan, a dispatched Ready issue. The differences between them are the rules worth testing (child rule, no notification of its own, parallel ignored for a non-Spec Ready issue), so each gets a name rather than a boolean.
  4. The argument parser fills in the shared flags type and owns the words; the asks module owns what they mean. Parsing stays where it is. Only the three structs with the same optional fields collapse into one. --plan-only refusing the flags for a dispatched run stays a parsing rule.
  5. The retry command moves into the asks module. It is the flags as given, written back out, and its only users are the Base fix asks the module builds. Its round-trip test moves with it and still reads the command back through the argument parser.
  6. What started a Run stays a separate value from its asks, as does the logs directory. What started it decides the Base branch and the Claim, which are not asks; the logs directory is a machine setting no flag overrides. The Run's entry goes from seven positional values to the issue, the asks, what started it and the logs directory.
  7. Whether the Launch directory is pulled is part of the asks, though no flag sets it, because the child Run rule overrides the User config for it.
  8. Flags a child Run can't use stay ignored, as today. Only thirdshift starts a child Run, and it never passes them. Turning that into an error would be a behaviour change, and this Ticket makes none.
  9. The default helpers on the User config and the Spec run's parallelism constructor are folded in, not kept beside the module. Each is one line with no other caller. With them gone the User config holds settings and knows nothing of a Run's types.
  10. Out of scope: the shared start-to-end sequence of the three commands, and the long parameter lists inside a Run and a Spec run. Both are real, but they are separate deepenings, and this one stands without them.
  11. Tests: replace, don't layer. The interface is the test surface: the rules are tested on the module in-process. End-to-end tests stay only for what a process boundary can break, which is an ask reaching the run. A Pickup run's merge test today runs twelve whole Runs to check a default.

Architecture review

Strength: Strong · Dependencies: in-process

Files: src/main.rs, src/args.rs, src/config.rs, src/run.rs, src/spec_run.rs, src/child_run.rs, tests/user_config.rs, tests/architect_run.rs, tests/pickup_run.rs, tests/spec_run.rs

Before

flowchart LR
  RunCmd[Run command] -.resolves.-> Flags[Flag structs x3]
  RunCmd -.resolves.-> Config[User config defaults]
  RunCmd -.child rule.-> Run
  Dispatch[Architect and Pickup dispatch] -.resolves.-> Flags
  Dispatch -.resolves.-> Config
  Architect[Architect run] -.email.-> Config
  Pickup[Pickup run] -.email, parallel.-> Config
  RunCmd -.retry command.-> Args[Argument parser]
  Dispatch -.retry command.-> Args
  Dispatch -->|7 values| Run
  RunCmd -->|7 values| Run
  classDef leak stroke:#dc2626,stroke-width:2px;
  class RunCmd,Dispatch,Architect,Pickup leak
Loading

After

flowchart LR
  Args[Argument parser] --> Asks
  RunCmd[Run command] --> Asks
  Dispatch[Architect and Pickup dispatch] --> Asks
  Architect[Architect run] --> Asks
  Pickup[Pickup run] --> Asks
  subgraph Asks[Asks]
    direction LR
    given[Flags as given] --> resolved[Asks resolved]
    Config[User config] --> resolved
    child[Child Run rule] --> resolved
    given --> retry[Retry command]
  end
  Asks -->|one value| Run
  classDef deep stroke-width:3px;
  class Asks deep
Loading

Problem: what a Run is asked is resolved in five places in the entry point, so its rules have no interface and are tested only by starting the binary.

Solution: one asks module takes the flags as given, the User config and the kind of run, and returns the resolved asks the Run takes whole.

Wins

  • Locality: flag-else-config written once
  • Child Run rule in one place
  • Retry command built behind the interface
  • Run's interface shrinks to one value
  • Unit table replaces binary-spawning tests
  • Leverage: a new ask touches one module

Activity

  1. added
    needs-triage
    ready-for-agent
    architect-plan
    in-progress
    and removed
    needs-triage
    ready-for-agent
    on Oct 2, 2026
  2. removed
    in-progress
    on Oct 2, 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

    architect-plan

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions