| 1 | # Native stopped work |
| 2 | |
| 3 | Branch: `native/stopped-work`, based on `origin/main` at `2950f604`. |
| 4 | |
| 5 | ## Behavior |
| 6 | |
| 7 | - Native carries all 70 `work.reason.*` entries, the stopped lead, and the |
| 8 | reviewed Needs you/held words. `check-parity.py` checks values and completeness. |
| 9 | - Stopped work leads with its finished time in the device's zone and the web's |
| 10 | reason, including the web's `no_further_changes` distinction. Retry requires |
| 11 | the creator and a terminated failed step. The 409 `not_retryable` answer uses |
| 12 | `api.not_retryable` and the screen refreshes after the action. |
| 13 | - Run now retains its offer/revision contract. Resume resolves the held runner, |
| 14 | local connection and provider against the person's connections and sends the |
| 15 | observed `pause_revision`. Settings actions use the web's exact destinations. |
| 16 | - iPhone uses SFSafariViewController; Mac uses WebKit's native SwiftUI WebView |
| 17 | in a sheet (macOS 26 minimum). Browser sessions persist independently of the |
| 18 | API bearer. With no browser session, the site asks the person to sign in. |
| 19 | - Failed steps load their stored log on disclosure. The selectable monospaced |
| 20 | view wraps by character on iPhone and scrolls horizontally on Mac, bounded |
| 21 | to 200 lines and 32 KiB. Its height fits the content up to 180 points, then |
| 22 | scrolls vertically. UIKit selection preserves the original log text. This is the same |
| 23 | runner-redacted stored tail/output that the web uses; it never fetches a raw |
| 24 | runner file or introduces a new endpoint. |
| 25 | - StepLog resolves the parent through `loadTask` and `taskView`, within the |
| 26 | current-roster checked read transaction used by Task. Tasks remain team-visible. |
| 27 | The controller confirmed this on 2026-11-25: the negative cases are an absent |
| 28 | or unreadable parent and revoked membership, not a creator-only read rule. |
| 29 | - No new GET route: the existing `/api/v1/steps/{id}/log` perf record remains. |
| 30 | The existing chat size exemption increases by the measured authorization and |
| 31 | regression-test lines, with its reason updated. |
| 32 | |
| 33 | ## Copy |
| 34 | |
| 35 | All web strings are copied unchanged (only `%s` becomes Foundation's `%@`). |
| 36 | `native.step.log_tail` = “Last lines of the log”, disclosure label: **approved |
| 37 | by Luna, 2026-11-25**, delivered by the controller in message |
| 38 | `9e9de3e8-cb73-4bfd-9e2b-0c04d16fe3dd`. Also marked at its view call site. |
| 39 | There are no open copy questions. No whole-log or Copy action was added. |
| 40 | |
| 41 | ## Test-first evidence |
| 42 | |
| 43 | Before implementation: |
| 44 | |
| 45 | ``` |
| 46 | swift test --package-path native/apple --filter StoppedWorkTests |
| 47 | ``` |
| 48 | |
| 49 | Failed: `TaskPause.canRetry`, `StoppedReason`, and `StoppedWorkActions` did not |
| 50 | exist. The tests were written first for the reviewed words, local stop time, |
| 51 | creator/termination rules, Needs you leads and the 409 response. |
| 52 | |
| 53 | ``` |
| 54 | GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test ./internal/equipo/chat -run TestStepLogTaskVisibility -count=1 |
| 55 | ``` |
| 56 | |
| 57 | Failed: `missing_task` and `missing_project` each returned `private log` after |
| 58 | Task refused the parent. After implementation, all four cases passed. |
| 59 | |
| 60 | ``` |
| 61 | swift test --package-path native/apple --filter 'StoppedWorkTests|PausedTests' |
| 62 | ``` |
| 63 | |
| 64 | Passed initially: 16 tests, including request paths/bearer, Resume's exact connection and |
| 65 | pause revision, bounded log and retained redaction marker. |
| 66 | |
| 67 | Final edge tests first failed (three issues) for optional triage.reason, a |
| 68 | step-less direction lead, and Retry on a blocked review. After correction, |
| 69 | `swift test --package-path native/apple --filter 'StoppedWorkTests|PausedTests'` |
| 70 | passed all 18 tests. The final full native gate passed 217 tests. |
| 71 | |
| 72 | ## Deliberate guard mutations |
| 73 | |
| 74 | Each mutation was restored immediately after its targeted test failed. |
| 75 | |
| 76 | | Mutation | Command | Result | |
| 77 | | --- | --- | --- | |
| 78 | | Ignore parent task and taskView errors in StepLog | Go command above | Failed `missing_task`, `missing_project`: leaked tail | |
| 79 | | Ignore CurrentPerson refusal in StepLog | Go command above | Failed `revoked_member`: leaked tail | |
| 80 | | Return wrong words for all reason codes | `swift test --package-path native/apple --filter StoppedWorkTests` | Failed 72 expectations, including every reviewed reason and stopped lead | |
| 81 | | Remove creator predicate from canRetry | Same Swift command | Failed non-creator retry assertion | |
| 82 | | Remove terminated predicate from canRetry | Same Swift command | Failed unterminated-step retry assertion | |
| 83 | | Return success for 409 not_retryable | Same Swift command | Failed reviewed conflict-message assertion | |
| 84 | | Remove log byte bound | Same Swift command | Failed 32 KiB assertion | |
| 85 | | Remove runner predicate from Resume matching | Same Swift command | Failed connection identity / request assertions | |
| 86 | |
| 87 | ## Gates and captures |
| 88 | |
| 89 | - `native/scripts/check-native.sh`: passed string/schema/differential checks, |
| 90 | 217 Swift tests in 26 suites (one existing known issue), Mac build and iPhone |
| 91 | Simulator build. Repeated after visual/UTF-8 refinements and the controller |
| 92 | follow-up for character wrapping and content-sized log height. The recaptured |
| 93 | iPhone stopped screen shows complete branch/error lines with no empty fixed |
| 94 | log area; the Mac capture shows all four lines aligned at the top left. |
| 95 | - `GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build`: |
| 96 | Linux build plus the Make target's Darwin runner cross-build passed. |
| 97 | - `make fmt-check spacing budget migration-check` with the Go 1.26.11 |
| 98 | GOROOT/bin prepended to PATH: passed (budget after its measured adjustment). |
| 99 | - Staticcheck v0.7.0: installed as a host executable, then run with |
| 100 | `GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 staticcheck |
| 101 | -tags browser,perf,testbuild ./...`: passed. `make staticcheck` with GOOS set |
| 102 | tries to execute a Linux tool on macOS, so the host tool is necessary. |
| 103 | - `make gitleaks`: passed, no leaks. |
| 104 | - Local `make build`, `make vet`, `make govulncheck`, `make test`, and `make perf` |
| 105 | hit the existing macOS toolproxy `unix.O_PATH` build error. The broad test |
| 106 | run also reported unavailable runner-install fixtures, a 15-minute thin |
| 107 | runner test timeout, and browser failures because Chromium is absent (147 |
| 108 | browser tests failed). These are not treated as passes or suppressed; Linux |
| 109 | hub CI is the gate. Perf's screen/boot tests themselves ran. |
| 110 | - Targeted Go authorization/paused tests passed after mutation restoration. |
| 111 | |
| 112 | The isolated simulator is named `Equipo Stopped Work`. Both platforms use |
| 113 | `StoppedWorkFixture`, compiled only in Debug, with an in-memory account and |
| 114 | an offline transport at fixture.invalid. It never reads saved credentials, |
| 115 | contacts a server, or bypasses authentication. The Mac fixture disables its |
| 116 | updater so a previously downloaded published app cannot replace the debug |
| 117 | build during capture; normal app launches retain their updater. `EQUIPO_STOPPED_FIXTURE=stopped` |
| 118 | and `paused` select the two task states. Debug's stopped fixture expands the |
| 119 | real log disclosure so the capture includes the actual bounded log view. |
| 120 | |
| 121 | Mac screen recording is unavailable on this host; the debug fixture captures |
| 122 | its own actual NSWindow content using AppKit's cacheDisplay. It does not render |
| 123 | another mockup or read another app. `EQUIPO_FIXTURE_CAPTURE` names the PNG path. |
| 124 | |
| 125 | Screenshots are saved in the audit site's `build/slice1` directory: |
| 126 | `iphone-stopped.png`, `iphone-paused.png`, `mac-stopped.png`, `mac-paused.png`. |
| 127 | Post-commit `python3 scripts/runner-dead-references.py`: passed, 2,719 text |
| 128 | files, 3,228 matches, zero failures. Push uses the requested normal |
| 129 | `agent-tools/push.sh <worktree> "native stopped work" origin native/stopped-work`. |
| 130 | Hub verdict is read with |
| 131 | `AMADAN_HOME="$HOME/.amadan-claude-agent" amadan ci status oficina/equipo -branch |
| 132 | native/stopped-work -json` redirected to a scratch JSON file; the final handoff |
| 133 | reports that verdict. No merge, deploy or release. |
| 134 | |
| 135 | ## Fable review follow-up (2026-11-25) |
| 136 | |
| 137 | The controller requested changes to `a0dbde6a`, before slice 2 proceeds. |
| 138 | Mac settings now use the default browser through `NSWorkspace.open`, with a |
| 139 | fixed-path allowlist and an injected-opener test. iPhone retains Safari; its |
| 140 | presentation is owned by the signed-in tab container, so a disappearing pause |
| 141 | cannot dismiss the page. This supersedes the original Mac WebKit choice above. |
| 142 | |
| 143 | AppKit's report/thinking hosts now measure their SwiftUI content after layout |
| 144 | changes, shift sibling content and subsequent rows by the height difference, |
| 145 | and preserve the person's scroll position. A real-window test grows and |
| 146 | shrinks content after mounting. Debug captures use the actual conversation: |
| 147 | Resume arrives after a delayed connections response; Try again calls the fake |
| 148 | endpoint and displays its failure. The next message remains below the report. |
| 149 | |
| 150 | Needs-you reasons offer Retry for a failed, terminated last step, creator only. |
| 151 | Recover uses the web's failed `machine_removed`, not-terminated, creator guards |
| 152 | and `POST /tasks/{id}/recover`. The held lead splits already-worded text at its |
| 153 | first colon. Resume reloads its connection and pause revision after refusal. |
| 154 | Run now returns reviewed failure words to the action view instead of swallowing |
| 155 | errors. Logs distinguish offline, malformed answers and other read failures. |
| 156 | Step details are one combined accessibility element; log disclosure is separate. |
| 157 | Both progress indicators have existing reviewed labels. Only `work.recover` |
| 158 | was added to copy, unchanged from the reviewed web entry and checked by parity. |
| 159 | |
| 160 | Test-first commands: |
| 161 | |
| 162 | - `swift test --package-path native/apple --filter StoppedWorkReviewTests`: |
| 163 | failed for absent Recover, log-error mapping and browser opener support. |
| 164 | - `swift test --package-path native/apple --filter ResizingHostTests`: |
| 165 | failed because the resizing host did not exist. |
| 166 | - `swift test --package-path native/apple --filter |
| 167 | 'ResizingHostTests|StoppedWorkReviewTests|StoppedWorkTests|PausedTests'`: |
| 168 | passed 30 tests after implementation. |
| 169 | |
| 170 | The review mutations each use |
| 171 | `swift test --package-path native/apple --filter StoppedWorkReviewTests`. |
| 172 | The mutation runner restores the original source in a `finally` block and |
| 173 | requires an actual expectation failure, not a compilation failure. |
| 174 | |
| 175 | All 14 review mutations failed assertions and were restored: |
| 176 | |
| 177 | | Removed or changed guard | Result | |
| 178 | | --- | --- | |
| 179 | | Needs-you retry creator (including review_blocked) | Non-creator retry assertion failed | |
| 180 | | Needs-you retry termination | Unterminated-step assertion failed | |
| 181 | | Update runner creator | Settings-path assertion failed | |
| 182 | | Raise budget creator (both branches) | Settings-path assertion failed | |
| 183 | | Resume creator | Resume-step assertion failed | |
| 184 | | no_further_changes mapping | Reason assertion failed | |
| 185 | | machine_removed unterminated branch | Recovery/tone assertion failed | |
| 186 | | Moving, stopping, copy-hold suppression | Transitional-task assertions failed | |
| 187 | | Triage restricted to rebasing only | Retrying/rechecking/waiting assertions failed | |
| 188 | | Resume spend.unknown match | Connection assertion failed | |
| 189 | | Resume local-id match | Connection assertion failed | |
| 190 | | Resume provider match | Connection assertion failed | |
| 191 | | Non-409 retry errors treated as success | Reviewed failure-message assertion failed | |
| 192 | | Held deadline condition | Deadline lead assertion failed | |
| 193 | |
| 194 | The first full gate found a timing assumption in the new resizing test: its |
| 195 | fixed 200 ms wait was too short under the full parallel suite. The test now |
| 196 | waits for each measured height with a bounded deadline, before changing the |
| 197 | next state. The runtime resizing code did not change for this correction. |
| 198 | |
| 199 | Final follow-up gate: `native/scripts/check-native.sh` passed 229 tests in 28 |
| 200 | suites (one pre-existing known issue), 206 parity strings, Mac build and iPhone |
| 201 | Simulator build. The two actual AppKit conversation captures were inspected: |
| 202 | `site/build/slice1/mac-conversation-resume.png` and |
| 203 | `site/build/slice1/mac-conversation-retry-failed.png`. The following message |
| 204 | stays below the enlarged report in both. No server code changed in this delta; |
| 205 | Linux hub CI remains the final gate, reported with the pushed SHA. |
| 206 | |
| 207 | ## Release follow-up, 2026-11-25 |
| 208 | |
| 209 | Branch `native/stopped-work-followups` starts at landed main |
| 210 | `94a3684e135674998b6337edf11aa0e717f18d82` in its own physical-TMPDIR worktree. |
| 211 | |
| 212 | Run now now selects the reviewed web sentence for each 409 code: |
| 213 | `offer_changed`, `already_running`, and `hold_bar`. All other errors use |
| 214 | `card.failed`. The two added catalog entries are copied byte-identically |
| 215 | from `internal/equipo/copy.go` and covered by the existing `api.*` parity |
| 216 | check. No new copy needs review. The log spinner keeps an accessibility label |
| 217 | without repeating the disclosure heading visibly. |
| 218 | |
| 219 | Test first: |
| 220 | `swift test --package-path native/apple --filter StoppedWorkReviewTests` |
| 221 | failed with six expectation failures before the Run now change, including all |
| 222 | three named codes, unknown/not-retryable codes, and an unstructured 409. |
| 223 | After implementation, the same command passed all 16 tests. New tests also |
| 224 | exercise Recover's creator/reason/termination guards on both needs-you and |
| 225 | stopped-step paths, both settings actions for non-creators, failed Recover |
| 226 | responses, and an unlisted own-origin settings path (`/evil`). |
| 227 | |
| 228 | Mutation command: |
| 229 | `python3 "$TMPDIR/stopped-followup-mutations.py"`. Each mutation runs that |
| 230 | same focused Swift command, requires an expectation failure (a compiler |
| 231 | failure does not count), and restores the source in a `finally` block. |
| 232 | |
| 233 | All eight deliberate mutations failed assertions and were restored: |
| 234 | |
| 235 | | Mutation | Result | |
| 236 | | --- | --- | |
| 237 | | Stopped-step Recover ignores creator | Caught | |
| 238 | | Needs-you Recover ignores machine_removed | Caught | |
| 239 | | Needs-you Recover ignores termination | Caught | |
| 240 | | Connect a model ignores creator | Caught | |
| 241 | | Check the machine ignores creator | Caught | |
| 242 | | Failed Recover returns success | Caught | |
| 243 | | Settings allowlist removed | Caught by /evil | |
| 244 | | Run now offer_changed uses retry sentence | Caught | |
| 245 | |
| 246 | The two settings actions were mutated separately, covering the six review |
| 247 | findings with seven guard mutations, plus the Run now wording regression. |
| 248 | |
| 249 | Release follow-up native gate: |
| 250 | `native/scripts/check-native.sh` passed: 234 tests in 28 suites with the |
| 251 | existing known issue, 208 strings matching the web, reference scan with zero |
| 252 | failures, Mac build, and iPhone Simulator build. No server code changed. |
| 253 | Post-commit reference scan and Linux hub CI are reported with the pushed SHA. |
| 254 | |