Skip to content

Commit d5023e7

Browse files
Svilen-Stefanovclaudeivanmilevtuesampagent
authored
feat: run the review guide and architecture checks (#162)
* feat: run every closed feature the service lists The review guide step becomes a generic runner: it reads GET /v1/features, collects the bundle once, posts one request per feature in parallel with only the inputs that feature names, and writes each answer to the artifact. A feature that never answered is written as skipped or failed, so a reader can tell not checked from nothing found. It computes nothing and names no feature, except the fallback to the guide alone for a service with no manifest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: send a repository's source to the feature that asks for it Only that feature's request carries it, within the size the service names. Past that, or with closed_features_source: false, the request goes without it and says why, so the feature reports what it could not check. Also lowers the bundle limit to what a Function URL really takes: base64 counts, so 5 MB was refused with a 413. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: use a run's own provider for every closed feature The run's llm, key and model now reach every feature, for each provider the service can call. A run on a provider it cannot reach makes no model call and is never sent to the hosted model. The manifest is read with the run's credentials. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: Bedrock's region, and say what really reaches CodeBoarding Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: hosted runs use CodeBoarding's model, and only an own key chooses llm: hosted and license now refuse model, agent_model and parsing_model, with hosted_with_model and license_with_model. A run's own key uses agent_model, then model, as its analysis does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: say what the model sees of a repository's source Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: call review guide and architecture endpoints directly Remove discovery while preserving independent results and safe source collection. Amp-Thread-ID: https://ampcode.com/threads/T-01a1abfe-5528-76fc-98bb-1b06f9283e22 Co-authored-by: Amp <amp@ampcode.com> * fix: clean a run's key for the closed features as the analysis does A key pasted as ANTHROPIC_API_KEY="sk-..." passed the credential check and the analysis, because credential_check unwraps quotes and its own VAR= prefix, but the closed features only trimmed whitespace and sent the wrapper to the provider. Both now read the key through _clean_key. The README's model section no longer says model inputs skip action-side validation: hosted and license runs refuse them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: ivanmilevtues <ivanmilevtues@gmail.com> Co-authored-by: Amp <amp@ampcode.com>
1 parent fa4c260 commit d5023e7

8 files changed

Lines changed: 936 additions & 489 deletions

File tree

‎README.md‎

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,38 @@ The same rule makes the combinations explicit rather than order-dependent:
164164
| `llm: hosted` + any provider key | refused: pick one |
165165
| `llm: hosted` + `license_key` | refused: use `llm: license` |
166166
| `llm: license` without `license_key` | refused: names the secret to add |
167+
| `llm: hosted` or `license` + `model`, `agent_model` or `parsing_model` | refused: CodeBoarding picks the model on its own key; bring your own key to choose one |
167168
| `llm: anthropic` + `anthropic_api_key` | Anthropic, directly |
168169
| `llm: anthropic`, key empty or absent | refused: names the input and the secret |
169170
| `llm: anthropic` + `openai_api_key` | refused: a second provider's key |
170171
| `llm: anthropic` + key + `license_key` | Anthropic, on a CodeBoarding plan |
171172

172173
A licence alongside your own key is deliberately allowed: it says "my CodeBoarding plan,
173-
my own tokens". **Your key always wins.** A direct provider call never reaches
174-
CodeBoarding, so the licence is recorded and reported but not spent, and nothing meters
175-
that combination today. The job summary says so on every run, rather than leaving you to
176-
infer it from the tier name.
174+
my own tokens". **Your key always wins.** The analysis calls your provider directly, so
175+
the licence is recorded and reported but not spent, and nothing meters that combination
176+
today. The job summary says so on every run, rather than leaving you to infer it from the
177+
tier name.
178+
179+
The review guide and architecture checks are the exception to "directly": their code
180+
runs on CodeBoarding's service, so your key travels with that request, is used for that run
181+
and is neither stored nor logged. A provider the service cannot call, such as a custom base
182+
URL, LiteLLM or a self-hosted Ollama, keeps its key on the runner: those features make no
183+
model call, and the run never falls back to CodeBoarding's model.
184+
185+
The action independently calls `POST /v1/review-guide` and `POST /v1/architecture` on the
186+
same `review_guide_url` base URL. There is no discovery request. Both receive the same
187+
required analysis inputs. The guide endpoint returns `{guide, usage, timingsMs}`; the action
188+
saves the bare guide as `review_guide.json`. Architecture returns `{envelope, usage}`; its
189+
envelope is saved unchanged as `closed/architecture.json`, including partial, skipped and
190+
failed results. Failure of either request does not prevent the other or fail the review.
191+
192+
Only architecture receives optional `source.json`: tracked Python, JavaScript/TypeScript
193+
and C# files (`.py`, `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.cs`, `.csproj`), excluding
194+
dependency/build directories, docs/public/fixtures, minified JS and TypeScript declarations.
195+
Symlinks are not read. Individual files are capped at 300 KB and source at 16 MB. If adding
196+
source exceeds the 4.3 MB compressed request limit, it is omitted with a reason; architecture
197+
still runs with the required inputs. `closed_features_source: false` also omits source.
198+
An unsupported provider skips the guide, but architecture can still return measured findings.
177199

178200
### Providers
179201

@@ -230,7 +252,9 @@ a CodeBoarding service issue. Own-provider quota failures retain their provider
230252

231253
## Model selection
232254

233-
All model inputs are optional and are passed directly to Core without action-side validation:
255+
All model inputs are optional and are passed directly to Core. The action checks one thing: with
256+
`llm: hosted` or `license` it refuses them, because CodeBoarding picks the model on its own key.
257+
Bring your own key to choose one:
234258

235259
```yaml
236260
with:
@@ -347,7 +371,8 @@ The first sync after the merge creates `codeboarding/baseline`, catching up from
347371
| `github_token` | both | `${{ github.token }}` | Token for comments and sync delivery. |
348372
| `codeboarding_analysis_location` | both | `codeboarding_branch` | Where the synced branch's analysis is stored: `codeboarding_branch` (on `codeboarding/baseline`, for the default branch; the code is never written) or `in_place` (committed as `.codeboarding/` on the synced branch). Sync saves it there and review reads it from there. |
349373
| `warmstart_retention_days` | review | `1` | Days to keep the reusable analysis. Only the next run reads it. |
350-
| `review_guide_url` | review | `https://jxivqwx4or6oip3krgdmdaiunm0iaybf.lambda-url.us-east-1.on.aws/` | Experimental. Production service base URL for the pull request's review guide. The run sends it this analysis and stores `review_guide.json` in the review artifact. Set to `''` to disable. Never fails the run. |
374+
| `review_guide_url` | review | `https://jxivqwx4or6oip3krgdmdaiunm0iaybf.lambda-url.us-east-1.on.aws/` | Experimental. Shared base URL for `/v1/review-guide` and `/v1/architecture`. Saves `review_guide.json` and `closed/architecture.json` in the review artifact. Set to `''` to disable both. Never fails the run. |
375+
| `closed_features_source` | review | `true` | Whether architecture checks may read this repository's source. Only the architecture request carries it, capped in size, and the service keeps nothing. The model sees code around a finding, never the tree. With `false`, source-dependent checks and model review do not run, and the result says so. |
351376

352377
`target_branch` and `sync_strategy` are deprecated, and read as the `codeboarding_analysis_location` they stand for, with a warning: `sync_strategy: push` as `in_place`, `sync_strategy: pull_request` as `codeboarding_branch`. `target_branch` is accepted only when it names the branch the run is on: the push trigger picks the branch. `force_full: true` is ignored with a warning. Anything the new input cannot express fails, linking to [moving an existing setup](#moving-an-existing-setup).
353378

‎action.yml‎

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,19 @@ inputs:
145145
default: '2'
146146
review_guide_url:
147147
description: >-
148-
Experimental. The CodeBoarding service that writes a pull request's review guide (main
149-
changes, each change as numbered steps on the map). Defaults to the production service.
150-
A review run sends it this run's analysis and stores the guide in the review artifact for
151-
the platform to show. Set to an empty string to disable.
148+
Experimental. Service base URL for POST /v1/review-guide and POST /v1/architecture.
149+
Defaults to production. Both receive this run's analysis independently; results are stored
150+
as review_guide.json and closed/architecture.json. Set to an empty string to disable both.
152151
required: false
153152
default: 'https://jxivqwx4or6oip3krgdmdaiunm0iaybf.lambda-url.us-east-1.on.aws/'
153+
closed_features_source:
154+
description: >-
155+
Whether architecture checks may read this repository's source, for checks that
156+
need the whole tree and to verify a finding. Only the architecture request carries it, capped in
157+
size, and the service keeps nothing. The model sees the code around a finding, never the tree.
158+
With 'false' those checks and the model review do not run, and the result says so.
159+
required: false
160+
default: 'true'
154161
github_token:
155162
description: 'Token used for comments and sync delivery.'
156163
required: false
@@ -301,6 +308,9 @@ runs:
301308
ACTION_PATH: ${{ github.action_path }}
302309
CB_IN_LLM: ${{ inputs.llm }}
303310
CB_IN_LICENSE_KEY: ${{ inputs.license_key }}
311+
CB_IN_MODEL: ${{ inputs.model }}
312+
CB_IN_AGENT_MODEL: ${{ inputs.agent_model }}
313+
CB_IN_PARSING_MODEL: ${{ inputs.parsing_model }}
304314
CB_IN_ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
305315
CB_IN_AWS_BEDROCK_API_KEY: ${{ inputs.aws_bedrock_api_key }}
306316
CB_IN_AWS_BEDROCK_REGION: ${{ inputs.aws_bedrock_region }}
@@ -694,15 +704,16 @@ runs:
694704
ANALYSED_FILES_CHANGED: ${{ steps.review_render.outputs.analysed_files_changed }}
695705
run: "$GITHUB_ACTION_PATH/scripts/action/build-review-artifact.sh"
696706

697-
# After the artifact holds the analysis and before it is uploaded: the guide is one more file
698-
# in it. Uses production by default; an empty URL disables it. It never fails the run.
699-
- name: Build review guide
700-
id: review_guide
707+
# After the artifact holds the analysis and before it is uploaded: each feature is one more
708+
# file in it. Uses production by default; an empty URL disables it. It never fails the run.
709+
- name: Run closed features
710+
id: closed_features
701711
if: steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && inputs.review_guide_url != ''
702712
continue-on-error: true
703713
shell: bash
704714
env:
705-
REVIEW_GUIDE_URL: ${{ inputs.review_guide_url }}
715+
CLOSED_FUNCTIONS_URL: ${{ inputs.review_guide_url }}
716+
CLOSED_FEATURES_SOURCE: ${{ inputs.closed_features_source }}
706717
REPOSITORY: ${{ github.repository }}
707718
PR_NUMBER: ${{ steps.guard.outputs.pr_number }}
708719
ARTIFACT_DIR: ${{ steps.review_artifact.outputs.artifact_dir }}
@@ -711,10 +722,32 @@ runs:
711722
CHECKOUT_DIR: ${{ github.workspace }}/.codeboarding-target
712723
GITHUB_TOKEN: ${{ inputs.github_token }}
713724
LICENSE_KEY: ${{ inputs.license_key }}
725+
LLM: ${{ inputs.llm }}
726+
MODEL: ${{ inputs.model }}
727+
AGENT_MODEL: ${{ inputs.agent_model }}
728+
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
729+
AWS_BEDROCK_API_KEY: ${{ inputs.aws_bedrock_api_key }}
730+
AWS_BEDROCK_REGION: ${{ inputs.aws_bedrock_region }}
731+
CEREBRAS_API_KEY: ${{ inputs.cerebras_api_key }}
732+
DEEPSEEK_API_KEY: ${{ inputs.deepseek_api_key }}
733+
DEEPSEEK_BASE_URL: ${{ inputs.deepseek_base_url }}
734+
GLM_API_KEY: ${{ inputs.glm_api_key }}
735+
GLM_BASE_URL: ${{ inputs.glm_base_url }}
736+
GOOGLE_API_KEY: ${{ inputs.google_api_key }}
737+
KIMI_API_KEY: ${{ inputs.kimi_api_key }}
738+
KIMI_BASE_URL: ${{ inputs.kimi_base_url }}
714739
OLLAMA_API_KEY: ${{ inputs.ollama_api_key }}
715-
OPENROUTER_API_KEY: ${{ inputs.openrouter_api_key }}
740+
OLLAMA_BASE_URL: ${{ inputs.ollama_base_url }}
716741
OPENAI_API_KEY: ${{ inputs.openai_api_key }}
717-
run: python3 "$GITHUB_ACTION_PATH/scripts/review_guide.py"
742+
OPENAI_BASE_URL: ${{ inputs.openai_base_url }}
743+
OPENROUTER_API_KEY: ${{ inputs.openrouter_api_key }}
744+
OPPER_API_KEY: ${{ inputs.opper_api_key }}
745+
ORCAROUTER_API_KEY: ${{ inputs.orcarouter_api_key }}
746+
REQUESTY_API_KEY: ${{ inputs.requesty_api_key }}
747+
REQUESTY_BASE_URL: ${{ inputs.requesty_base_url }}
748+
VERCEL_API_KEY: ${{ inputs.vercel_api_key }}
749+
VERCEL_BASE_URL: ${{ inputs.vercel_base_url }}
750+
run: python3 "$GITHUB_ACTION_PATH/scripts/closed_features.py"
718751

719752
- name: Upload review artifact
720753
id: upload_review_artifact_dotcom

‎scripts/action/credential_check.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
"hosted_with_provider_key",
5050
"hosted_with_license",
5151
"license_with_provider_key",
52+
"hosted_with_model",
53+
"license_with_model",
5254
"foreign_provider_key",
5355
}
5456
)
@@ -174,6 +176,19 @@ def _reject_provider_inputs(table: dict, given: dict[str, str], llm: str, tier:
174176
)
175177

