Skip to content

Deepen Command rendering for Base fix and Security run guidance #645

Closed

Description

@JacobStephens2

What to build

Make the existing Base fix and Security run Retry with guidance preserve every argument when copied into a supported machine's shell. A Model label such as Model Label With Spaces must reach thirdshift as one value. Deepen the Command line module so the Asks and Security run modules ask for a command with fixing allowed, without reconstructing flag spellings or shell text themselves.

This is one standalone Ticket: implement both callers, behavioral tests, and verification in one session. It adds no new guidance, stopping-stage reporting, or retry policy.

Acceptance criteria

  • One Command line module owns the two existing guidance operations, shared serialization of public flags, and literal POSIX shell rendering. Both production callers cross that interface; neither enumerates flag spellings, quotes words, nor reads process arguments to reconstruct guidance.
  • Base fix guidance targets the original Issue URL with base-fix allowed. Architect plan and Pickup dispatches continue to offer that issue directly; a dispatched issue that is not a Spec still omits parallel.
  • Security fixing guidance targets secure, retains the original optional Base branch argument, and allows security-fix. An originally omitted Base branch remains omitted rather than becoming the branch resolved during launch.
  • Explicit merge, notification, parallel, Base fix, Security fixing, Security review, Harness, Model, and Effort choices round-trip through the shell and public argument parser, except for the permission deliberately enabled by the requested operation. That permission appears exactly once.
  • Omitted choices stay omitted and retain existing User config fallback behavior. Computed retry strings and hidden child Run arguments never appear in public guidance.
  • Values containing spaces, apostrophes, double quotes, Unicode, dollar signs, and other shell punctuation are recovered literally as one argument. Use harmless fixture values, a shell argv-capturing function, and NUL-separated output to verify this.
  • Existing offer/no-offer decisions remain: Base fix guidance is generated for its undecided ask, and Security fixing guidance only when neither the flag nor the setting decides permission. Terminal output and Run notification carry the same command, and rendering performs no factory work or outward writes.
  • Replace space-split rendering tests with shell recovery and parser round-trip tests at the Command line module's interface. Retain caller-level tests for offer policy, dispatch targeting, and notification agreement; update spelling/order-only assertions where canonical rendering changes them.
  • Run cargo fmt --check, cargo clippy --all-targets -- -D warnings, and cargo test. The reproduced Model-label regression passes through the production interface.

Blocked by

None (can start immediately).

Decisions

