Skip to content

fix(bin): restore no-mistakes brief scaffolding - #1005

Closed
allstargg wants to merge 1 commit into
kunchenguid:mainfrom
allstargg:fm/fm-brief-upstream-regression
Closed

allstargg wants to merge 1 commit into
kunchenguid:mainfrom
allstargg:fm/fm-brief-upstream-regression

Conversation

@allstargg

Copy link
Copy Markdown
Contributor

Intent

Fix the current upstream Firstmate regression in bin/fm-brief.sh on live main b05eb24 where bin/fm-brief.sh firstmate cannot scaffold a no-mistakes ship task and Bash 3.2 reports an unmatched parenthesis around the definition-of-done command-substitution heredoc. Diagnose the exact apostrophe regression introduced by the ask-user authority wording and inspect relevant history before fixing it. Make the smallest syntax-safe correction while preserving the current authority boundary and no-mistakes pipeline ownership language. Add regression coverage that executes real no-mistakes ship scaffolding rather than relying only on textual assertions, and confirm the existing ask-user-authority generated-instructions failure is resolved. Validate bash syntax, the focused brief and authority tests, repository lint, and directly affected documentation checks. This correction is independent of PR #995 and must not modify that PR or its active validation run.

What Changed

  • Reword the no-mistakes authority warning to avoid the apostrophe that broke fm-brief.sh parsing and ship-brief scaffolding under Bash 3.2 while preserving Firstmate’s authority boundary.
  • Strengthen brief and ask-user-authority regression coverage by executing real no-mistakes scaffolding and verifying the generated pipeline and authority instructions.

Risk Assessment

✅ Low: Captain, the change is narrowly scoped, preserves the authority and pipeline-ownership language, and adds real no-mistakes scaffolding regression coverage with explicit failure detection.

Testing

Apple Bash 3.2 reproduced the base failure and accepted the target; focused brief, ask-user authority, instruction-owner, and documentation checks passed, and a real fm-brief.sh <id> firstmate invocation generated a no-mistakes ship brief preserving both the authority boundary and pipeline ownership language. Repository lint was not run because this testing task explicitly forbids linters and static analysis.

Evidence: Apple Bash 3.2 baseline failure and successful end-to-end ship scaffold transcript
User path: bin/fm-brief.sh <id> firstmate
Shell: GNU bash, version 3.2.57(1)-release (arm64-apple-darwin25)

