oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1# Typed terminal answers
2
3Round 1 status: incomplete. The reported lost-input failure did not reproduce offline.
4This branch adds process-chain coverage and confirmation after a valid answer;
5it does not claim to fix the cause of Paul's live timeout.
6
7## Reproduction and findings
8
9The committed PTY test runs an interactive bash, the unchanged
10`scripts/try-equipo.sh`, `go run ./cmd/equipo-try`, the real wizard buffered
11prompt, `gateCommand`, the production `liveGateArgs`, `go test`, and the
12production `directlive.Run` / `delegateRunner` handoff. A fixture runner calls
13`exercise.answer`, `answerSource.answer`, and `terminalAnswer` and writes the
14normal person-answer artifacts. Go overlays replace account setup and the
15provider exercise. They add no production bypass and never open account homes.
16
17The feeder waits for each visible prompt and types individual characters and
18Return into a real PTY. It checks allow, deny, structured answers, a typo retry,
19an invalid answer object, and timeout. Valid answers must have person attribution
20in their artifacts. Invalid and expired answers must have no artifact or
21confirmation. The runner also checks that its process group owns the terminal.
22
23Before implementation, an immediate answer and a delayed, character-by-character
24answer both reached the reader through this chain. The missing confirmation,
25not the reported lost input, is the regression that failed on the base.
26
27An additional temporary fixture ran the existing full fake-CLI Engineering
28harness through the wizard and nested `go test`, with its answer callback changed
29to `terminalAnswer`. Both fake providers completed allow, deny and question
30controls, and all six artifacts said `answered_by: person`. The inner gate exited
31successfully in 62.961 seconds. The exploratory outer feeder returned failure
32because it looked for `PASS`, which the successful outer package-mode `go test`
33suppressed. Its transcript instead ended with the provider package's `ok` line.
34The committed feeder checks exit status and explicit fixture completion instead.
35The temporary fake-provider changes were removed.
36
37Read-only inspection of the still-running real chain found the guide, Go tools,
38test binary and runner in foreground process group 329465 on pts/5. The terminal
39had ICANON, ICRNL and ECHO enabled. A later snapshot found no thread blocked in
40read/readv in the guide, Go test, test binary or runner, and no extra terminal
41reader among their session descendants. These are current snapshots, not proof
42of the state when the earlier answer was lost.
43
44The offline evidence therefore does not establish a competing reader, background
45process group, flush race, nonblocking-descriptor problem, canonical-mode problem,
46or Go output-buffering problem as the cause. The prompt uses `/dev/tty` and was
47visible before input despite Go's captured test output. Existing raw-terminal
48and stale-input tests also pass. No speculative process-group or terminal-mode
49change was made.
50
51## Changes
52
53`terminalAnswer` prints `Answer received.` only after reading a complete answer,
54checking the context, and validating the answer against the question. The message
55confirms receipt and validation; it does not claim provider execution or delivery.
56The new catalog entry is individually marked `COPY REVIEW PENDING`. The unused
57old `live.beyond-profile` message was removed. No copy-review server was started,
58and no README was changed.
59
60## Verification
61
62Before implementation:
63
64```
65CGO_ENABLED=0 go test ./internal/tryequipo -run '^TestTerminalAnswerProcessChain$' -count=1 -v
66```
67
68Failed at the second prompt with `missing or premature answer confirmation`.
69The first typed answer had already reached the reader.
70
71After implementation:
72
73```
74CGO_ENABLED=0 go test ./internal/tryequipo ./internal/directlive -run '^Test(TerminalAnswerProcessChain|ControlTerminal|TerminalRetry|TerminalProbe|AnswerSources)' -count=1
75```
76
77Passed: tryequipo 3.574 seconds, directlive 3.200 seconds. This includes the
78existing CR, LF, CRLF, stale-input, typo, deadline and answer-validation checks.
79
80Each mutation below used the process-chain command above. Source was restored
81immediately after each run.
82
83| Deliberate fault | Result |
84| --- | --- |
85| Print confirmation before the prompt | Failed: premature confirmation |
86| Skip terminal answer validation | Failed: invalid object was confirmed |
87| Print confirmation when the read times out | Failed: expired answer was confirmed |
88| Start the gate in a separate background process group | Failed: reader is not in the foreground |
89
90A fifth experiment changed the terminal timeout return to nil without printing
91confirmation. That mutation survived because `answerSource.answer` independently
92checks the expired context and rejects the answer. This is not evidence that the
93terminal timeout return is independently guarded by the end-to-end test.
94
95One full `make -k ci` ran and exited 2. It found two failures introduced by
96this change: the new catalog entry exceeded the app's source budget by one
97line, and the entry was absent from the consolidated copy-review inventory.
98Removing the unused old message fixed the size budget. Adding the pending entry
99to `CONTROLLER-REPORT-plan-3.md` fixed the inventory. No budget was increased
100and no pending copy was marked approved.
101
102The following focused rechecks passed after both corrections:
103
104```
105make budget fmt-check
106CGO_ENABLED=0 go test ./internal/plan3test -run '^TestPlan3ReleaseBoundaries$' -count=1
107CGO_ENABLED=0 go test ./internal/tryequipo ./internal/directlive -run '^Test(TerminalAnswerProcessChain|ControlTerminal|TerminalRetry|TerminalProbe|AnswerSources)' -count=1
108```
109
110Budget: 39 directories within limits. Release-boundary tests: 0.821 seconds.
111Terminal checks: tryequipo 4.278 seconds, directlive 3.139 seconds. The full gate
112was not rerun. Its remaining lanes passed: reference scan, build, vet, formatting,
113staticcheck, vulnerability scan, secret scan, other test packages, adapter and
114namespace tests, migrations and performance. Cold boot median was 119 ms against
115500 ms; every screen was below its 150 ms budget.
116
117The full suite reported timing overruns in runner (343.161 s / 330 s), provider
118(20.777 s / 15 s), Claude (47.291 s / 45 s), and Codex (39.060 s / 35 s). They are
119notes locally and failures under CI timing enforcement. These existing timing
120budgets were not changed. This report does not claim a clean full CI invocation.
121
122## Remaining work
123
124The root cause and a regression that reproduces Paul's actual timeout remain
125unresolved. I asked which terminal he used and how long elapsed between the
126prompt and Return. No answer arrived during this task. A live
127provider rerun was outside this brief's authorization, so none was attempted.
128
129No production account files were changed and no real provider was launched.
130Only read-only process metadata, terminal settings and selected saved evidence
131were inspected. The PTY fixtures clean up their private sessions. Fixture builds and audit
132logs were removed before handoff; no process started by this task remains.
133The user-provided worktree was retained. No merge or deployment was performed.
134
135## Round 2
136
137The round-two brief replaces the request to diagnose the earlier lost-input
138report with changes to timing, person-proof retries and proposed funding. These
139changes are verified offline. They do not establish the cause of that live run's
140lost-input report.
141
142### Timing and retry
143
144Person answer sources now allow five minutes; automatic sources still allow one
145minute. The terminal reader uses the source's context, removing its separate
14660-second limit. Earlier cancellation and the authorized run deadline still win.
147The default run deadline remains 7,200 seconds. Provider tool deadlines are ten
148minutes: Claude's explicit settings contain `MCP_TOOL_TIMEOUT=600000`, and Codex's
149Equipo MCP settings contain `tool_timeout_sec=600`. Both settings are included in
150the existing policy hashes and validation. Codex's policy serializer now handles
151integer TOML values. No provider binary was launched to inspect these options;
152the installed binaries were read for the setting names.
153
154The terminal prints `The request expired. This check will be retried or failed.`
155once on deadline expiry. `Answer received.` remains after validation only. The
156prompt now says five minutes. All three entries are individually marked
157`COPY ACCEPTED FOR NOW (Paul, 2026-11-05; iterate in context)` under the brief's
1582026-11-04/05 ruling. The consolidated inventory and its acceptance check include
159them. No copy-review server was started and README prose is unchanged.
160
161The driver no longer consumes a provider's person-proof opportunity when choosing
162a tuple. After completing a tuple, it validates the saved person proof before
163switching later tuples to automatic answers. A failed tuple, invalid proof or
164missing answer leaves the next specialist eligible. Coordinator and recovery
165workers remain automatic. Certification still requires a passing person-answered
166tuple for each provider; earlier failures remain failures in the run report.
167
168The new fake-CLI driver scenario uses both providers and four specialist tuples:
169Review expires, Engineering returns an invalid answer, Copy passes with person
170answers, and Design uses automatic answers. It checks saved proof, attribution,
171answer counts and the four retained tuple failures. Existing successful-run
172coverage still checks that later tuples do not prompt again.
173
174### Funding arithmetic
175
176Evidence was read only from
177`/home/paulca/.local/share/equipo/try/run-4024280761/evidence` on 2026-11-05.
178The run was still accumulating evidence. The calculation below uses the observed
179snapshot; unfinished tuples are estimates, not zero usage or certified results.
180
181For rows with `23-reservations-per-job.json`, the needs are 23 times that file's
182input and output reservations. For Claude Engineering and Coordinator, the same
183formula is applied to the completed `turn-*.json` usage frames, including cache
184creation and cache reads. Codex's completed token-usage frames use the `last`
185input/output counts. Each reservation is twice the largest sample, rounded up
186to the next 1,000 tokens, then multiplied by 23.
187
188| Tuple | Input need | Output need |
189| --- | ---: | ---: |
190| Claude Engineering | 17,986,000 | 184,000 |
191| Claude Engineering-reproduction | 14,375,000 | 184,000 |
192| Claude Review | 11,040,000 | 161,000 |
193| Claude Product | 11,270,000 | 161,000 |
194| Claude Scope | 11,684,000 | 184,000 |
195| Claude Research | 11,247,000 | 161,000 |
196| Claude Investigation | 9,568,000 | 161,000 |
197| Claude Copy | 11,546,000 | 184,000 |
198| Claude Design | 18,308,000 | 184,000 |
199| Claude Coordinator | 414,000 | 23,000 |
200| Codex Engineering, partial | 437,000 | 23,000 |
201| Codex Engineering-reproduction, partial | 391,000 | 23,000 |
202| Observed sum | 118,266,000 | 1,633,000 |
203
204The maximum input need is 18,308,000. Three times that is 54,924,000, rounded
205up to 60,000,000 for JobInput and both input headrooms. The maximum output need
206is 184,000; three times that is 552,000. JobOutput and both output headrooms
207retain the required 1,150,000 floor.
208
209For the full 19-tuple family, the seven missing tuples and both partial Codex
210rows are provisioned at the largest observed need, 18,308,000 input and 184,000
211output. The Claude row sums are 117,438,000 input and 1,587,000 output. The full
212bounds are `(117,438,000 + 9 × 18,308,000) × 3 = 846,630,000` input and
213`(1,587,000 + 9 × 184,000) × 3 = 9,729,000` output. The proposed calibration
214bounds are 900,000,000 input, rounded up to the next 100 million, and the existing
21516,000,000 output. These conservative reservation sums are bounds, not predicted
216spend. They exceed the observed charged totals as well as the measured usage sums.
217
218The old 11,500,000 input, 1,150,000 output, 100,000,000 total input and 16,000,000
219total output defaults are in the re-propose lists. The output proposals currently
220remain the same. Custom values remain selected, and the person must authorize the
221displayed limits before any live run.
222
223### Verification
224
225Before implementation, the focused tests failed for the one-minute person limit,
226missing expiry notice, missing provider tool deadlines and old funding bounds.
227`TestControlSourcesRetryUntilPass` failed with
228`Engineering lost person retry: automatic`. The first full fake-driver attempt
229also caught the shortened person deadline. A later development run caught missing
230integer TOML support; that serializer correction is included above.
231
232The combined driver run passed in 211.320 seconds, including both
233`TestPersonProofRetryFakeCLI` and `TestFewerPromptsFakeCLI`. That invocation also
234found the missing inventory row for the changed prompt; the row was added and
235the inventory check passed on rerun.
236
237After restoring all deliberate faults, this focused command passed:
238
239```sh
240CGO_ENABLED=0 go test ./internal/directlive ./internal/tryequipo ./internal/runner/provider/claude ./internal/runner/provider/codex ./internal/plan3test -run '^Test(ControlSources|PersonAnswerHasFiveMinutes|AnswerSources|TerminalAnswerProcessChain|FundingProposedDefaults|PersonControlProviderTimeout|Plan3ReleaseBoundaries)' -count=1
241```
242
243Times: directlive 0.113 s, tryequipo 3.830 s, Claude 0.223 s, Codex 0.207 s,
244plan3test 0.785 s. The five-minute source test uses Go's virtual clock; expiry is
245also checked through the real terminal process chain with a shortened parent
246context. No test sleeps for five minutes.
247
248Each mutation below failed, then its source was restored. Each command starts
249with `CGO_ENABLED=0 go test`, ends with `-count=1`, and uses the listed package
250and `-run` selector.
251
252| Deliberate fault | Package and selector | Observed failure |
253| --- | --- | --- |
254| Person limit back to one minute | `./internal/directlive -run '^TestPersonAnswerHasFiveMinutes$'` | Person expired after 1m, wanted 5m |
255| Automatic limit raised to five minutes | Same command | Automatic expired after 5m, wanted 1m |
256| Consume proof when selecting a tuple | `./internal/directlive -run '^TestControlSourcesRetryUntilPass$'` | Engineering lost person retry |
257| Suppress deadline notice | `./internal/tryequipo -run '^TestTerminalAnswerProcessChain$'` | Missing expiry notice |
258| Claude MCP timeout back to 60 seconds | `./internal/runner/provider/claude -run '^TestPersonControlProviderTimeout$'` | Provider tool timeout must exceed five minutes |
259| Codex MCP timeout back to 60 seconds | Same selector in `./internal/runner/provider/codex` | Provider tool timeout must exceed five minutes |
260| Input job/headroom proposals back to 11.5 million | `./internal/tryequipo -run '^TestFundingProposedDefaults$'` | Funding mismatch |
261| Omit 11.5 million from the legacy list | Same command | Saved round-one funding was retained |
262
263`make budget` passed for all 39 directories. A blank line beside the changed
264catalog entries was removed to keep the existing 10,800-line source ceiling;
265no budget was increased. `git diff --check` passed.
266
267
268The provider timeout settings change policy fingerprints. This offline work does
269not issue a certificate for either real provider; a separately authorized live
270run must collect fresh evidence. No existing production evidence or account file
271was modified. No merge, default-branch push or deployment was performed.
272
273The first full `CGO_ENABLED=0 make -k ci` exited 2. Besides the formatting issue,
274it found two stale policy-inventory tests and an existing PTY reap race. All
27518 portable inventory hashes were updated to match the timeout settings; every
276entry remains `uncertified`, and the certificate lists remain empty. The PTY
277feeder now waits for the child after terminal closure, within the original
278three-second deadline. Previously it could read `PASS`, receive terminal EOF,
279then fail because a nonblocking wait had not yet reaped the child.
280
281The focused correction check passed:
282
283```sh
284CGO_ENABLED=0 go test ./internal/directlive ./internal/release -run '^Test(MergedPlanPolicyInventory|PlanWorkflowReleasePolicyInventory|TerminalRetryDeadlineAndValidObject)$' -count=1
285make fmt-check budget
286```
287
288Directlive took 0.899 s; release took 0.004 s. The first full run's remaining
289lanes passed, including adapter/namespace tests, migrations and performance.
290Cold boot was 103 ms against 500 ms; every screen was within 150 ms. It reported
291existing timing-budget overruns in runner (357.469 s / 330 s), provider
292(20.710 s / 15 s), Claude (46.596 s / 45 s), and Codex (39.045 s / 35 s). These
293are local notes and become failures with CI timing enforcement. The new full
294directlive suite took 318.087 s against its unchanged 360 s ceiling.
295
296One permitted full rerun of `CGO_ENABLED=0 make -k ci` exited 0. All 29 test
297packages passed, along with build, vet, formatting, staticcheck, vulnerability
298and secret scans, size budgets, adapters, namespaces, migrations and performance.
299Directlive took 324.969 s against 360 s, including the retry regression. Cold boot
300was 101 ms; all screen checks stayed below 150 ms.
301
302The rerun retained timing warnings: runner 358.634 s / 330 s, provider 20.616 s /
30315 s, Claude 46.095 s / 45 s, Codex 38.686 s / 35 s, and tryequipo 11.503 s /
30410 s. The command passed locally; these overruns would fail with CI timing
305enforcement. No timing budget was raised. There were two full gate invocations
306in total, with no second rerun.
307
308Task scratch and logs were removed after their results were recorded here.
309All task test processes exited. The user-provided worktree remains in place.
310
311## Round 3
312
313Every live-gate control now uses the automatic answer source, including the first
314specialist tuple of each provider, later tuples and recovery workers. Answers
315retain the existing relay, validation and one-minute automatic deadline, bounded
316by the run deadline, and record `answered_by: "automatic"`.
317
318The terminal answer reader had no other production caller. It and its person
319source, proof retries, proof artifacts and unused copy entries were removed.
320The candidate builder, Go evidence code and Python release checker no longer
321require `person-answered-controls`. No substitute requirement was added.
322All existing per-tuple control requirements remain in
323`internal/runner/provider/direct_requirements.json`, unchanged.
324
325The guide now says answers are automatic and real tasks are approved in Equipo's
326app or API. Its sign-in, account totals, limits and RUN LIVE GATE confirmations
327remain. The two guide sentences use the brief's accepted-copy ruling. No
328copy-review server was started; README prose and production account files were
329not changed. All provider exercises used offline fixtures.
330
331### Reproduction and focused verification
332
333Before implementation, these commands failed:
334
335```sh
336CGO_ENABLED=0 go test ./internal/directlive ./internal/equipotest -run '^(TestEveryControlSourceAutomatic|TestCandidateAcceptsAutomaticControls|TestDirectReleaseRequiresCertification/release/clean)$' -count=1
337CGO_ENABLED=0 go test ./internal/equipotest -run '^TestDirectReleaseRequiresCertification$/^release$/^clean$' -count=1
338```
339
340The source-selection test reported person answers for every initial specialist.
341The candidate builder rejected evidence without person proof. The Python release
342checker rejected the clean packaging fixture after its person proof was removed.
343The combined command selected the first two tests; its packaging pattern matched
344no tests, so the separate command above was run.
345
346The process-chain test still runs the real shell, guide, wizard prompt, Go test
347command, `directlive.Run` and runner delegation. Its feeder types only RUN LIVE
348GATE. Automatic allow, deny and structured answers must arrive with automatic
349attribution; invalid and expired answers must leave no answer artifact.
350
351```sh
352CGO_ENABLED=0 go test ./internal/directlive -run '^TestAutomaticControlsFakeCLI$' -count=1 -v
353```
354
355Passed in 73.193 seconds. Both fake providers completed Review and Engineering
356through the production relay. Every answer artifact had automatic attribution;
357all seven control observations passed for all four tuples.
358
359The focused suite also covers automatic source selection and fallback, validation,
360deadlines, candidate acceptance, missing/failed/tampered per-tuple controls,
361release packaging, routing approvals and the copy inventory. Early verification
362found remaining test-only references to the removed driver callback, unstaged
363file deletions in the packaging fixture's tracked-file copy, and an exclusive
364create in the candidate mutation fixture. These were corrected before CI.
365
366### Mutation verification
367
368Each command below uses `CGO_ENABLED=0 go test`, the package and `-run` pattern
369shown, and `-count=1`. Each deliberate fault failed its test, then the source was
370restored.
371
372| Deliberate fault | Package and pattern | Observed failure |
373| --- | --- | --- |
374| Record the automatic source as person | `./internal/directlive -run '^TestEveryControlSourceAutomatic$'` | Wrong attribution |
375| Skip answer validation | `./internal/directlive -run '^TestAnswerSourcesShareValidationAndDeadline$'` | Invalid answer accepted |
376| Read after context expiry | Same command | Expired source read an answer |
377| Accept an answer returned after expiry | `./internal/directlive -run '^TestAutomaticAnswerDeadline$'` | Deadline error missing |
378| Extend the automatic timeout to two minutes | Same command | Wrong elapsed duration |
379| Remove all seven control requirements | `./internal/directlive ./internal/equipotest -run '^(TestCandidateRequiresEveryControl|TestReleaseRequiresEveryControl)$'` | All 21 candidate cases and all 28 packaging cases failed |
380
381The last mutation removed the requirements only from a temporary edit of
382`direct_requirements.json`. Candidate tests independently removed, failed or
383changed the hash of each control. Packaging tests independently removed or failed
384each control for both release targets. The requirement file was restored byte
385for byte; no weakened requirements remain.
386
387
388After restoring the mutations, this focused command passed:
389
390```sh
391CGO_ENABLED=0 go test ./internal/directlive ./internal/equipotest ./internal/tryequipo ./internal/plan3test -run '^(TestEveryControlSourceAutomatic|TestAnswerSourcesShareValidationAndDeadline|TestAutomaticAnswerDeadline|TestCandidate.*|TestCoordinatorManifestExclusion|TestAutomaticAnswerProcessChain|TestReleaseRequiresEveryControl|TestDirectReleaseRequiresCertification|TestPlan3ReleaseBoundaries|TestRouting.*|TestProbeAnswersWithoutHuman)$' -count=1
392```
393
394Directlive: 0.739 s; equipotest: 6.854 s; tryequipo: 1.437 s; plan3test: 0.882 s.
395
396### Full CI
397
398The first `make -k ci` found formatting in `internal/equipo/copy.go` after the
399unused entries were removed, and 13,217 equipotest lines against its existing
40013,200-line limit. Formatting was corrected. The new packaging cases were folded
401into the existing release table, and candidate/packaging control-failure setup
402was shared in `providertest`. The test now runs those cases under
403`TestDirectReleaseRequiresCertification`; no cases or size budgets were removed
404or raised.
405
406The first invocation exited 2. Its 29 test packages passed. Adapter, namespace,
407migration and performance checks passed too; cold boot was 104 ms against 500 ms,
408and all screens stayed below 150 ms. Timing warnings were runner 332.696 s / 330 s,
409provider 20.949 s / 15 s, Claude 48.461 s / 45 s and Codex 40.706 s / 35 s.
410These are warnings locally and failures under CI timing enforcement.
411
412After sharing the fixtures, removing the seven requirements again failed every
413candidate case and every control case for both release targets. This used:
414
415```sh
416CGO_ENABLED=0 go test ./internal/directlive ./internal/equipotest -run '^(TestCandidateRequiresEveryControl|TestDirectReleaseRequiresCertification)$' -count=1
417```
418
419The source was restored. `make budget fmt-check` passed with all 39 directories
420within budget, and the same focused test command passed on the restored source.
421
422The single rerun of `make -k ci` exited 0. All 29 test packages, build, vet,
423formatting, staticcheck, vulnerability scan, secret scan, size budgets, adapter
424checks, namespaces, migrations and performance passed. Directlive took 251.692 s
425against its 360 s budget. Cold boot was 105 ms; every screen stayed below 150 ms.
426
427Four timing warnings remain: runner 330.526 s / 330 s, provider 20.680 s / 15 s,
428Claude 47.598 s / 45 s and Codex 38.976 s / 35 s. The local command passed; these
429warnings would fail under CI timing enforcement. No timing budget was raised.
430There were two full CI invocations in total, with one rerun.
431
432No live provider gate, copy-review server, merge or deployment was started.
433The user-provided worktree is retained. Test processes exited; task scratch and
434logs are removed after recording their results in this report.
435