|
92 | 92 | rather than buffered whole and measured afterwards, and overrunning it |
93 | 93 | exits non-zero exactly as canonical discovery raises — falling back to a |
94 | 94 | walk would do the work the bound exists to refuse. |
| 95 | +- **First adoption inside a monorepo no longer starts by writing the wrong |
| 96 | + manifest.** `verify --preview` routed setup to the workspace root, so on a |
| 97 | + repository holding many self-contained agent projects the command it handed |
| 98 | + back produced a manifest covering all of them: on `google/adk-samples` that |
| 99 | + was 252 `tool_sources` and an `agent.name` taken from the first of 160+ |
| 100 | + `Agent(name=…)` literals, unrelated to the pull request under review. Nothing |
| 101 | + in the output said so — the JSON reported `manifest_status: "written"`, |
| 102 | + `is_agent_project: true`, `confidence: "high"`, and a *higher* framework |
| 103 | + score than the correct sub-directory — and the alignment layer that compares |
| 104 | + a declared purpose against the observed capability surface has nothing left |
| 105 | + to compare when one declaration covers many agents. The changed paths already |
| 106 | + answer the question, so preview now derives `--workspace` from them: each is |
| 107 | + attributed to the nearest directory at or above it carrying a project marker |
| 108 | + (`pyproject.toml`, `package.json`, `go.mod`, `Cargo.toml`, …), and the scope |
| 109 | + is that project when exactly one is claimed **and** every capability-bearing |
| 110 | + changed path was claimed by it. A capability path no project owns — a root |
| 111 | + `prompts/system.md` travelling with a change to `services/b` — vetoes the |
| 112 | + answer rather than being dropped, because "this change belongs to |
| 113 | + `services/b`" would then be a false statement about the diff. The workspace |
| 114 | + root is likewise left unchanged whenever the paths do not narrow it — a |
| 115 | + root-level change, or one spanning two projects, which narrows to *nothing* |
| 116 | + rather than to their common parent, because the parent of two projects is not |
| 117 | + itself a project. Documentation and tests cannot outvote code: when more than |
| 118 | + one project is claimed, the projects claimed *only* by documentation or test |
| 119 | + paths drop out, and the trigger catalog's own docs-only rule decides which |
| 120 | + paths those are so the two surfaces cannot drift. That leg is load-bearing — |
| 121 | + the reported PR edits `python/agents/README.md` one directory above the |
| 122 | + project it adds, and counting that README as a competing claim sends the |
| 123 | + answer straight back to the repository root. Base detection now runs in |
| 124 | + preview exactly as it does in `verify` (honoring `--no-base`), because the |
| 125 | + promoted adoption command is the bare `verify --preview --json`: without it |
| 126 | + the preview every first adoption runs evaluates an empty change set and |
| 127 | + nothing below it can fire. Markers are read from the working tree — what |
| 128 | + `init` will run against — so a preview of a head that is not the current |
| 129 | + checkout claims no scope at all rather than recommending a directory that |
| 130 | + depends on what happens to be checked out. When the changed project already |
| 131 | + carries its own `shipgate.yaml`, preview routes to `verify` **there**, ahead |
| 132 | + of any root manifest, which governs a different boundary; that also stops the |
| 133 | + next preview from looping against a manifest that now exists. A change |
| 134 | + spanning several projects routes to `detect` instead of to an `init` that |
| 135 | + would deterministically refuse. |
| 136 | + |
| 137 | + `init --write` closes the same gap from the other side: a workspace whose |
| 138 | + manifest scope is unresolved reports |
| 139 | + `manifest_status: "refused_unresolved_scope"` (exit 2) with |
| 140 | + `auto_detected.agent_scope` and `agent_project_candidates[]`, rather than |
| 141 | + adopting the first agent name it parsed. Two things make a scope unresolved. |
| 142 | + `agent_scope: "ambiguous"` is agents in several self-contained projects — |
| 143 | + evidenced by everything `init` would turn into a manifest, so an |
| 144 | + OpenAPI-only or MCP-only project with no Python at all counts, as does a |
| 145 | + nested `shipgate.yaml` somebody already scoped by hand. `agent_scope: |
| 146 | + "unknown"` is discovery capped before it could tell: Python parsing stops at |
| 147 | + `--max-python-files`, and in a workspace with several project roots a |
| 148 | + "single project" verdict would just be whichever files were read first. |
| 149 | + Truncation alone is not enough to withhold an answer — a repository with one |
| 150 | + project root has nowhere for a second project to hide, so large |
| 151 | + single-project repositories keep their verdict and their working `init`. A |
| 152 | + refused run writes *nothing* — not the manifest, not the CI workflow, not the |
| 153 | + agent-instruction snippets, not the reports `.gitignore` block — so a |
| 154 | + workspace Shipgate declined to adopt carries no Shipgate edits into the diff. |
| 155 | + Rank 1 of the emitted recovery is deliberately not a command: promoting one |
| 156 | + candidate would make the same arbitrary pick the refusal exists to prevent, |
| 157 | + and the refused workspace itself is never offered back. The per-candidate |
| 158 | + commands repeat the setup flags the caller passed, so a recovery cannot |
| 159 | + silently complete with less than `--ci` or an agent-instruction selection |
| 160 | + asked for. `--minimal` adopts no detected name or tool surface and is |
| 161 | + unaffected; a repository that really is one agent surface across several |
| 162 | + projects passes `--allow-unresolved-scope`; and re-running `init --write |
| 163 | + --agent-instructions=…` on an adopted repository is untouched, because its |
| 164 | + scope was settled when its manifest was written. |
| 165 | + |
| 166 | + Two surfaces around it were wrong in the same direction. `init --ci` scoped |
| 167 | + to a sub-directory wrote `<project>/.github/workflows/agents-shipgate.yml`, |
| 168 | + which GitHub never loads — a gate reported as written that could not run; the |
| 169 | + workflow now lands at the repository root with a `config:` naming the |
| 170 | + manifest relative to that root. And `TRIGGER-SHIPGATE-MANIFEST` matched |
| 171 | + `shipgate.yaml` only at the repository root, so an edit to |
| 172 | + `services/refund/shipgate.yaml` — the file that declares that project's |
| 173 | + agent, purpose, and tool surface — reported `no_match`; it now matches at any |
| 174 | + depth, as do the pre-commit `files:` regex and the Cursor activation globs |
| 175 | + that copy the catalog, and a nested manifest counts as the repo-already-opted-in |
| 176 | + signal. `tools/shipgate-detect.py` (`script_version` `0.3.0`) carries |
| 177 | + `agent_scope` and `agent_project_candidates[]` too, pinned against the CLI by |
| 178 | + the parity test: an agent that consults the zero-install path must not adopt |
| 179 | + a scope the CLI refuses. |
| 180 | + |
| 181 | + Review found the routing could still be spent on evidence that did not |
| 182 | + support it, so three things changed shape. Preview now evaluates the same |
| 183 | + effective change set the full verifier does — committed range unioned with |
| 184 | + uncommitted and untracked work — because the command it emits runs against |
| 185 | + the working tree: an uncommitted-only capability change previously read as an |
| 186 | + empty diff, and an empty diff read as "nothing narrows the scope". "Scope not |
| 187 | + established" is now a state of its own rather than an absence: a head that is |
| 188 | + not checked out, a capability path no project claims, or a change spanning |
| 189 | + several projects each route to discovery or to human review, and never to |
| 190 | + initializing the repository root, which would turn "Shipgate could not tell" |
| 191 | + into a manifest for whichever agent the current checkout happens to hold. |
| 192 | + When the contested projects are already configured, each is its own gate and |
| 193 | + a human decides — a root manifest is not a substitute for either boundary. |
| 194 | + |
| 195 | + Three more surfaces followed the same distinction. Reports now default to the |
| 196 | + workspace the caller named, so `verify --workspace apps/a` writes |
| 197 | + `apps/a/agents-shipgate-reports/` — the directory that project's managed |
| 198 | + `.gitignore` block actually covers, and one that two projects cannot |
| 199 | + overwrite for each other; an explicit `--out` still resolves against the |
| 200 | + repository root. `--ci` writes one workflow per gated manifest |
| 201 | + (`agents-shipgate-<project>.yml` beside the root's `agents-shipgate.yml`), |
| 202 | + because the action takes a single `config` scalar and one shared file gated |
| 203 | + whichever project initialized first while reporting a skip for the rest; that |
| 204 | + scalar is now YAML-quoted when the path needs it, so a directory named |
| 205 | + `apps/agent #1` no longer renders a comment. And the `trigger` command reads |
| 206 | + the nested-manifest opt-in through the same resolver preview uses, so |
| 207 | + `apps/a/README.md` beside `apps/a/shipgate.yaml` stops reporting a docs-only |
| 208 | + skip. |
| 209 | + |
| 210 | + Detection got two corrections in opposite directions. A bare |
| 211 | + `requirements.txt` still is not a project boundary, but one sitting beside an |
| 212 | + agent is the only boundary that layout has — two sibling ADK agents were |
| 213 | + reported as one root scope, and `init` picked one of their names. And an |
| 214 | + `Agent(name=…)` literal only draws a boundary when its file carries a |
| 215 | + supported framework import: an unrelated module defining its own `Agent` |
| 216 | + class made a single-agent repository refuse. Those literals remain name |
| 217 | + suggestions. `tools/shipgate-detect.py` keeps its marker census complete |
| 218 | + rather than truncating it with the general file cap, so heavy filler no |
| 219 | + longer hides the projects it is supposed to find. |
| 220 | + ([#363](https://github.com/ThreeMoonsLab/agents-shipgate/issues/363)) |
95 | 221 |
|
96 | 222 | - **The recommended next command now runs where it was recommended.** Every |
97 | 223 | emitted command was written as the console script the wheel installs |
|
0 commit comments