Baseline syntax reproduction at b05eb244:
/bin/bash: line 314: unexpected EOF while looking for matching `)'
/bin/bash: line 388: syntax error: unexpected end of file
baseline exit: 2

Target syntax check at da7eca0:
target syntax exit: 0

End-user scaffold command:
FM_HOME=/var/folders/wz/856vlf5n4nl6fn086x3f23zm0000gn/T/no-mistakes-evidence/01KYB9CWFW57KNATDVZZE11T9D/fm-home bin/fm-brief.sh brief-upstream-regression-e2e firstmate
scaffolded: /var/folders/wz/856vlf5n4nl6fn086x3f23zm0000gn/T/no-mistakes-evidence/01KYB9CWFW57KNATDVZZE11T9D/fm-home/data/brief-upstream-regression-e2e/brief.md (ship, mode=no-mistakes; replace {TASK})

Generated brief: /var/folders/wz/856vlf5n4nl6fn086x3f23zm0000gn/T/no-mistakes-evidence/01KYB9CWFW57KNATDVZZE11T9D/fm-home/data/brief-upstream-regression-e2e/brief.md

Rendered no-mistakes authority and pipeline section:
You drive no-mistakes by responding to its gates, not by implementing fixes.
Follow the guidance no-mistakes itself provides for the mechanics: it loads when you invoke /no-mistakes, and `no-mistakes axi run --help` plus the `help` lines in each `axi` response are authoritative and version-matched to the installed binary.
Do not hand-edit, commit, or fix findings yourself while a run is active - the pipeline applies every fix.

Two firstmate-specific rules layer on top of that guidance:
- ask-user findings are never yours to answer: escalate to firstmate (rule 6) and stop.
  Firstmate applies the authority contract in its `AGENTS.md` and obtains any required captain decision.
  When the decision comes back, feed it to the gate with `no-mistakes axi respond` and let the pipeline apply it - do not route the question to "the user" or implement the fix yourself.
- Avoid `--yes`: it would silently bypass the authority check applied by firstmate and any required captain escalation.

After /no-mistakes reports CI green (the CI-ready return point - do not wait for it to keep monitoring in the background until merge), append `done: PR {url} checks green` and stop. You are finished.

Acceptance markers:
brief exists: yes
authority owner preserved: yes
pipeline ownership preserved: yes
syntax-breaking wording absent: yes
end-to-end exit: 0
Evidence: Generated no-mistakes ship brief
You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
{TASK}

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text that replaces `{TASK}` later.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Setup
You are in a disposable git worktree of firstmate, at a detached HEAD on a clean default branch.

**Verify isolation before anything else.** Run `pwd -P` and `git rev-parse --show-toplevel`; both must resolve to the disposable task worktree you were launched in, such as a treehouse pool path or an Orca-managed worktree, not the primary checkout firstmate operates from.
The path check is authoritative: `git rev-parse --git-dir` and `git rev-parse --git-common-dir` can help inspect the repo, but they do not prove you are outside the primary checkout.
If the top-level path is the primary checkout or not the worktree you were launched in, STOP - do not branch or commit here - append `blocked: launched in primary checkout, not an isolated worktree` to the status file and stop.

1. First action: create your branch: `git checkout -b fm/brief-upstream-regression-e2e`
2. Run `no-mistakes doctor`; if it reports the repo is not initialized here, run `no-mistakes init`.

# Rules
1. Never push to the default branch. Never merge a PR.
2. Stay inside this worktree; modify nothing outside it.
3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
4. Report status by appending one line:
   `echo "{state}: {one short line}" >> '/var/folders/wz/856vlf5n4nl6fn086x3f23zm0000gn/T/no-mistakes-evidence/01KYB9CWFW57KNATDVZZE11T9D/fm-home/state/brief-upstream-regression-e2e.status'`
   States: working, needs-decision, blocked, paused, done, failed.
   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
   would act on (setup done, bug reproduced, fix implemented, validation passed) and the
   needs-decision/blocked/paused/done/failed states. No step-by-step FYI progress lines;
   firstmate reads your pane for that.
   A mid-task `working:` line (including setup complete) is nonterminal: do not end the
   turn after it; continue the same stage until a defined `done:` gate under Definition of done.
   Use `paused: {why}` - distinct from `blocked:` - ONLY when you are deliberately idling on a
   known external wait you expect to clear on its own (an upstream release, a rate-limit reset,
   a scheduled window): firstmate then leaves your idle pane alone and rechecks it on a long
   cadence instead of treating it as a possible wedge. Use `blocked:` when you are stuck and need help.
5. If you hit the same obstacle twice, append `blocked: {why}` and stop; firstmate will help.
6. If a decision belongs above the implementation worker (product choices, destructive actions, ask-user findings),
   append `needs-decision: {summary of options}` and stop. Firstmate will apply the configured authority and reply with the decision.
   When firstmate replies or a blocker clears and you resume, append `resolved: {how it was decided or unblocked}` (add the same `[key=<slug>]` if you opened it with one) so the decision or blocker is durably closed and does not keep resurfacing.
7. Never stop, restart, or update the shared `no-mistakes` daemon - it is one instance serving
   every lane/home, so restarting it kills other lanes' in-flight pipeline runs. On ANY no-mistakes
   daemon error, append `blocked: {the daemon error}` and stop; only firstmate manages the daemon.

# Project memory
If `AGENTS.md` or `CLAUDE.md` already exists, or if this task produced durable project-intrinsic knowledge, run `/Users/gavin/.no-mistakes/worktrees/f04eccabf018/01KYB9CWFW57KNATDVZZE11T9D/bin/fm-ensure-agents-md.sh .` in the worktree.
Record only project knowledge useful to almost every future session.
For anything the codebase already shows, prefer a pointer to the authoritative file, command, or doc over copying the detail.
If you touch a project `AGENTS.md` that lacks `## Maintaining this file`, add that short self-governance section from `/Users/gavin/.no-mistakes/worktrees/f04eccabf018/01KYB9CWFW57KNATDVZZE11T9D/bin/fm-ensure-agents-md.sh` in the same pass.
Keep it proportionate: skip `AGENTS.md` edits for trivial tasks that produced no durable project knowledge.