176178

179+
def _reject_model(llm: str, tier: str, environ: dict[str, str]) -> None:
180+
"""On CodeBoarding's key, CodeBoarding picks the model and its settings. Choosing one takes a
181+
key of your own, and a workflow that names one here would otherwise run on another without
182+
saying so."""
183+
for name in ("model", "agent_model", "parsing_model"):
184+
if environ.get(f"CB_IN_{name.upper()}", "").strip():
185+
raise ConfigError(
186+
f"{tier}_with_model",
187+
f"`llm: {llm}` runs on CodeBoarding's model, so `{name}` cannot be set. "
188+
"Remove it, or set `llm` to a provider and bring your own key to choose a model.",
189+
)
190+
191+
177192
def _require_id_token(llm: str, environ: dict[str, str]) -> None:
178193
# Both, because the relay needs both (oidc_relay.py refuses to start without either)
179194
# and a runner can expose one without the other. Checking only the URL let that case
@@ -259,6 +274,7 @@ def resolve(table: dict, environ: dict[str, str]) -> dict:
259274

260275
if llm == "hosted":
261276
_reject_provider_inputs(table, given, llm, "hosted")
277+
_reject_model(llm, "hosted", environ)
262278
if license_key:
263279
raise ConfigError(
264280
"hosted_with_license",
@@ -270,6 +286,7 @@ def resolve(table: dict, environ: dict[str, str]) -> dict:
270286

271287
if llm == "license":
272288
_reject_provider_inputs(table, given, llm, "license")
289+
_reject_model(llm, "license", environ)
273290
if not license_key:
274291
raise ConfigError(
275292
"missing_license_key",

0 commit comments

Comments
 (0)