The design tree is settled in dependency order: scope → interface → {Issue URL targeting, Security run targeting, public flag words} → {literal shell rendering, caller integration} → {interface tests, caller tests, verification, documentation}. Every frontier below is resolved.

  1. Scope — existing offers only. Consolidate the existing Base fix and Security fixing command reconstruction. Reason: two real callers already need this behavior; new failed-Spec and human-gate reporting is separate work in Report where a failed Spec run stopped and how to continue its preserved work #588 and Surface Spec human gates early and provide actionable continuation instructions #586, and additional error advice is in When an error response from thirdshift, comes back, give the user a sample command to address the problem #53. None proposes this same deepening of the existing rendering modules. All 66 open issue titles and bodies were checked again before publication.
  2. Interface — two semantic operations in the existing Command line module. Accept an Issue URL plus typed Flags for the Base fix operation, and an optional original Base branch plus typed Flags for the Security fixing operation; return executable command text. Keep word construction and quoting private to that module. Reason: callers should know the target and permission change, while the module owns the grammar it already parses. A quoting helper alone would leave the shallow flag reconstruction scattered and would not add this depth. No general serializer for every command kind is needed.
  3. Dependencies — in-process, with no new adapter. Rendering takes supplied values and performs no environment reads or factory actions. Reason: nothing varies across an effects seam; introducing a port would be a hypothetical seam. The production interface is also the test surface.
  4. Issue targeting — preserve current Asks policy. Construct an ordinary Run on the supplied Issue URL and enable Base fixing. Keep the existing caller's removal of parallel for a dispatched issue that is not a Spec. Reason: re-running Architect or Pickup would select new work, while the existing offer is a Continuation of this issue. Child Runs continue to inherit the parent's already-computed Base fix offer through their current transport.
  5. Security targeting — reconstruct from typed inputs. Capture the originally supplied optional Base branch before launch preparation shadows it, and render secure with the supplied Flags and Security fixing enabled. Reason: the public Security command consists exactly of those inputs; sampling process arguments again duplicates knowledge, and using the resolved Base branch would freeze a choice the command originally omitted.
  6. Flag words — one shared implementation. Serialize every existing public Flags choice once, preserving value text and omitted choices; apply the requested permission to a copied Flags value before rendering. Do not serialize the retry text carried by a computed undecided Base fix ask, or any hidden child Run transport. Reason: the output describes public command asks, not resolved Asks or child-process state, and enabling a permission must not append a duplicate or contradictory switch.
  7. Defaults — retain explicit-ask semantics. Do not materialize User config-derived Harness, Model, Effort, notification addresses, merge choices, or Base branch into guidance. Reason: both existing offers preserve the original command's asks and consult defaults again when run; freezing effective choices would expand this Ticket into the unresolved recovery-guidance contract.
  8. Shell text — deterministic POSIX rendering. Keep simple safe words readable and single-quote other words, escaping embedded apostrophes with the established POSIX sequence. Canonical accepted flag spellings and ordering may replace the original Security command's spelling/order; argument values and semantics must remain exact. Reason: every supported platform supplies a POSIX shell, and preserving byte-for-byte input syntax adds no leverage. This is a rendering contract, not a new execution path.
  9. Interface testing — recover actual arguments. Test both semantic operations by defining a harmless thirdshift shell function that emits NUL-separated argv, evaluating the rendered command through sh, and feeding the recovered words to the existing parser. Compare target, optional Base branch, Flags, and absence of hidden child facts. Include all public flags, no settings, both permission operations, and punctuation-bearing values. Reason: the existing space-split helper cannot distinguish one quoted value from multiple arguments. No shell-parser dependency or fake adapter is necessary.
  10. Caller testing — preserve policy and presentation. Keep Asks tests that cover direct Runs and dispatches, and the existing real-Git/fake-Harness/fake-GitHub guidance scenarios for Base fix and Security runs. Verify terminal/notification agreement and suppression when permission was decided. Replace assertions that only enforce Security input spelling/order with recovered semantic assertions. Reason: module tests verify literal transport, while these tests verify that callers request the right operation at the right time.
  11. Verification — targeted behavior, then required checks. Run the interface and caller tests during implementation, then formatting, linting, and the full suite. Reason: public flag reconstruction touches every existing ask even though only two guidance callers change. During this review, a throwaway test through Asks::of_run and sh reproduced the gap: the Model label was split and the parser rejected Label as an unexpected argument. At main revision 02b3365, the original 14 Asks tests and 25 argument-parser tests passed, confirming that their current simple values miss this case. Both existing guidance integration scenarios also passed (41 baseline tests in total). The probe was removed after diagnosis, leaving the tracked worktree clean.
  12. Documentation — existing domain language and ADRs suffice. Use Command, Base fix, Security run, and Continuation as already defined. No new domain term, glossary change, or ADR is required. Reason: this is a reversible internal consolidation with the same command policy, supported platforms, child transport, and lifecycle; it reopens no ADR.

Architecture review

Strength: Strong · Dependencies: in-process

Files: src/args.rs, src/asks.rs, src/security.rs, tests/base_fix.rs, tests/security_run.rs

Before

flowchart LR
  A[Asks module] --> B[Base fix rendering]
  S[Security run module] --> F[Security fixing rendering]
  B -. flag grammar leaks .-> C[Command line module]
  F -. flag grammar leaks .-> C
  B --> H[Shell words]
  F --> H
  classDef leak stroke:#dc2626,stroke-width:2px;
  class B,F leak
Loading

After

flowchart LR
  A[Asks module] --> C
  S[Security run module] --> C
  subgraph C[Command line module]
    B[Base fix rendering] --> H[Shell words]
    F[Security fixing rendering] --> H
  end
  classDef deep stroke-width:3px;
  class C deep
Loading

Problem: shallow rendering modules leak flag grammar across the seam, and Base fix guidance splits accepted Model labels into extra arguments.

Solution: deepen the Command line module's interface so one implementation owns public flag reconstruction and literal shell rendering; deleting it would redistribute that complexity across both callers.

Wins

  • Locality: flag grammar stays together
  • Leverage: both offers share implementation
  • Depth: semantic asks hide shell rules
  • Tests cross the production interface
  • No hypothetical adapter seam

Activity

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