# Definition of done
The task is complete only when committed on your branch.
When you believe it is complete, append `done: {summary}` to the status file and stop.
Firstmate will then instruct you to run /no-mistakes to validate and ship a PR.

You drive no-mistakes by responding to its gates, not by implementing fixes.
Follow the guidance no-mistakes itself provides for the mechanics: it loads when you invoke /no-mistakes, and `no-mistakes axi run --help` plus the `help` lines in each `axi` response are authoritative and version-matched to the installed binary.
Do not hand-edit, commit, or fix findings yourself while a run is active - the pipeline applies every fix.

Two firstmate-specific rules layer on top of that guidance:
- ask-user findings are never yours to answer: escalate to firstmate (rule 6) and stop.
  Firstmate applies the authority contract in its `AGENTS.md` and obtains any required captain decision.
  When the decision comes back, feed it to the gate with `no-mistakes axi respond` and let the pipeline apply it - do not route the question to "the user" or implement the fix yourself.
- Avoid `--yes`: it would silently bypass the authority check applied by firstmate and any required captain escalation.

After /no-mistakes reports CI green (the CI-ready return point - do not wait for it to keep monitoring in the background until merge), append `done: PR {url} checks green` and stop. You are finished.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • git show b05eb244ce10f83192a95457b5e2b15c49b4e763:bin/fm-brief.sh | /bin/bash -n — reproduced the unmatched-parenthesis regression
  • Base-script counterfactual replacing firstmate&#39;s authority check with the authority check applied by firstmate, piped to /bin/bash -n — exited successfully
  • git show ec09871 -- bin/fm-brief.sh and git log -S&#34;firstmate&#39;s authority check&#34; -- bin/fm-brief.sh — traced the regression to #945
  • /bin/bash -n bin/fm-brief.sh using Apple Bash 3.2
  • bin/fm-test-run.sh tests/fm-brief.test.sh tests/fm-ask-user-authority.test.sh
  • bin/fm-test-run.sh tests/fm-instruction-owners.test.sh tests/fm-documentation-audiences.test.sh
  • FM_HOME=&lt;evidence-home&gt; bin/fm-brief.sh brief-upstream-regression-e2e firstmate — generated and inspected a real no-mistakes ship brief
  • git status --short and transient-output directory inspection — confirmed testing left the worktree clean
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@allstargg allstargg closed this Jul 25, 2026
@eric-k-chu

Copy link
Copy Markdown

Device evidence for the changed menu (appended after the pipeline Test step)

The Test step reports the device scenarios as untested because the pipeline validates on JVM/CLI only. I had already driven this surface on a throwaway emulator before handing off, so here is that run against this change.

  • Device: API 35 google_apis x86_64 AVD on emulator-5576 (KVM), debug APK built from this branch.
  • Entry: adb shell am start -n com.tantalim.mobile/.debugtools.ScenarioEntryActivity --es scenario_id accounts.detail.chrome --es environment local (the located QA fixture this PR adds).
  • Action: android input tap --device=emulator-5576 "desc=More", then android layout and android screen capture.

Before — main's menu on the same located fixture: Locations is a plain text line with no icon that does nothing when tapped; Show on Canvass / Get Directions sit under it with no group separator.

After — this branch: no Locations line. Show on Canvass and Get Directions keep their icons in their own divided group, and Delete Account keeps its own divider with the destructive icon.

Layout JSON confirms the same thing: the popup window no longer contains a bare Locations node, and both location rows are still CLICKABLE. gh here has no attachment write access, so the PNGs and android layout dumps live in the task evidence directory (/home/kiyuen/firstmate/data/tech-6850-account-menu-icons/proof/: before-menu.png, menu.png, before-menu-layout.json, menu-layout.json) for the captain's Linear post.

This covers the ticket's device-facing acceptance rows: the menu paints only icon rows, no Locations node exists once More is open, and the add-event / Send MyCard top-bar icon actions plus Delete are unchanged by this diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants