Repository navigation
feat(preview): give the loop a way through a gated PR preview - #242
Conversation
`workflow/lib/preview-auth.mjs` turns a repo's own `previewUrl` block and a PR number into the host, the sign-in request to send, the Access headers to attach by env-var name, and one verdict both `finalize-pr` and `review-pr` read: whether this repo seeds previews at all. It decides and never fetches, like `railway.mjs` beside it — a routine cannot reach an API from a script, so the session sends the request and this file holds no credential. Each token variable is reported only as set or unset, and the headers are shell references, so a plan can be logged. The two token env-var names go in `loop-config.json` as `previewAccess`, beside `railway.tokenEnvVar`: a name typed into a skill is a tuning change nobody can review on its own. `ceilings` is untouched. The route and the account are the producing repo's, carried in its `.auth` block, so nothing here knows either and nothing here goes stale when they change. The test fixture deliberately uses a `.invalid` host for the same reason: a copy of another repo's config value is a second definition, in a fixture as much as in a skill. The failure this prevents: `review-pr` reads no repo config today, so without one answer in one place each skill would re-derive "does this repo seed previews" on every dispatch — 25 to 40 times a day — and the two are then free to disagree. Refs #241 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ
Step 7's *Every link opens on data* now asks the helper first, and signs in with what it answers where a repo declares `previewUrl.auth`. The configuration table gains the key beside `.pattern` and `.seed`. The example Preview block stops naming a real host. The pair it used names SahajCloud's Railway address, which sydevs/SahajCloud#1081 shuts — so the example would have told the next reader to write a link that 403s, and a host spelled in this skill is a copy of a config value either way. The failure this prevents: a run that holds a preview-only Access token still had nowhere to read the route, the account or the header names from, so it would have written `Data: not seeded yet` beside a preview it could have filled. ⚠ No step assumes `previewUrl.seed` is set. SahajCloud's copy carries only `.pattern` today, and the same hand-edit that adds `.auth` adds `.seed`; the `Cannot seed` case still covers an unset one. Refs #241 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ
Two places let a change admit it has no data and pass anyway. Where a repo's own CI goes red on a preview that exists and could not be filled, the red check is the gate and a sentence cannot stand in for it. ⚠ **Conditional, never a removal.** That text is correct for the other four repos, which have no seeding check and no gate — there the line is still the only honest thing to write. Each edit decides from the helper's verdict, so neither skill names a number, a label or a repo. `rule-delta.mjs` reports no dropped rule. The failure this prevents is the one the written rule has already accepted twice: sydevs/SahajCloud#1073 shipped its Registrations page with `Data: not seeded` and a console snippet to paste, and sydevs/SahajCloud#874 linked three pages nobody saw anything on — filling that one by hand afterwards found three defects in a minute. The story goes behind one new `docs/why.md` anchor, beside the rule it extends. Each edit still reads as an instruction with the citation removed. Refs #241 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ
They live in two different places, so the doc needs a row in each: the `github-ci` pair as an org-level GitHub secret, read by SahajCloud CI's seed and smoke steps, and the `claude-loop` pair as a Claude cloud-environment variable, read only by `workflow/lib/preview-auth.mjs`. The ⚠ on "There is no secret store" now says what a preview-only Access token reaches — every preview of the gated repo, as a service identity whose every use Cloudflare logs — and what it does not: anything on the live site, whose address it cannot change. The failure this prevents is a person setting up the loop with one Service Auth policy on "any service token", which reads like the simpler choice and makes switching one token off a deletion of both. Two named policies are what let the loop's be switched off while CI keeps running, and the other way round. Nothing here names a stopgap variable: sydevs/SahajCloud#1081 retires it, and this doc never carried a row for it. Refs #241 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ
Every skill change in this PR reaches a cloud routine on its next run, and an installed plugin on no run at all until this string moves: `installed_plugins.json` records a `gitCommitSha` and never revisits it, and the cache directory is named after `version`. A skill change without a bump is the one failure this repo has already paid eight days of stale skills for. `.claude-plugin/marketplace.json` still parses and still points at `./workflow`. Refs #241 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ
That passage read as though the seed itself replaced coordinator identities with `preview.invalid` addresses. It did not: `grep -rn 'preview\.invalid'` over sydevs/SahajCloud returns zero hits, and nothing writes that address. The anonymisation was done by hand, once, on one preview. Left as it was, the passage stated the opposite of the parent goal's whole premise — that the content system has nothing safe to fill a preview with, since its only data scripts import real people's names and addresses. A reader who trusted it would have concluded the problem was already solved. What makes made-up preview data true in code is the committed fixture sydevs/SahajCloud#1081 adds, and that is structural rather than tested: the real-data files left that checkout in sydevs/SahajCloud#1079, so no CI run holds a real name to leak. It remains no promise about a preview somebody filled by hand. Replaced in place, not appended. Refs #241 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ
…lf a token
Four defects found reviewing the helper, each the kind a prose rule cannot
hold and a script can.
A sign-in route came from config and was concatenated onto the host with no
check, so `@evil.example/x` or a bare `.evil.example/x` moved the origin while
`finalize-pr` attached the Access service token to the request. The route is
joined, then the composed origin is compared against the host's; anything else
plans no sign-in. For the same reason `{pr}` now takes digits only — the slot
sits inside the hostname — and a pattern must be `https:`, since `http:` would
put the pair on the wire in cleartext and `file:` would read the disk.
`headers` was built from the variable NAMES, so an environment holding no
token still handed the session two headers that expand to empty. Cloudflare
logs a blank client id as a failed service-token attempt, and the run reads two
headers as a working credential. Both halves must now be set. SahajCloud's
`accessTokenHeaders` already answered this question the same way; two answers
were one too many. The pair also rides only with a gated request now: a repo
declaring no `.auth` has no Access in front of it, and a preview host a repo
has since moved is a name anyone may claim.
`seedsPreviews` was true for any truthy `auth`, `{}` included. That verdict
tells `review-pr` to raise a `should-fix` on every empty preview in a repo
where no run can sign in or seed — a finding no author can comply with. It now
reads a usable plan.
`accountsPage` is gone. The seed route accepts only an admin manager, so a run
that picked another account from that page could not then seed, and the field
widened what the credential was used for while adding nothing.
The suite caught none of this: 7 of 7 mutations survived it, the
"opens no connection" assertion grepped for `fetch(` alone and passed a module
importing `node:https`, and neither field-name override was exercised. It now
asserts the import list against an allowlist, and 11 mutations were watched
failing against it.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ
…lse claims Review found the skill half stated things that are not true and asked for things a run cannot do. False, and a false sentence in a skill is in the next run's context: the example's hosts did not "become unreachable the day #1081 shut Railway's address" — that ticket is open, and the raw host redirects rather than going dark. The reason the hosts are gone is timeless, so it is stated that way. `finalize-pr` promised that a repo's seed check "will red this PR", but SahajCloud's step reds only where a preview was discovered; with none, CI warns. `why.md` claimed in the present tense a fixture that an unmerged PR commits, and named the ticket rather than the PR. Not executable: `review-pr` was told to call the helper but never where its input lives — `previewUrl` is not in `loop-config.json`, which is the only config that skill opens — nor that the path needs the `CLAUDE_PLUGIN_ROOT` convention, which is why 52 sessions once lost a call each. It also never got the Access headers, so on a gated repo every preview link answers with the login screen and reads as empty: the critic would have filed its own missing credential as a finding. And the new absolute collided with the carve-out two lines above it, leaving a mid-build 404 ambiguous. `finalize-pr` asked for a JSON subobject hand-spliced into a single-quoted shell string while the file was right there, and named no check on the token before sending. Both are `jq` and one clause. Hard rules still carried the unconditional form of the rule this PR makes conditional, which is the section a run under pressure re-reads, and step 7b restated the bullet instead of pointing at it. Two rules added rather than corrected. The token must never be printed — `fix-ci` already says so for the analogous case, and the values reach the shell even though the script never holds them. And data a preview already held must never be quoted into a public body: somebody may have filled it by hand from a real source. `rule-delta` reports that second one as a removal because it absorbed the shorter "never seed real people's contact details", which it contains. The docs now carry the Access application steps, because a service token is account-scoped and the promise that it "opens nothing on the live site" is kept by a policy nobody was told to create — with a verification `curl` against the live hostname expecting 403. The `CF_ACCESS_*` row moves to a repo secret: `--visibility all` would hand one repo's previews to every workflow in five. And both docs now say the feature is inert until a repo declares `previewUrl.auth`, naming its keys, which nothing told the person who must write that block. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjX5KDEbK7EeiEzbPvZ
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The shape matches #241 part for part: one helper both skills read, the verdict in a script, the names in loop-config.json, the rule made conditional rather than removed. Nothing is smuggled — the joined docs/why.md correction is named in the Summary, ceilings is byte-identical, the version is bumped. The helper earns its file: two skills need the same two answers, railway.mjs is the precedent, and nothing in workflow/lib/ already fills a pattern or joins a route.
One defect, in both skills, from one misreading of the plan. headers: [] is also what a repo with no .auth gets, so "empty headers means no service token" is wrong wherever seedsPreviews is true on seed alone — the branch's own test at preview-auth.test.mjs:141 is that case. access.clientId.set / .clientSecret.set tells the two apart.
Findings
- should-fix —
workflow/skills/review-pr/SKILL.md:98: emptyheadersread as "no token" silences theshould-fixon a seed-only repo. - should-fix —
workflow/skills/finalize-pr/SKILL.md:286: the same sentence, unscoped. Today's four repos always have emptyheaders.
What was checked
Read whole: preview-auth.mjs, its test, both skill diffs, the docs/ and loop-config.json diffs, railway.mjs, #241, the reviewer profile. Ladder: one new module, four functions, two values in their one home, no dependency — every import is ./config.mjs or ./payload.mjs, and isMain matches its five siblings. From a worktree: node --test workflow/lib/*.test.mjs, 116 pass; the helper on a seed-only and an auth-only input, which is how headers: [] reproduced twice. The body's greps re-run — no SahajCloud host, no PREVIEW_ADMIN_EMAIL, preview.invalid only in the corrected sentence. No preview link: this repo publishes none. Producer side not read.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
…aders `headers: []` has two causes and the text read only one. `authPlan` empties it whenever `signIn` is null, so every repo with no `previewUrl.auth` — all four product repos today — matched the sentence, and so did a repo carrying `seed` alone. The branch's own test at `workflow/lib/preview-auth.test.mjs:141` is that case: `seedsPreviews: true`, `signIn: null`, `headers: []`. Read as written, the rule recorded such a preview unreachable and raised nothing, cancelling the `should-fix` the next sentence demands. The condition is now a `signIn` present with either `access` half unset, which is the only shape that means this environment cannot pass a gate, and empty `headers` with no `signIn` is named as no gate rather than a missing token. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW1KpxUngcdTDx7hQ1
…e field Same misreading as review-pr:98, and unscoped here. `authPlan` returns `headers: []` whenever `signIn` is null, so all four repos carrying no `previewUrl.auth` matched this sentence on every preview. Read as written, step 7 stopped checking data and wrote "unreachable" instead — the exact failure the step exists to prevent. The sentence now requires a `signIn`, and names the condition as `access.clientId.set` / `.clientSecret.set` rather than leaving the run to infer it from an empty list. Empty `headers` with no `signIn` is stated to mean no gate, so the data check proceeds as before. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW1KpxUngcdTDx7hQ1
The security review found a credential leak this PR introduced, and it is the kind a prose rule cannot hold. `review-pr` was told to "send each link with the plan's `access.headers`", where each link is a `## Preview` link read out of the body under review. That body is not ours. `dispatcher/decide.mjs` fires `review-pr` with `onDemand` on a PR no member authored as soon as a `respondTo` login types the review verb, and the skill is told to judge a ticketless PR against its own body. So anyone able to open a PR could name their own host in a Preview section and collect the Cloudflare Access service token from their logs — a token that opens every PR preview of the gated repo. The branch had already hardened the script against leaving the host: `routeOn` joins the sign-in route and compares the composed origin. The prose then left by a different door, because the module validated the one URL it built while the skill attached the same headers to URLs it never saw. `onHost` closes it where a rule can be evaluated, and `--on-host <link>` answers `ON_HOST` or `OFF_HOST` for one link. Both skills now send the pair to an `ON_HOST` link only, and an `OFF_HOST` link in a body is a `should-fix` of its own: a body pointing where the repo publishes no preview is one a reviewer cannot check. `review-pr` also gains the `Never print the token` rule its `finalize-pr` counterpart already carried, since it publishes a public What-was-checked section. `railway.mjs` allowlists an outside poster's host for the same reason. Four mutations of the check were watched failing the suite: the `https:` guard dropped, `endsWith` for origin equality, hostname for origin, and always allowing. A fifth, dropping the null-host guard, is behaviour-preserving — the try/catch already answers false. `budget.test.mjs` asserts every verdict word a skill names is one a script can print, so each script now exports its own list and the test reads their union. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjW1KpxUngcdTDx7hQ1
|
Both critic findings held. Each now keys on a The security review found a leak this PR introduced. "Send each link with the plan's Nothing rebutted or asked. Base already current. Gate ✓ 119 tests, checkout and worktree. Body refreshed. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Ready to review with sydevs/SahajCloud#1081. It merges after sydevs/SahajCloud#1081 does: auto-merge is armed once that closes, after its contract re-sync lands here. 🤖 sydevs dispatcher |
Summary
docs/why.mdclaimed a seed script anonymised 495 coordinator identities. No code does — it was a hand seed, and the passage stated the opposite of the parent goal's premise.Change outline
Nothing here can be tested by running it: a skill edit takes effect on the next session, never this one. So each view below is paired with the failure it prevents, which is the only evidence available before merge.
Contract — what the helper answers, and what reads it
⚠ It decides and never fetches.
workflow/lib/railway.mjsis the precedent and states the reason: a routine cannot reach an API from a script, so a helper that fetched would run only on a maintainer's laptop — a second implementation of a rule the cloud path executes another way, which is the shape of this loop's worst bug to date.The failure this prevents:
review-prreads no repo config at all today. Without one answer in one place, each skill would re-derive "does this repo seed previews" on every dispatch of its handler — 25 to 40 times a day, forever — and the two are then free to derive it differently.Behaviour — when a body line stops being enough
⚠ Conditional, never a removal. That text is correct for the other four repos, which have no seeding check and no gate — there the line is still the only honest thing to write.
The failure this prevents has already happened twice. sydevs/SahajCloud#1073 shipped its Registrations page with
Data: not seededand a console snippet to paste, and that read as compliance to every check including the adversarial review. sydevs/SahajCloud#874 linked three pages nobody saw anything on; filling that preview by hand afterwards found three defects in a minute.Files
What review changed
Three review passes found fourteen things. The ones worth the reviewer's attention here, because each was wrong in an earlier push:
access.headers" — with no check that the link is on the hostreview-prreads the## Previewlinks out of the body under review, anddispatcher/decide.mjsfires it on a PR no member authored as soon as arespondTologin types the review verb. So anyone able to open a PR could name their own host and collect the pair from their logs.onHostanswers per link, and anOFF_HOSTlink is now ashould-fixof its ownheaders: []read as "no service token", in both skillsshould-fixsilenced on a repo carryingseedalone, and step 7 writing "unreachable" instead of checking data in all four repos that declare no.auth—authPlanemptiesheaderswheneversignInis null, so the sentence matched both@evil.example/xmoved the origin — with the Access token attachedhttps:and digit-only{pr}are checked for the same reasonheaderswas built from the variable names, so an environment with no token still got two headers that expand to emptyaccessTokenHeadersalready answered this the same way — two answers were one too manyseedsPreviewswas true for any truthyauth,{}includedshould-fixon every empty preview in a repo where no run can sign in or seed: a finding no author can comply withfinalize-prpromised the seed check "will red this PR"finalize-prsaid the example's hosts "became unreachable the day #1081 shut Railway's address"review-prwas told to call the helper, but not wherepreviewUrllives, nor to use theCLAUDE_PLUGIN_ROOTpath, nor to attach the headerspreviewUrlis in no config that skill opens, a relative path resolves to nothing from a product repo, and an unauthenticated request to a gated preview answers with the login screen and reads as empty — the critic would file its own missing credential as a findingreview-prcarried noNever print the tokenrule, whilefinalize-prdid#148shape: four statements of one rule, the fourth disagreeing, in the section a run under pressure re-readsfetch(alonenode:httpspassing the assertion that the whole script layer rests on. It now pins the import list; 11 mutations were watched failingaccountsPageCF_ACCESS_*documented as an org secret with--visibility allAnd one finding dismissed. The security pass read
auth.accountas publishing SahajCloud'sPREVIEW_ADMIN_EMAILinto a public file, on the strength ofpreviewAdmin's "the address is the credential there". That premise is what the sibling PR retires: sydevs/SahajCloud#1082 makes the address a committed constant and signs any manager in, because Cloudflare Access is the gate now. It readmain, not the branch. The derived ask does hold, so the config table row now saysaccountmust be an address the gate does not treat as the credential.Test results
claude plugin validate ./workflow --strictandnode --test workflow/lib/*.test.mjs(119 tests), run from the checkout and from a.claude/worktrees/<slug>worktree — which is whereimplement-ticketruns it, and where a cwd-relative config read would have failednode:httpsimport, both field-name overrides ignored,replaceAll→replace, theprguard broken on0, one trailing slash, headers on a name alone, headers on an ungated host,seedsPreviewson anyauth, the route not origin-checked, thehttps:check droppedonHost, each watched failing: thehttps:guard dropped,endsWithfor origin equality,hostnamefor origin, and always allowing. A fifth — dropping the null-host guard — survives and is behaviour-preserving: thetry/catchalready answersfalse. One more onbudget.test.mjs's scan: droppingOFF_HOSTfrom the exported list fails it--on-hostby hand against a gated fixture: the preview's own pathON_HOST; an attacker host, ahost + ".evil.example"suffix,http:, a port, and another PR's preview allOFF_HOSTnode workflow/lib/rule-delta.mjs --base origin/main workflow/skills: directives 90 → 92, unmoved by the two review passes since. Three added —Never spell one here,Never print the token,Never seed real people's contact details, and never quote data the preview already held. One removal to adjudicate:Never seed real people's contact details.was not dropped — the third addition contains it verbatim and extends itpython3 workflow/lib/ste-lint.pyon both edited skills: the same hard-violation count as the base (4 and 2), no new one. One reword was needed to hold that —gets no headerputgetbeside the file's existingfetchnode workflow/lib/comment-lint.mjs --base origin/main: no banned comment addedgit diff origin/main -- loop-config.jsontouches only the newpreviewAccessblock; nothing underceilingsloop-config.json→ci.noCi), so review is the only gateManual verification
grep -rn 'cloud-preview.sydevelopers.com\|sahajcloud-sahajcloud-pr' workflow/ docs/ loop-config.jsonreturns nothing. The example Preview block infinalize-prused to name a real SahajCloud host; it now writes<host>, because a host spelled here goes stale the day that repo moves it.grep -rn 'preview\.invalid' docs/returns only the corrected sentence, which names it as a one-off hand seed.echo '{"previewUrl":{"pattern":"https://x-pr-{pr}.invalid"},"pr":7}' | node workflow/lib/preview-auth.mjsexits 0 and reportsseedsPreviews: false,signIn: null, andaccess.headers: [].--on-host https://x-pr-7.invalid/xanswersON_HOST, and with any other originOFF_HOST.(why: …)citation removed.Notes for reviewer
This is child 2 of 2, and it merges second. sydevs/SahajCloud#1081 builds the gate, the picker and the fixture; this gives the loop its way through. It is blocked by that one: the helper has nothing to sign in to, and the conditional text has no red check to be conditional on, until sydevs/SahajCloud#1082 merges. It provides nothing back.
Both halves of the switch are config, and this PR is only one half. After this merges,
seedsPreviewsis stillfalsein all five repos and both new skill branches are unreachable — no repo carriespreviewUrl.author.seedyet. What activates it is a person adding that block to SahajCloud's.claude/workflow.json, a Protected Path, listed in #1081's notes. Until then the two new environment variables are read by nothing.docs/routine-setup.mdnow says so, because a credential nothing reads is a credential nobody audits.The credential leak the third pass found was armed by the same config, not by this merge.
headersis empty while no repo declarespreviewUrl.auth, so nothing could have been sent anywhere yet. It would have armed the moment someone completeddocs/routine-setup.md§4 — which is this PR's own instruction — so it is fixed here rather than filed.Merging to
mainhere IS the deploy. The cloud routines read these skills fresh frommainon every run, so a merge reaches them on their next run and there is no rollback but another PR. Eleven commits, one per behaviour, each separately revertable:feat(lib)feat(finalize-pr)previewUrl.auth's meaning, and the example hostfix(review-pr)docs/why.mdanchordocs(routine-setup)chore(plugin)5.3.0→5.4.0fix(why)fix(lib)fix(skills)fix(review-pr)signIn, not on emptyheadersfix(finalize-pr)access.clientId.set/.clientSecret.setfix(preview)A running cost, stated.
finalize-prgrows 1.9 KB andreview-pr1.2 KB overmain, and both are read on every dispatch. Each addition prevents a named failure above, andfinalize-prstep 7b now points at the step-7 bullet rather than restating it, which paid some of it back. The third pass added 0.2 KB and 0.4 KB of that, for one origin check and oneNever print the token.No ceiling moves, so the skill/ceiling split does not bite.
previewAccessadds two env-var names under a new key — a value, not a ceiling — andceilingsis byte-identical toorigin/main.previewUrl.auth's shape is defined here and written there. This PR decides what the key means; a person hand-writes it into SahajCloud's own.claude/workflow.jsonas{ "signInPath": "/api/managers/request-magic-link", "account": "[email protected]" }. That same edit should replacepreviewUrl.pattern, which still names the Railway host #1082 puts a gate in front of. Nothing here hard-codes the route, the address or the host — they are that repo's config values, and a copy here would be a second definition free to go stale. The test fixture uses a.invalidhost for the same reason.The security review runs, and that is expected:
securityReview.triggerPatternmatches^workflow/lib/,^workflow/skills/.+\.md$and^loop-config\.json$, because a skill body is an instruction to an agent holding write access to five repos. It is what found the leak above.One judgement worth checking. The loop's token variables are named
PREVIEW_ACCESS_CLIENT_ID/PREVIEW_ACCESS_CLIENT_SECRETrather than reusing CI'sCF_ACCESS_CLIENT_ID/CF_ACCESS_CLIENT_SECRET. They are different tokens in different places, and the distinct names are what make "the loop's, and preview-only" readable at the variable in a cloud environment that has no secret store.Detail
Why
seedsPreviewsreads a usable plan rather than key presence.previewUrl.seedpredates.authand a repo may carry one without the other, so the verdict must not require the pair — but it must not fire on anauthblock too incomplete to sign in with either, because the finding it drives is one the author cannot act on.Cannot seedstill covers an unset.seed.Why the token is reported per variable. It is a pair, and one half present is a misconfiguration Cloudflare logs as a failed service-token attempt rather than ignoring — so a plan saying only "set" would hide the case that actually goes wrong.
access.clientId/.clientSecretare therefore reported even on an ungated host, whereheadersis empty: a run can then say which half is missing instead of guessing.Why
headers: []could not carry the "no token" meaning.authPlanreturnsaccess: signIn ? access : { ...access, headers: [] }, so an empty list means no gate as often as no credential — and today, with no repo declaring.auth, it always means the former. Both skills now key that sentence on asignInwith a half unset, which is the only shape that means this environment cannot pass a gate.Why the origin check is a script and not a sentence. The module already compared an origin once, in
routeOn, for the one URL it builds. The prose then attached the same headers to URLs the module never saw, which is the same rule evaluated in two places with only one of them hardened.onHostis that comparison, exported, so each skill asks rather than eyeballs — and@evil.example, a trailing-suffix host and a bare port are each a spelling a prose rule would have had to anticipate.Why two Service Auth policies. One policy on "any service token" turns switching either token off into a deletion of both, and the parent goal asks that the loop's and the checks' tokens be switchable off alone. The ⚠ in
docs/routine-setup.md§4 now says so, because the single-policy shape reads like the simpler choice. §4 also now carries the three steps that create the policy, and a verificationcurlagainst the live hostname expecting403— a service token is account-scoped, so what it opens is decided by that policy and not by the token, and nothing in the loop can detect a pair that opens production.Why the token must never be printed. The script never holds a value — it reports
setonly, and the headers are$VARreferences. But the shell that sends the request expands them, so-v,--trace-ascii,set -xor a pasted failing command puts the secret in the transcript, and from there into a journal comment on a public repo.fix-cialready states this rule for reading CI logs; its absence fromreview-prwas an inconsistency, not a new policy.Nothing here writes under
.claude/. The four.claude/workflow.jsonedits this work depends on land in SahajCloud's copy and are a person's, listed in #1081's notes. So no part of this is handed back for the Protected Paths guard.Closes #241
🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjW1KpxUngcdTDx7hQ1