oficina / equipo Public

Fix read-only routing approvals and question ordering

Co-Authored-By: Astra <noreply@openai.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 80bad79935b25fae120d5acea20d2cc2791dd376 parent b3295e1
17 files changed, +349 −19
  • docs/superpowers/plans/CONTROLLER-REPORT-fewer-prompts.md +152 −0
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +2 −2
  • internal/directlive/answer_source.go +18 −0
  • internal/directlive/certification_gaps_test.go +2 −2
  • internal/directlive/inventory.go +3 −3
  • internal/directlive/routing_approval_test.go +55 −0
  • internal/directlive/routing_codex.go +2 −2
  • internal/directlive/routing_order.go +25 −0
  • internal/directlive/routing_order_test.go +19 −0
  • internal/directlive/tool_routing.go +12 −3
  • internal/directlive/tool_routing_test.go +18 −0
  • internal/equipo/copy.go +2 −2
  • internal/plan3test/plan3_release_test.go +2 −1
  • internal/runner/provider/direct_certification.go +12 −1
  • internal/runner/provider/isolation_boundary_test.go +16 −0
  • internal/runner/provider/providertest/isolation_test.go +5 −0
  • scripts/runner-release-check.py +4 −3

CI passed — run details

diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-fewer-prompts.md b/docs/superpowers/plans/CONTROLLER-REPORT-fewer-prompts.md
index 84601b6a..49c6fb3f 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-fewer-prompts.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-fewer-prompts.md
@@ -101,3 +101,155 @@ Delivery branch: `fewer-prompts`. Commit subject:
Commit body: `Co-Authored-By: Astra <noreply@openai.com>`.
The verification scratch was removed. No process started for this task remains
running. The branch is for controller review; deployment remains a human action.
+
+## Round 2
+
+The read-only Codex hang was a file-change approval waiting for a person.
+In Paul's read-only `run-1968907576` evidence, each of codex-Review,
+codex-Scope, codex-Research and codex-Investigation ends its routing turn at
+`item/fileChange/requestApproval`. The preceding item is an `apply_patch`
+update of `/workspace/equipo-routing-0`. Review's request identifies
+`call_dfbf641058eb4c7299ae257daac18f05`. Turn 5 completed; turn 6 never
+produced a completed artifact. The configured workspace was read-only.
+The routing answer handler handled questions automatically but fell through
+to the terminal for native approvals. This is separate from the expected
+unanswered person-control timeouts.
+
+Automatic probe expectations now select the automatic answer source for native
+approvals too. Read-only file changes receive `deny` through the existing
+validation and relay. Ordinary person controls retain their selected source.
+Answer-source attribution also inherits the active turn for proxy callbacks.
+No provider policy, sandbox or production authority check was relaxed.
+
+Routing completion, Go certification and the Python release checker now require
+`denied` for a read-only specialist's workspace write tool. Permitted workspace
+tools still require `pass`. A model decline without a write attempt does not
+prove the workspace refusal. Codex patch refusals require the matching call ID,
+path, update kind and completed file-change item with status `declined`.
+Uncorrelated results and successful writes cannot satisfy that row.
+
+Claude Review exposed a second defect. Its catalog lists `submit_review` before
+`ask_person`. The review submission occupies the broker's pending slot, so the
+following question is rejected before the answer callback. Saved evidence and
+the first focused Claude run both show that rejection. Claude Review exposes
+Read, Glob, Grep, Bash and its two Equipo tools; Write and Edit are absent.
+The routing prompt now puts `ask_person` first and requests sequential calls.
+The existing callback acknowledges the answered question before the submission.
+The other tools retain their order, including candidate before render.
+
+### Live launch log
+
+All times below are UTC on 2026-11-05. Launches were sequential and used only
+Paul's `paul@tito.io` bindings: Codex `codex` and Claude `claude-a`. Total model
+turns: **9 of 10 authorized**. Each launch used one catalog turn followed by
+workspace and outside routing turns.
+
+| UTC interval | Tuple | Turns | Result |
+| --- | --- | ---: | --- |
+| 16:51:01–16:52:03 | codex-Review | 3 | Catalog and routing passed; no person prompt |
+| 16:53:00–16:53:37 | claude-Review | 3 | Reproduced question rejection after review submission |
+| 16:55:31–16:56:15 | claude-Review | 3 | Final ordering passed every routing row; no person prompt |
+
+Codex discovered nine tools. Workspace outcomes were `denied` for apply_patch
+and `pass` for exec_command, list_mcp_resource_templates, list_mcp_resources,
+ask_person, submit_review, read_mcp_resource, view_image and write_stdin.
+All outside rows were `declined`, which is the existing accepted outside
+outcome. The write refusal passed through the production relay automatically. Its two
+answer artifacts record automatic denial of the patch and automatic allowance
+of the question. The final Claude question artifact also records automatic
+allowance.
+
+Final Claude outcomes were `pass` for all six exposed workspace tools and
+`denied` for all six outside rows. Its first focused run also left the outside
+Bash row uncertified because the debug harness had omitted the outer-isolation
+proof. The final harness ran the production direct isolation probe before
+routing. No parser allowance was added for that harness omission.
+
+The temporary harness used this branch's production leases, policy builder,
+launchers, journal, broker, answer relay and routing code. A Go overlay stopped
+the normal exercise after the focused phases. The answer callback failed on
+any person prompt. Disposable observations were debugging scratch: no full live
+gate, certification bundle, manifest candidate, generation or account-change
+exercise ran. The harness did not inspect credential contents, sign in, or
+change saved setup, bindings or Paul's evidence. Production leases staged the
+authorized credentials. The final Claude run included the attribution fix;
+Codex's successful run preceded that fix and the question-order change.
+
+### Tests and guard checks
+
+Before implementation:
+
+- `CGO_ENABLED=0 go test ./internal/directlive -run '^TestRoutingApprovalsNeverAskPerson$' -count=1` failed because native routing approvals called the person. Its later callback-attribution assertion also failed before that fix.
+- `CGO_ENABLED=0 go test ./internal/runner/provider -run '^TestRoutingReadOnlyWriteRefusal$' -count=1` rejected Review's expected refusal.
+- `CGO_ENABLED=0 go test ./internal/directlive -run '^TestRoutingQuestionPrecedesSubmission$' -count=1` failed with the question after the review submission.
+
+The restored targeted tests passed:
+
+```sh
+CGO_ENABLED=0 go test ./internal/directlive ./internal/runner/provider ./internal/runner/provider/providertest ./internal/equipotest -run 'TestRouting|TestReadOnlyPatch|TestToolRouting|TestCodexRouting|TestReleaseIsolation|TestControlSources|TestAnswerSources|TestPlan3ReleaseBoundaries|TestDirectReleaseRequiresCertification' -count=1
+CGO_ENABLED=0 go test ./internal/directlive -run '^TestDirectDriverFakeCLI/Review$' -count=1
+```
+
+The fake-driver Review test passed in 31.719s and exercised both providers.
+A temporary `TestRound2ClaudeReplay` read all 12 saved Claude routing artifacts.
+It confirmed five workspace passes, the rejected workspace question, four
+outside filesystem refusals and two outside MCP declines. The initial replay
+assertion expecting all workspace tools to pass failed on ask_person; the
+replay then checked that observed failure explicitly. No old evidence was
+changed or promoted to a passing certificate.
+
+Each guard below was disabled separately and restored. Every test failed for
+the intended behavior, without a compilation failure. Go mutations used
+`CGO_ENABLED=0 go test -overlay <overlay> <package> -run '<pattern>' -count=1`.
+The Python mutation was restored in a `finally` block and tested through Go.
+
+| Guard disabled | Package | Test | Observed failure |
+| --- | --- | --- | --- |
+| Automatic probe source | `./internal/directlive` | TestRoutingApprovalsNeverAskPerson | Person callback called |
+| Read-only write denial | `./internal/directlive` | TestRoutingApprovalsNeverAskPerson | Write or Edit allowed |
+| Active-turn attribution | `./internal/directlive` | TestRoutingApprovalsNeverAskPerson | Proxy callback attributed to a person |
+| Role-specific completion | `./internal/directlive` | TestRoutingCompletionUsesRole | Review's successful patch accepted |
+| Role-specific Go certification | `./internal/runner/provider` | TestRoutingReadOnlyWriteRefusal | Expected refusal rejected |
+| Patch result correlation | `./internal/directlive` | TestReadOnlyPatchRoutingRequiresCorrelatedRefusal | Wrong call ID accepted |
+| Question before submission | `./internal/directlive` | TestRoutingQuestionPrecedesSubmission | Submission retained the first broker slot |
+| Role-specific release certification | `./internal/runner/provider/providertest` | TestReleaseIsolationGuards | Expected refusal rejected |
+
+### Copy and delivery
+
+Both `live.answer-retry` and `CopyCalibrationFunding` now have the exact marker
+`// COPY ACCEPTED FOR NOW (Paul, 2026-11-05; iterate in context)`.
+Their current Plan 3 inventory rows record the same acceptance. This supersedes
+the pending status described in the earlier report. Runtime wording is unchanged.
+No copy-review server was started and README prose was left unchanged.
+
+The first full `make -k ci` completed with two test failures. The Plan 3 inventory
+validator did not recognize the new acceptance date for these two entries; its
+exception now names exactly those entries and Paul's exact marker. The other
+failure was `TestReviewExpiredAccountSignsIn/claude`, which returned
+`provider_account_busy`. It passed on an isolated rerun without account-code
+changes. All other lanes passed. The test step took 5m25.533s, directlive took
+4m9.612s and cold boot measured 105ms against 500ms.
+
+The repaired inventory gate passed with
+`CGO_ENABLED=0 go test ./internal/plan3test -run '^TestPlan3ReleaseBoundaries$' -count=1`.
+The account retry used
+`CGO_ENABLED=0 go test ./internal/tryequipo -run '^TestReviewExpiredAccountSignsIn$' -count=1`.
+
+The single full rerun, `make -k ci`, exited 0. All 29 tested packages and every
+other lane passed, including adapter checks, namespace checks, migrations and
+performance. The test step took 5m26.229s; directlive took 4m13.755s against its
+360s limit. Cold boot measured 100ms against 500ms. There were no called-code
+vulnerability findings or secret findings. Total full gate runs for Round 2:
+two, including one rerun.
+
+Provider timing warnings remain nonfatal locally: provider 20.509s against
+15s, Claude 45.710s against 45s, and Codex 38.199s against 35s. CI mode enforces
+those limits, so equivalent load on a remote runner could fail them. No timing
+allowance was raised.
+
+Delivery branch: `fewer-prompts`. Commit subject:
+`Fix read-only routing approvals and question ordering` (53 characters).
+Commit body: `Co-Authored-By: Astra <noreply@openai.com>`.
+The temporary harness, observations, binaries, overlays and logs were removed.
+No task process or server remains running. Go caches stayed at their defaults.
+No default-branch push, merge, release or deployment was performed.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 279687e1..5846b20a 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -5157,9 +5157,9 @@ records to satisfy a gate. Release remains blocked while any row is pending.
| `live.check-deny` | Equipo is checking that this is refused. Type Deny. | Guided live probe controls | COPY ACCEPTED FOR NOW (Paul, 2026-11-05; live-probe brief) |
| `live.check-allow` | Equipo is checking one-time approval. Type Allow once. | Guided live probe controls | COPY ACCEPTED FOR NOW (Paul, 2026-11-05; live-probe brief) |
| `live.check-question` | Equipo is checking that your answer reaches the agent. Enter an answers JSON object. | Guided live probe controls | COPY ACCEPTED FOR NOW (Paul, 2026-11-05; live-probe brief) |
-| `live.answer-retry` | Enter Allow once, Deny, or a valid JSON object. | Guided live control typo retry | COPY REVIEW REQUIRED |
+| `live.answer-retry` | Enter Allow once, Deny, or a valid JSON object. | Guided live control typo retry | COPY ACCEPTED FOR NOW (Paul, 2026-11-05; iterate in context) |
-| `CopyCalibrationFunding` | calibration funding is too low; rerun with JobInput=%d JobOutput=%d ProjectInputHeadroom=%d ProjectOutputHeadroom=%d TeamInputHeadroom=%d TeamOutputHeadroom=%d: %w | Direct isolation Round 3 | COPY REVIEW REQUIRED |
+| `CopyCalibrationFunding` | calibration funding is too low; rerun with JobInput=%d JobOutput=%d ProjectInputHeadroom=%d ProjectOutputHeadroom=%d TeamInputHeadroom=%d TeamOutputHeadroom=%d: %w | Direct isolation Round 3 | COPY ACCEPTED FOR NOW (Paul, 2026-11-05; iterate in context) |
## Task 21
diff --git a/internal/directlive/answer_source.go b/internal/directlive/answer_source.go
index 8ad87498..b6aed98a 100644
--- a/internal/directlive/answer_source.go
+++ b/internal/directlive/answer_source.go
@@ -2,6 +2,7 @@ package directlive
import (
"context"
+ "encoding/json"
"time"
"amadan.net/oficina/equipo/internal/runnerproto"
@@ -51,6 +52,23 @@ func expectedAnswer(ctx context.Context, q runnerproto.Question) (runnerproto.Qu
func (x *exercise) source(ctx context.Context) answerSource {
expectation, _ := ctx.Value(probeExpectationKey{}).(probeExpectation)
+ x.mu.Lock()
+ if expectation.control == "" && !expectation.automatic && x.answerContext != nil {
+ expectation, _ = x.answerContext.Value(probeExpectationKey{}).(probeExpectation)
+ }
+ x.mu.Unlock()
+ if expectation.automatic {
+ return answerSource{"automatic", func(ctx context.Context, q runnerproto.Question) (runnerproto.QuestionAnswer, error) {
+ var request struct{ Name string }
+ if json.Unmarshal(q.RawRequest, &request) != nil {
+ return runnerproto.QuestionAnswer{}, runnerproto.ErrInvalid
+ }
+ if x.launch.Policy.ReadOnlyWorkspace() && (request.Name == "Write" || request.Name == "Edit" || request.Name == "item/fileChange/requestApproval" || request.Name == "applyPatchApproval") {
+ return runnerproto.QuestionAnswer{Behavior: "deny"}, nil
+ }
+ return expectedAnswer(context.WithValue(ctx, probeExpectationKey{}, expectation), q)
+ }}
+ }
if expectation.control != "" && x.controlSource.read != nil {
return x.controlSource
}
diff --git a/internal/directlive/certification_gaps_test.go b/internal/directlive/certification_gaps_test.go
index 80943f62..7a8a43dd 100644
--- a/internal/directlive/certification_gaps_test.go
+++ b/internal/directlive/certification_gaps_test.go
@@ -131,14 +131,14 @@ func TestFinalCurrencyIncludesLateFrames(t *testing.T) {
}
func TestRoutingControls(t *testing.T) {
- if routingComplete(nil) {
+ if routingComplete(nil, "Engineering") {
t.Fatal("empty inventory certified")
}
for _, workspace := range []string{"pass", "declined", "not-exercisable", "not-certified", ""} {
for _, outside := range []string{"denied", "declined", "pass", "not-certified", ""} {
tools := []provider.LiveTool{{Name: "Read", Exposed: true, Routing: map[string]provider.LiveObservation{"workspace": {Status: workspace}, "outside": {Status: outside}}}}
want := workspace == "pass" && (outside == "denied" || outside == "declined")
- if routingComplete(tools) != want {
+ if routingComplete(tools, "Engineering") != want {
t.Fatalf("workspace=%s outside=%s", workspace, outside)
}
}
diff --git a/internal/directlive/inventory.go b/internal/directlive/inventory.go
index 8ec9f7df..9a05ea4b 100644
--- a/internal/directlive/inventory.go
+++ b/internal/directlive/inventory.go
@@ -13,7 +13,7 @@ func (x *exercise) inventory(ctx context.Context) error {
return err
}
expected := []string{}
- tested := routingComplete(x.evidence.Tools)
+ tested := routingComplete(x.evidence.Tools, x.evidence.Specialist)
missingRecorded := true
for _, tool := range x.evidence.Tools {
if !tool.Exposed {
@@ -55,14 +55,14 @@ func (x *exercise) inventory(ctx context.Context) error {
return nil
}
-func routingComplete(tools []provider.LiveTool) bool {
+func routingComplete(tools []provider.LiveTool, specialist string) bool {
exposed := 0
for _, tool := range tools {
if !tool.Exposed {
continue
}
exposed++
- if tool.Routing["workspace"].Status != "pass" {
+ if tool.Routing["workspace"].Status != provider.RoutingWorkspaceStatus(specialist, tool.Name) {
return false
}
status := tool.Routing["outside"].Status
diff --git a/internal/directlive/routing_approval_test.go b/internal/directlive/routing_approval_test.go
new file mode 100644
index 00000000..248cf067
--- /dev/null
+++ b/internal/directlive/routing_approval_test.go
@@ -0,0 +1,55 @@
+package directlive
+
+import (
+ "context"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/runner/provider"
+ "amadan.net/oficina/equipo/internal/runnerproto"
+)
+
+func TestRoutingApprovalsNeverAskPerson(t *testing.T) {
+ for _, tc := range []struct{ action, name, want string }{
+ {"review", "item/fileChange/requestApproval", "deny"},
+ {"scope", "applyPatchApproval", "deny"},
+ {"recommend", "Write", "deny"},
+ {"investigate", "Edit", "deny"},
+ {"implement", "Write", "allow"},
+ {"review", "Bash", "allow"},
+ } {
+ t.Run(tc.action+tc.name, func(t *testing.T) {
+ human := false
+ x := exercise{routing: true, root: t.TempDir(), answers: map[string]int{}, d: &driver{answer: func(context.Context, runnerproto.Question) (runnerproto.QuestionAnswer, error) {
+ human = true
+ return runnerproto.QuestionAnswer{Behavior: "allow"}, nil
+ }}, launch: provider.Launch{Policy: provider.Policy{Manifest: marshal(map[string]string{"action": tc.action})}}}
+ ctx := withProbeExpectation(context.Background(), "allow")
+ q := runnerproto.Question{ID: "approval", Kind: "tool", RawRequest: marshal(map[string]any{"name": tc.name, "direct": true, "provider": "claude"})}
+ a, err := x.answer(ctx, q)
+ if err != nil || human || a.Behavior != tc.want {
+ t.Fatalf("answer=%+v err=%v person=%v want=%s", a, err, human, tc.want)
+ }
+ x.answerContext = ctx
+ if x.source(context.Background()).answeredBy != "automatic" {
+ t.Fatal("relay attribution is not automatic")
+ }
+ })
+ }
+}
+
+func TestRoutingCompletionUsesRole(t *testing.T) {
+ for _, role := range []string{"Review", "Scope", "Research", "Investigation", "Engineering"} {
+ for _, tool := range []string{"apply_patch", "exec_command", "mcp__equipo__submit_review"} {
+ for _, status := range []string{"pass", "denied", "declined", "not-certified", ""} {
+ want := "pass"
+ if role != "Engineering" && tool == "apply_patch" {
+ want = "denied"
+ }
+ tools := []provider.LiveTool{{Name: tool, Exposed: true, Routing: map[string]provider.LiveObservation{"workspace": {Status: status}, "outside": {Status: "declined"}}}}
+ if routingComplete(tools, role) != (status == want) {
+ t.Fatalf("%s/%s/%s: wrong completion", role, tool, status)
+ }
+ }
+ }
+ }
+}
diff --git a/internal/directlive/routing_codex.go b/internal/directlive/routing_codex.go
index cb9b4cde..8d578658 100644
--- a/internal/directlive/routing_codex.go
+++ b/internal/directlive/routing_codex.go
@@ -5,7 +5,7 @@ import (
"strings"
)
-func codexRoutingPositive(frames [][]byte, tool, path string) bool {
+func codexRoutingResult(frames [][]byte, tool, path, status string) bool {
calls := map[string]bool{}
for _, raw := range frames {
var v struct {
@@ -46,7 +46,7 @@ func codexRoutingPositive(frames [][]byte, tool, path string) bool {
}
}
}
- if tool == "apply_patch" && v.Method == "item/completed" && b.Type == "fileChange" && calls[b.ID] && b.Status == "completed" && len(b.Changes) == 1 {
+ if tool == "apply_patch" && v.Method == "item/completed" && b.Type == "fileChange" && calls[b.ID] && b.Status == status && len(b.Changes) == 1 {
c := b.Changes[0]
if c.Path == path && c.Kind.Type == "update" && c.Kind.MovePath == nil && c.Diff != "" {
return true
diff --git a/internal/directlive/routing_order.go b/internal/directlive/routing_order.go
new file mode 100644
index 00000000..901e891e
--- /dev/null
+++ b/internal/directlive/routing_order.go
@@ -0,0 +1,25 @@
+package directlive
+
+import (
+ "amadan.net/oficina/equipo/internal/runner/provider"
+ "slices"
+)
+
+// A pending submission occupies the broker slot. Finish and acknowledge the
+// question first, preserving candidate-before-render order among submissions.
+func routingTools(tools []provider.LiveTool) []provider.LiveTool {
+ ordered := slices.Clone(tools)
+ slices.SortStableFunc(ordered, func(a, b provider.LiveTool) int {
+ if a.Name == b.Name {
+ return 0
+ }
+ if a.Name == "mcp__equipo__ask_person" {
+ return -1
+ }
+ if b.Name == "mcp__equipo__ask_person" {
+ return 1
+ }
+ return 0
+ })
+ return ordered
+}
diff --git a/internal/directlive/routing_order_test.go b/internal/directlive/routing_order_test.go
new file mode 100644
index 00000000..f788580a
--- /dev/null
+++ b/internal/directlive/routing_order_test.go
@@ -0,0 +1,19 @@
+package directlive
+
+import (
+ "amadan.net/oficina/equipo/internal/runner/provider"
+ "testing"
+)
+
+func TestRoutingQuestionPrecedesSubmission(t *testing.T) {
+ for _, submission := range []string{"submit_review", "submit_acceptance", "submit_answer", "submit_candidate"} {
+ tools := []provider.LiveTool{{Name: "Read", Exposed: true}, {Name: "mcp__equipo__" + submission, Exposed: true}, {Name: "mcp__equipo__ask_person", Exposed: true}, {Name: "mcp__equipo__submit_render", Exposed: true}}
+ ordered := routingTools(tools)
+ if ordered[0].Name != "mcp__equipo__ask_person" || ordered[2].Name != "mcp__equipo__"+submission || ordered[3].Name != "mcp__equipo__submit_render" {
+ t.Fatalf("question must finish before a submission occupies the broker slot: %+v", ordered)
+ }
+ if tools[0].Name != "Read" {
+ t.Fatal("catalog order changed")
+ }
+ }
+}
diff --git a/internal/directlive/tool_routing.go b/internal/directlive/tool_routing.go
index 8ce75b9f..125e560e 100644
--- a/internal/directlive/tool_routing.go
+++ b/internal/directlive/tool_routing.go
@@ -14,12 +14,15 @@ import (
)
func routingStatus(family string, frames [][]byte, tool, path string, outside bool) string {
- if family == "codex" && !outside && (codexRoutingPositive(frames, tool, path) || codexResourcePositive(frames, tool) || tool == "write_stdin" && codexStdinPositive(frames)) {
+ if family == "codex" && !outside && (codexRoutingResult(frames, tool, path, "completed") || codexResourcePositive(frames, tool) || tool == "write_stdin" && codexStdinPositive(frames)) {
return "pass"
}
if family == "codex" && tool == "write_stdin" && !outside {
return "not-certified"
}
+ if family == "codex" && outside && tool == "apply_patch" && codexRoutingResult(frames, tool, path, "declined") {
+ return "denied"
+ }
matchPath := path
if !outside && !provider.PathProbeApplicable(tool) {
matchPath = ""
@@ -76,6 +79,7 @@ func routingAttempted(frames [][]byte, tool string) bool {
}
func (x *exercise) toolRouting(ctx context.Context) error {
+ x.evidence.Tools = routingTools(x.evidence.Tools)
x.mu.Lock()
x.probing = true
x.mu.Unlock()
@@ -90,6 +94,7 @@ func (x *exercise) toolRouting(ctx context.Context) error {
key = "outside"
}
var prompt strings.Builder
+ prompt.WriteString("Call tools sequentially in the listed order. Finish ask_person before any submission tool.\n")
paths := map[string]string{}
for i, tool := range x.evidence.Tools {
if !tool.Exposed {
@@ -193,7 +198,11 @@ func (x *exercise) toolRouting(ctx context.Context) error {
}
return provider.ErrIsolation
}
- status := routingStatus(x.evidence.Provider, frames, tool.Name, paths[tool.Name], outside)
+ refusal := !outside && provider.RoutingWorkspaceStatus(x.evidence.Specialist, tool.Name) == "denied"
+ status := routingStatus(x.evidence.Provider, frames, tool.Name, paths[tool.Name], outside || refusal)
+ if refusal && status != "denied" {
+ status = "not-certified"
+ }
if outside && tool.Name == "Bash" && x.evidence.Provider == "claude" && x.outerPresent(paths[tool.Name]) {
rawFrames := make([]json.RawMessage, len(frames))
for j, f := range frames {
@@ -221,5 +230,5 @@ func (x *exercise) toolRouting(ctx context.Context) error {
tool.Routing[key] = o
}
}
- return x.check("tool-routing", routingComplete(x.evidence.Tools), x.evidence.Tools)
+ return x.check("tool-routing", routingComplete(x.evidence.Tools, x.evidence.Specialist), x.evidence.Tools)
}
diff --git a/internal/directlive/tool_routing_test.go b/internal/directlive/tool_routing_test.go
index cdeede56..5c5d06ed 100644
--- a/internal/directlive/tool_routing_test.go
+++ b/internal/directlive/tool_routing_test.go
@@ -57,3 +57,21 @@ func TestCodexRoutingPinnedFrames(t *testing.T) {
t.Fatal("MCP attempt mislabeled", got)
}
}
+
+func TestReadOnlyPatchRoutingRequiresCorrelatedRefusal(t *testing.T) {
+ call := `{"method":"rawResponseItem/completed","params":{"item":{"type":"custom_tool_call","name":"apply_patch","call_id":"p","input":"*** Begin Patch\n*** Update File: /workspace/route\n@@\n-routing-before\n+routing-after\n*** End Patch"}}}`
+ result := `{"method":"item/completed","params":{"item":{"type":"fileChange","id":"p","status":"declined","changes":[{"path":"/workspace/route","kind":{"type":"update","move_path":null},"diff":"changed"}]}}}`
+ for _, tc := range []struct{ name, call, result, want string }{
+ {"refusal", call, result, "denied"},
+ {"success", call, strings.ReplaceAll(result, "declined", "completed"), "not-certified"},
+ {"wrong-call", call, strings.ReplaceAll(result, `"id":"p"`, `"id":"other"`), "not-certified"},
+ {"wrong-path", call, strings.ReplaceAll(result, "/workspace/route", "/different"), "not-certified"},
+ {"attempt-only", call, `{}`, "not-certified"},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ if got := routingStatus("codex", [][]byte{[]byte(tc.call), []byte(tc.result)}, "apply_patch", "/workspace/route", true); got != tc.want {
+ t.Fatalf("got %s want %s", got, tc.want)
+ }
+ })
+ }
+}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 364e5667..1416cf8a 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -11,7 +11,7 @@ import (
// App-owned runtime strings belong here, including boot diagnostics.
// Existing copy accepted for now by Paul, 2026-11-04; new entries stay marked pending.
const (
- CopyCalibrationFunding = "calibration funding is too low; rerun with JobInput=%d JobOutput=%d ProjectInputHeadroom=%d ProjectOutputHeadroom=%d TeamInputHeadroom=%d TeamOutputHeadroom=%d: %w" // COPY REVIEW REQUIRED: Round 3 funding guidance.
+ CopyCalibrationFunding = "calibration funding is too low; rerun with JobInput=%d JobOutput=%d ProjectInputHeadroom=%d ProjectOutputHeadroom=%d TeamInputHeadroom=%d TeamOutputHeadroom=%d: %w" // COPY ACCEPTED FOR NOW (Paul, 2026-11-05; iterate in context)
copyObserverFailure = "The live update could not be sent. The change was saved."
copyDecisionOwnerAssigned = "Reassign this person's project decisions before removing them."
copyBindingInUse = "Another project uses this repository and app. Choose a different pair."
@@ -802,7 +802,7 @@ var runnerDraftCopy = map[string]string{
"live.check-deny": "Equipo is checking that this is refused. Type Deny.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-05, live-probe brief): live.check-deny
"live.check-allow": "Equipo is checking one-time approval. Type Allow once.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-05, live-probe brief): live.check-allow
"live.check-question": "Equipo is checking that your answer reaches the agent. Enter an answers JSON object.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-05, live-probe brief): live.check-question
- "live.answer-retry": "Enter Allow once, Deny, or a valid JSON object.", // COPY REVIEW PENDING: live.answer-retry
+ "live.answer-retry": "Enter Allow once, Deny, or a valid JSON object.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-05; iterate in context)
"live.answer": "Type Allow once, Deny, or an answers JSON object. This request expires in 60 seconds.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): live.answer
"live.beyond-profile": "Allow once is recorded as approved beyond profile.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): live.beyond-profile
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): isolation.approved_beyond_profile
diff --git a/internal/plan3test/plan3_release_test.go b/internal/plan3test/plan3_release_test.go
index 5cdf9bc8..4604250f 100644
--- a/internal/plan3test/plan3_release_test.go
+++ b/internal/plan3test/plan3_release_test.go
@@ -173,7 +173,8 @@ func plan3CopyInventory(t *testing.T) {
rows[key] = html.UnescapeString(strings.ReplaceAll(cells[1], "<br>", "\n"))
acceptedGuide := strings.HasPrefix(cells[2], "Guided live gate") && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)"
acceptedProbe := slices.Contains([]string{"live.check-deny", "live.check-allow", "live.check-question"}, key) && cells[2] == "Guided live probe controls" && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED FOR NOW (Paul, 2026-11-05; live-probe brief)"
- if !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedGuide && !acceptedProbe {
+ acceptedRound2 := slices.Contains([]string{"live.answer-retry", "CopyCalibrationFunding"}, key) && strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED FOR NOW (Paul, 2026-11-05; iterate in context)"
+ if !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedGuide && !acceptedProbe && !acceptedRound2 {
t.Fatal("entry has no copy review status or applicable acceptance", key)
}
}
diff --git a/internal/runner/provider/direct_certification.go b/internal/runner/provider/direct_certification.go
index 430a697c..a396f0e5 100644
--- a/internal/runner/provider/direct_certification.go
+++ b/internal/runner/provider/direct_certification.go
@@ -234,7 +234,7 @@ func (e DirectEvidence) validateTools(root string, probes bool) error {
return ErrPolicy
}
if probes {
- for key, want := range map[string]string{"workspace": "pass", "outside": "denied"} {
+ for key, want := range map[string]string{"workspace": RoutingWorkspaceStatus(e.Specialist, tool.Name), "outside": "denied"} {
o := tool.Routing[key]
if key == "outside" && o.Status == "declined" {
want = "declined"
@@ -291,3 +291,14 @@ func (e DirectEvidence) validateTools(root string, probes bool) error {
}
return nil
}
+
+// Workspace write tools must be refused for specialists with read-only workspaces.
+func RoutingWorkspaceStatus(specialist, tool string) string {
+ switch specialist {
+ case "Review", "Product", "Scope", "Research", "Investigation", "Coordinator":
+ if tool == "apply_patch" || tool == "Write" || tool == "Edit" {
+ return "denied"
+ }
+ }
+ return "pass"
+}
diff --git a/internal/runner/provider/isolation_boundary_test.go b/internal/runner/provider/isolation_boundary_test.go
index c24135b7..6574397e 100644
--- a/internal/runner/provider/isolation_boundary_test.go
+++ b/internal/runner/provider/isolation_boundary_test.go
@@ -160,3 +160,19 @@ func TestClaudeIsolationRejectsComputedProof(t *testing.T) {
t.Fatal("computed-only native proof certified")
}
}
+
+func TestRoutingReadOnlyWriteRefusal(t *testing.T) {
+ for _, role := range []string{"Review", "Scope", "Research", "Investigation"} {
+ for _, status := range []string{"denied", "pass", "declined", "not-certified", ""} {
+ e, root := directEvidenceFixture(t)
+ e.Specialist = role
+ e.Tools[0].Name = "apply_patch"
+ o := e.Tools[0].Routing["workspace"]
+ o.Status = status
+ e.Tools[0].Routing["workspace"] = o
+ if err := e.ValidateGroup(root, "Isolation"); (err == nil) != (status == "denied") {
+ t.Fatalf("%s %s: %v", role, status, err)
+ }
+ }
+ }
+}
diff --git a/internal/runner/provider/providertest/isolation_test.go b/internal/runner/provider/providertest/isolation_test.go
index 2f4ec1a2..692dd50d 100644
--- a/internal/runner/provider/providertest/isolation_test.go
+++ b/internal/runner/provider/providertest/isolation_test.go
@@ -64,6 +64,11 @@ except ValueError:pass
else:raise AssertionError('provider launch mismatch accepted')
# Stub only file hashing: status policy must still reject a declined workspace control.
observation=lambda *args: None
+for role in ('Review','Scope','Research','Investigation'):
+ for status in ('denied','pass','declined','not-certified',''):
+ try:routing_observation(None,'workspace',dict(status=status),role,'apply_patch')
+ except ValueError:assert status!='denied'
+ else:assert status=='denied'
routing_observation(None,'workspace',dict(status='pass'))
routing_observation(None,'outside',dict(status='declined'))
try:routing_observation(None,'workspace',dict(status='declined'))
diff --git a/scripts/runner-release-check.py b/scripts/runner-release-check.py
index 6cd31ba4..3e695ffc 100644
--- a/scripts/runner-release-check.py
+++ b/scripts/runner-release-check.py
@@ -102,8 +102,9 @@ def isolation_artifact(record, artifact, launch):
require(record["provider_launch"][key] == launch[field])
-def routing_observation(base, key, route):
- wanted = "pass" if key == "workspace" else "denied"
+def routing_observation(base, key, route, specialist="", tool=""):
+ refused = specialist in ("Review", "Product", "Scope", "Research", "Investigation", "Coordinator") and tool in ("apply_patch", "Write", "Edit")
+ wanted = "pass" if key == "workspace" and not refused else "denied"
require(route["status"] == wanted or key == "outside" and route["status"] == "declined")
observation(base, route, route["status"])
@@ -205,7 +206,7 @@ def evidence(manifest, certificate, reference, installed):
exposed.add(tool["name"])
for key, wanted in (("workspace", "pass"), ("outside", "denied")):
route = tool["routing"][key]
- routing_observation(path.parent, key, route)
+ routing_observation(path.parent, key, route, record["specialist"], tool["name"])
require(not tool.get("missing_reason"))
require(exposed)
require(surfaces == {"native", "shell", "search", "image", "mcp"})