Skip to content

fix(automation)!: a child flow started from a subflow or map step admits the acting user against the child's requiredPermissions - #39839

Merged
os-zhuang merged 20 commits into
mainfrom
claude/issue-33684-child-flow-start-admission
Dec 6, 2026
Merged

os-zhuang merged 20 commits into
mainfrom
claude/issue-33684-child-flow-start-admission

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #33684

Clause-②: yes (narrowing) — widened: the public AutomationEngine.childFlowStartRefusal(flowName, context) method
Metadata-protocol: semantic
Skills-docs: follow-up #39842

维护者速读

  • 用户能看到什么变化:流程作者和使用流程的成员会看到,一个流程通过“子流程”或“逐项执行”步骤去启动另一个声明了“启动所需能力”的流程时,现在也会检查当前运行所代表的用户是否具备这些能力;不具备时该步骤失败、被调用的流程不会启动。
  • 为什么做:属于“流程启动权限”这一安全规则的收口,替云端的 AI 建流程入口解决前置条件:只有这一规则在子流程和逐项执行上也成立,云端才会开放这两种步骤。
  • 出错会怎样:已经依赖“父流程包一层就能调用受限流程”的应用,会在该步骤看到权限拒绝;修复方式是给用户授予对应能力或调整流程结构;不代表任何用户、只带着调用方授权的运行(例如匿名入口的访客)无法靠授予能力解决,只能调整流程结构。撤回本改动即恢复旧行为。
  • 要你做什么:无。

What changes

The rule: a child flow started from a subflow step, or from a map step for one of its items, admits the acting user against the child's requiredPermissions, with the same capability check a door that starts a flow by name asks (the door's rule 3).

  • One rule, not a second copy. Both steps call the engine's new childFlowStartRefusal, whose body (child-flow-start-admission.ts) asks requiredPermissionsStartRefusal from @objectstack/core — the rule-3 function flowStartRefusal (@objectstack/runtime) asks at every by-name door and a dry run asks of a draft. The capability arithmetic, the refusal's code (PERMISSION_DENIED) and its message are that function's. service-automation does not depend on runtime, which is why the shared rule lives in core.
  • Identity rule (the card's "explicit system-identity rule"). A door judges the caller, never the elevation of the flow it starts: flowStartRefusal admits only executionContext.isSystem === true and asks rule 3 of every other caller whether or not the flow runs as the system (packages/runtime/src/flow-start-admission.ts, the first line of flowStartRefusal, and rule 3's "elevated or not" in the module header). A step follows the same rule:
    • the acting user is the run's user (userId: the trigger's user, or the decider after a human decision), whatever the parent's runAs; their capabilities are read through the grants resolver run setup already uses (the read a dry run's admission makes);
    • a run that names no user and carries no caller's grants starts the child as the system principal does at this release: admitted, nothing read;
    • a run that names no user but carries a caller's grants (the guest behind an anonymous endpoint) holds no capability;
    • grants that cannot be read admit no declared capability (fail closed).
  • What the step answers. A failed step (a runtime failure, routable by a fault edge), carrying the door's refusal as the run's innerRefusal (code + message), so the door that answers the parent's failure names it in details.innerRefusal. The child never starts and has no run. map asks once per entry, before the entry starts its first item.
  • Child resolution. The child judged is the one execute runs: the name resolves for the calling flow's package exactly as RunFacet.execute resolves it. An unresolvable or refused name is not judged here; execute answers it as before.
  • Text. FlowSchema.requiredPermissions docblock and .describe(), the flow form's help text (all ten locales), content/docs/automation/flows.mdx, the regenerated reference pages, the liveness ledger note, and the doc comments of flow-start-admission.ts / flow-start-rules.ts now state the rule instead of "a subflow node is not a door".
  • Breaking (19.0). No opt-out and no shim, per the maintainer's ruling, Automation: subflow and map start a child flow without checking the child's requiredPermissions #33684 comment 7450613672. The changeset carries the upgrade note: grant the capability, or restructure; a run that names no user but carries a caller's grants is fixed only by moving the gate to the parent.

Tests

The pin subflow-required-permissions.test.ts, which asserted the old behaviour, is rewritten to the new rule on the real engine (13 cases), for each step: a member without the capability is refused and the child never starts, with the door's refusal as innerRefusal; a member holding it runs the child (map: both items); unreadable grants refuse; a start with no user and no caller grants runs as the system principal; a no-user caller with forwarded grants is refused. Plus: an elevated parent still judges the user it runs for; an ungated child runs, and the admission reads no grants for it (the resolver's calls are counted across the admission call alone, so run setup's own read of the parent's user does not mask it).

Readings on head 2360404ac (git rev-parse --short HEAD): src/subflow-required-permissions.test.ts Tests 13 passed (13); spec check:generated exit 0 (All 14 generated artifacts are up to date, against a spec dist built from this branch's spec source); check-i18n-bundles exit 0 (OK (10 package(s) — all bundles in sync). The commits after 1725a6516 change text only (doc comments, .describe() strings, form help, changeset, one test title, docs and regenerated reference pages); CI at 2360404ac: 76 check-runs, every one success or skipped, 0 failed. The suites below were read on the earlier heads named.

Suites
  • On head e88276c57: @objectstack/service-automation full suite, 4 shards: 307 files, 4579 tests passed (77/77/77/76 files; 1265/1209/1143/962 tests).
  • @objectstack/service-automation src/subflow-required-permissions.test.ts: Tests 13 passed (13); typecheck exit 0 (test layer: 0 errors).
  • @objectstack/spec full suite, 2 shards: 515 + 515 files; 16324 passed (4 todo) and 14784 passed (1 todo).
  • Earlier readings on head 1e47e3e44, not re-run (the later commits are comment, doc and test-only): @objectstack/runtime src/flow-start-required-permissions.test.ts 81 passed; @objectstack/platform-objects translations 30 files, 694 passed; @objectstack/core typecheck exit 0.
Ablation

The engine's childFlowStartRefusal body replaced on disk by Promise.resolve(null) (the steps admit every start, the old behaviour), pin re-run: 7 failed, 6 passed — every refusal case red, every admit case green. Restored: blob equal to HEAD, git diff HEAD empty, pin back to 13 passed.

On head e88276c57: the admission made to read the run user's grants before the ungated-child return, pin re-run: the ungated-child case goes red (expected [ 1 ] to deeply equal [ +0 ]). Restored with git checkout HEAD --, git status clean.

Acceptance notes

  • Surface beyond the claim's file list, declared: engine.ts (a one-line stub; the facade stays within its line ceiling, 7834 of 7835) and engine-run-facet.ts (the run facet's host gains the grants resolver) host the new module child-flow-start-admission.ts, the admission the two nodes call; flow.metadata-form.ts and the ten locale bundles of platform-objects carry the form help text that restated the old rule; liveness/flow.json (ledger note); comment-only edits in @objectstack/runtime (flow-start-admission.ts, its pin's header) and @objectstack/core (flow-start-rules.ts header); regenerated reference pages.

  • First-party impact: no example app or dogfood fixture declares a flow-level requiredPermissions, so nothing in-tree moves.

  • Skills-docs: skills/objectstack-automation/references/examples-flows.md still states the old rule; this PR is domain:server, so the edit is carried by skills: the automation flow examples say a subflow step is not checked against a child flow's requiredPermissions #39842 (the skills follow-up card).

  • NOT MEASURED locally on e88276c57 (CI owns each): check:query-options-erasure, check:slot-lookup, check:type-check-debt (repo-wide scans killed by a 150 s timeout on a loaded shared box, exit 124); check-plugin-teardown-shape --self-test, spec check:skill-examples, check:dual-build-cjs-loads, check:i18n, lint check:doc-formula-expressions and check:doc-security-posture (each refused its own build prerequisite, exit 3; no form help text changed after 1e47e3e44, where check:i18n read in sync). @objectstack/runtime full suite and typecheck: not run locally, the runtime diff is comment-only; Test Core covers it.

  • Review round 1 (L1 rework): the FlowUserGrants.systemPermissions and FlowUserGrantsResolver docblocks and the plugin bridge comment now name the child-start admission as a reader, and say an engine with no resolver wired refuses every gated child for a run that names a user; the AutomationResult.innerRefusal docblock lists the child start as a producer; the step's check is named the same capability check (changeset, FlowSchema docblock and .describe(), flows.mdx, regenerated reference pages; the form help text did not carry the sentence, so the ten locale bundles are unchanged); Clause-② is declared as narrowing in the changeset and here.

  • Review round 2 (L2 item 2; superseded in part by round 3): every public text for requiredPermissions now states all three cases a child start decides: a run that names a user is judged on that user's capabilities; a run that names no user and carries no caller's grants starts the child as the system principal does; a run that names no user but carries the positions or permission sets a door forwarded for its caller (the guest principal included) holds no capability, so a child that names any capability fails the step with the same refusal. Changed: the FlowSchema docblock and .describe(), the flow form's help text (English source and the nine translated locale bundles), content/docs/automation/flows.mdx, the regenerated reference pages, and the changeset, whose upgrade note now says such a run is fixed only by restructuring the flows (gating at the entry, or starting the child from a run that acts for a user) and that no switch restores the old behaviour.

  • Review round 2 (L2 items 1, ruled): the child-start admission now cites the maintainer's ruling Automation: subflow and map start a child flow without checking the child's requiredPermissions #33684 comment 7450613672, which supersedes the subflow pass-through clause of ruling record 6377848497 (letter A); the rest of 6377848497 still stands for the entry doors. Cited in the module header of child-flow-start-admission.ts (whose first sentence now says "the same capability check"), the header of subflow-required-permissions.test.ts, the liveness/flow.json note and the FlowSchema.requiredPermissions docblock. The runtime flow-start-admission.ts header and the @objectstack/core header keep 6377848497, which they cite for the doors.

  • Round 2 readings on head 1725a6516 (after a merge of origin/main at eecae948a): src/subflow-required-permissions.test.ts Tests 13 passed (13); @objectstack/service-automation typecheck exit 0; @objectstack/spec full suite, 2 shards: 515 + 515 files, 16324 passed (4 todo) and 14784 passed (1 todo) (taken on b6bbdc3ba; the later commit changes comments and a docblock only); spec check:generated exit 0 (all 14 artifacts up to date); check-i18n-bundles exit 0. dispatch-gates --commands derives 130 families; --ran: 130 derived famil(ies) accounted for — 126 run, 4 NOT-MEASURED (3 DERIVED from a recorded exit 3, 1 claimed), exit 0 (exit 3: check-plugin-teardown-shape --self-test, spec check:skill-examples, check:dual-build-cjs-loads; claimed: check:query-options-erasure, a 280 s timeout on the shared box). CI on 1725a6516: every check-run completed success or skipped, including Type Check · source gates, Lint & Repo Gates, TypeScript Type Check, Test Core and Lint · scoped · query-options erasure.

  • Review round 3 (L1 delta + L2 items, text only; no behaviour change): the flow form help now says a run with no user that carries a caller's grants is treated as holding none of the capabilities, so the step fails (English regenerated, de, es-ES, fr, pt-BR, ru and ar by hand; zh-CN, ja-JP and ko already said it is treated as holding none of them). The changeset names one fix for that run, moving the gate: the parent declares the list and the child declares none. The no-switch sentence now sits beside the BREAKING line. The two innerRefusal .describe() strings and the section 7a header in automation-api.zod.ts name the refused child start as the third producer, and the reference pages are regenerated. The FlowSchema text says grants that cannot be read admit no capability. Clause-② reads yes (narrowing) and names the widened AutomationEngine.childFlowStartRefusal, here and in the changeset. The child-flow-start-admission.ts header names the by-name doors' check, and the flow-start-rules.ts header cites Automation: subflow and map start a child flow without checking the child's requiredPermissions #33684 comment 7450613672 beside 6377848497. The admission header, the changeset, one pin's case title, the FlowSchema docblock and .describe(), flows.mdx and the regenerated reference pages state the no-user, no-grants case as current behaviour only (last commit 2360404ac).

Verification

Read first, by risk:

  1. packages/services/service-automation/src/child-flow-start-admission.ts — the identity rule (childFlowStartRefusal, the no-user branch).
  2. packages/services/service-automation/src/builtin/map-node.ts — the once-per-entry check before the item loop.
  3. packages/services/service-automation/src/engine.ts — childFlowStartRefusal, the host that resolves the child as execute does.

Two-minute check: pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/subflow-required-permissions.test.ts — expect Tests 13 passed (13).

Derived gates

node scripts/pm/dispatch-gates.mjs --commands on head 41448e5c2 derives 130 families; the --ran reconciliation reads: 130 derived famil(ies) accounted for — 124 run, 6 NOT-MEASURED (3 DERIVED from a recorded exit 3, 3 claimed), exit 0. Exit 3: check-plugin-teardown-shape --self-test, spec check:skill-examples, check:dual-build-cjs-loads. Claimed (a 200 s timeout on the shared box, exit 124): check-comment-mask-corpus, check:query-options-erasure, check:type-check-debt; CI owns each. check:nul-bytes, check:i18n, check:doc-authoring, spec check:docs exit 0. The two commits after 41448e5c2 change text only: 45ed364d8 a doc comment, a changeset sentence and a test title; 2360404ac the FlowSchema docblock and .describe(), flows.mdx and the two regenerated reference pages (CI's generated-artifact gate is green at 2360404ac).

🤖 Generated with Claude Code

https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX


Generated by Claude Code

…its the acting user against the child's requiredPermissions (#33684)

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
…flow or map step

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
… names the subflow and map check

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
… host, keeping the engine facade within its ceiling

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 5 package(s): @objectstack/core, @objectstack/platform-objects, @objectstack/runtime, @objectstack/service-automation, @objectstack/spec, touching 19 documentable anchor(s). ⚠️ 4 changed file(s) yielded no anchor (packages/core/src/security/flow-start-rules.ts, packages/runtime/src/flow-start-admission.ts, packages/spec/docs/references/api/automation-api.md, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via AutomationResult (symbol, a top-level interface))
  • content/docs/api/declarative-endpoints.mdx (via /api/v1/automation/:name/trigger (route, bridged from symbol TriggerFlowResponseSchema — its route source's handler names it))
  • content/docs/automation/flows.mdx (via AutomationResult (symbol, a top-level interface), FlowSchema (symbol, a top-level const), /api/v1/automation/:name/trigger (route, bridged from symbol TriggerFlowResponseSchema — its route source's handler names it))
  • content/docs/kernel/cluster.mdx (via AutomationEngine (symbol, a top-level class))
  • content/docs/protocol/kernel/http-protocol.mdx (via /api/v1/automation/:name/trigger (route, bridged from symbol TriggerFlowResponseSchema — its route source's handler names it))

⛔ 8 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v16.mdx (via AutomationEngine (symbol, a top-level class))
  • content/docs/releases/v17/17-0.mdx (via AutomationEngine (symbol, a top-level class), FlowSchema (symbol, a top-level const))
  • content/docs/releases/v17/17-1.mdx (via AutomationResult (symbol, a top-level interface))
  • content/docs/releases/v17/17-3.mdx (via AutomationResult (symbol, a top-level interface))
  • content/docs/releases/v17/17-4.mdx (via FlowSchema (symbol, a top-level const))
  • content/docs/releases/v17/17-6.mdx (via AutomationEngine (symbol, a top-level class), AutomationResult (symbol, a top-level interface))
  • content/docs/releases/v17/17-7.mdx (via FlowSchema (symbol, a top-level const))
  • content/docs/releases/v18/18-1.mdx (via FlowSchema (symbol, a top-level const))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 4 changed file(s) yielded no anchor (packages/core/src/security/flow-start-rules.ts, packages/runtime/src/flow-start-admission.ts, packages/spec/docs/references/api/automation-api.md, …) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: requiredPermissions (literal, 43 pages)
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 255 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 194 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 40bc10969da9b4609604cbaa00c8ca75146dbc6d → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 553156c6b4d54ee39e4388d95b40441312a24127 — the merge of head 2360404ac6e30032662fe162094aa12b9e9882d8 into base 40bc10969da9b4609604cbaa00c8ca75146dbc6d, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 553156c6b4d54ee39e4388d95b40441312a24127 && git checkout 553156c6b4d54ee39e4388d95b40441312a24127
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 40bc10969da9b4609604cbaa00c8ca75146dbc6d 2360404ac6e30032662fe162094aa12b9e9882d8 && git checkout -B drift-repro 40bc10969da9b4609604cbaa00c8ca75146dbc6d && git merge --no-ff 2360404ac6e30032662fe162094aa12b9e9882d8

node scripts/docs-audit/affected-docs.mjs --json 40bc10969da9b4609604cbaa00c8ca75146dbc6d

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 40bc10969da9b4609604cbaa00c8ca75146dbc6d → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX

Label · 2026-12-05T16:38Z. needs:dogfood-battery: the title carries ! (a narrowing with a breaking upgrade note), so the opt-in dogfood battery is owed on the head before landing.

…tart, and the step's check is named the capability check

The FlowUserGrants.systemPermissions and FlowUserGrantsResolver docblocks
name the subflow/map child-start admission as a reader, and say an
unwired engine refuses every gated child for a run that names a user.
The innerRefusal docblock lists the child start as a producer. The
changeset, flow.zod.ts and flows.mdx call the step's check the same
capability check, and the changeset declares Clause-2 as narrowing.
The open-child pin counts the grants reads across the admission alone.

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l and removed size/m labels Dec 5, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX

CI · 2026-12-05T17:45Z. Test Core (9/12) on head e88276c failed on one objectql test, protocol-unmanaged-import-rename-battery.test.ts, with "Test timed out in 5000ms". The other 648 objectql files passed, and this PR changes no file under packages/objectql. Re-running the failed jobs of run 47547547593 once through the relay. A second red is treated as real, and the timeout gets a card.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX

L1 (delta) · 2026-12-05 · head e88276c57: ACCEPT

  • An isolated reviewer checked each of the six round-1 items at this head, and all are resolved:
    • the grants-contract TSDoc and its bridge comment;
    • Skills-docs: follow-up #39842;
    • Clause-②: no (narrowing);
    • the "same capability check" wording, with generated pages up to date;
    • the innerRefusal docblock;
    • the tightened ungated-child assertion, which goes red when the admission reads grants.
  • The main merge 22cd5c807 leaves the PR's own lines byte-identical. The pin file reads 13 passed in a scratch worktree. CI is green at this head.
  • Two nits, neither blocking: one header line in the admission module could use the same wording; and the runtime and platform-objects suites were not re-run (the delta is comment- and doc-only).
  • Next: the contract review (L2) at the contract-review tier is owed, after that tier's reset (03:00 UTC). Then the PR goes ready for the maintainer.

…uiredPermissions

The FlowSchema text, the form help, the flows page and the changeset now
name the third case: a run that names no user but carries the grants a
door forwarded for its caller holds no capability, so a gated child
refuses it. The changeset's upgrade note states that only restructuring
the flows fixes such a run.

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
…ow form help text bundles

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
…dPermissions text

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
…flow pass-through clause

The child-start admission's module header, its pin's header, the liveness
note and the FlowSchema docblock now cite #33684 comment 7450613672, which
supersedes the subflow pass-through clause of ruling record 6377848497;
the rest of 6377848497 still stands for the entry doors.

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1725a65169aef28deb75408db943473d9daa583e
Local-runs: none
Scope: packages/spec/src/automation/flow.metadata-form.ts, packages/spec/src/automation/flow.zod.ts, packages/spec/src/contracts/automation-service.ts + packages/services/service-automation/src/child-flow-start-admission.ts, packages/services/service-automation/src/builtin/subflow-node.ts, packages/services/service-automation/src/builtin/map-node.ts, packages/services/service-automation/src/engine.ts, packages/services/service-automation/src/engine-run-facet.ts, packages/services/service-automation/src/engine-extension-contracts.ts, packages/services/service-automation/src/plugin.ts, packages/services/service-automation/src/subflow-required-permissions.test.ts, packages/core/src/security/flow-start-rules.ts, packages/runtime/src/flow-start-admission.ts, packages/runtime/src/flow-start-required-permissions.test.ts, packages/spec/liveness/flow.json, packages/spec/docs/references/api/automation-api.md, the ten packages/platform-objects/src/apps/translations/*.metadata-forms.generated.ts bundles; prose faces read as well: .changeset/33684-child-flow-start-admission.md, content/docs/automation/flows.mdx, content/docs/references/automation/flow.mdx
Security-touching: yes

This is the first contract-review record on this PR, and a complete one (①②③④). I read the diff at this head, card #33684, ruling comment 7450613672 and the clause of 6377848497 it supersedes, the PR body, and the check-runs at this head. Every check-run is success or skipped.

  • must-fix: none

① Derived judgments

The FlowSchema.requiredPermissions docblock and .describe(), the flow form help, flows.mdx and the regenerated reference pages all state the three cases childFlowStartRefusal decides:

  • A run that names a user is judged on that user's capabilities.
  • A run that names no user and carries no caller's grants starts the child as the system principal does.
  • A run that names no user but carries the grants a door forwarded holds no capability.

The check is requiredPermissionsStartRefusal in @objectstack/core, written once. A pin asserts that the step's refusal equals the door's. A child that names no capability is admitted with nothing read, and that is pinned too.

  • S1 (should-fix) — packages/spec/src/api/automation-api.zod.ts still lists two producers of innerRefusal. The list appears in both innerRefusal .describe() strings and in the section 7a header. This PR adds a third producer, a subflow or map step's refused child start, but updates only the AutomationResult.innerRefusal docblock. Name the third producer in those three places and regenerate.
  • N6 (nit) — the FlowSchema text does not say that grants which cannot be read admit no capability. The changeset and the module header do say it.

② Semver level

  • minor on service-automation, spec and platform-objects follows Metadata-protocol: semantic and matches the sibling breaking changesets on 19.0.0-next. Core and runtime change only comments.
  • Metadata-protocol: semantic is right. No key, value or type moves. The meaning of requiredPermissions now reaches two steps.
  • S3 (should-fix) — AutomationEngine, exported from the package entry, gains the public method childFlowStartRefusal(flowName, context). Fleet precedent declares a new public engine member as a widening. The line should read Clause-②: yes (narrowing) and name the widened member, in the PR body and in the changeset body. No level moves.
  • ADR-0087 not-required (no-migration-prescription) is admissible for semantic, and the registration gate is green.
  • N1 (nit) — a D3 semantic entry would bring this change into the generated upgrade guide. Suggested as a follow-up card.
  • The upgrade note gives "grant or restructure" for a run that names a user, and "only restructuring" for a no-user run with forwarded grants. No switch exists.
  • N2 (nit) — lift the no-switch sentence up beside the BREAKING line.

③ Boundary flags

  • Identity rule against flowStartRefusal. For every run that names a user, the step agrees with the door whatever the parent's runAs; the elevated-parent case pins this. An AI service account resolves to no capability, as it does at a door.
  • N4 (nit, accepted deviation) — for the guest principal the step is stricter than a door. The published text says so and names restructuring as the fix.
  • S2 (should-fix) — a security item is with the owner seat. It closes by the maintainer's word recorded on the card, and by a delta only if code changes.
  • SQL push-down. No new query shape. There is one grants read per gated child start through the existing resolver, and none for an ungated child or a run with no user.
  • Tests are real. Thirteen cases run on the real engine with the real subflow and map executors. By reading, the stated ablation turns the seven refusal cases red.
  • N3 (nit) — four arms are unpinned:
    • no resolver wired;
    • a resolver answering without systemPermissions;
    • caller grants carried as permission sets alone;
    • a map re-entry after a paused item.
  • Public text. The title, body, changeset, test names and commits stay at rule level.
  • N5 (nit, PR body) — "What changes" should state only the rule a step asks. The list of door questions a step does not ask adds nothing the card needs.

④ Design judgment

Reusing the by-name start rule at the step seam fits the ruling: one rule function, three askers, no second copy. The child judged is the one execute runs, resolved the same way. The subflow step is asked on the child context before engine.execute, so every nesting level is asked. The map step is asked before the item loop on each entry that still has items, so a re-entry asks again. A refusal is a plain failed step that carries the door's refusal as innerRefusal. The ruling is met clause by clause: the same capability check, refusal before the child starts, no opt-out, and a restructuring upgrade note. The superseded pass-through clause is gone from the spec, the form, the docs, the ledger note and the code comments. The skills example is carried by #39842.

Implemented-by: claude/issue-33684-child-flow-start-admission
Reviewed-by: session_017xRBcV4xBHWbZEmo3HuvyX

VERDICT: PASS

…ve-the-gate fix, third innerRefusal producer

The form help says a no-user run carrying a caller's grants is treated as
holding none of the capabilities, so the step fails; the changeset names
moving the gate as the only fix for that run and lifts the no-switch
sentence beside the BREAKING line; the innerRefusal texts name the refused
child start as a third producer; FlowSchema says unreadable grants admit no
capability; the Clause-② line declares the widened engine member.

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
…equiredPermissions text

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
…reated-as wording

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
… behaviour only

The admission header, the changeset and the pin's case title no longer
present that case as a settled, enumerated rule; they state what a step
does at this release.

Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 2360404ac6e30032662fe162094aa12b9e9882d8
Local-runs: none
Scope: packages/spec/src/api/automation-api.zod.ts, packages/spec/src/automation/flow.metadata-form.ts, packages/spec/src/automation/flow.zod.ts, packages/spec/src/contracts/automation-service.ts + packages/services/service-automation/src/child-flow-start-admission.ts, packages/services/service-automation/src/builtin/subflow-node.ts, packages/services/service-automation/src/builtin/map-node.ts, packages/services/service-automation/src/engine.ts, packages/services/service-automation/src/engine-run-facet.ts, packages/services/service-automation/src/engine-extension-contracts.ts, packages/services/service-automation/src/plugin.ts, packages/services/service-automation/src/subflow-required-permissions.test.ts, packages/core/src/security/flow-start-rules.ts, packages/runtime/src/flow-start-admission.ts, packages/runtime/src/flow-start-required-permissions.test.ts, packages/spec/liveness/flow.json, packages/spec/docs/references/api/automation-api.md, the ten packages/platform-objects/src/apps/translations/*.metadata-forms.generated.ts bundles; prose faces read as well: .changeset/33684-child-flow-start-admission.md, content/docs/automation/flows.mdx, content/docs/references/automation/flow.mdx
Security-touching: yes

This is a delta record on 1725a6516..2360404ac (five commits, 17 files, +49/−41), and it stands on the complete record at 1725a6516. I read the delta, the full diff against the base for public text, the PR body, the earlier records and the check-runs at this head.

The delta is text only. Every changed line is one of: a doc comment, a .describe() string, a form helpText string, a changeset sentence, one test title, a docs table cell, or a regenerated page or bundle. No statement, signature, schema key, type or assertion moves.

Open findings: none.

Closure of the earlier items:

  • L1 item (a): closed. The English form help reads "such a run is treated as holding none of these capabilities, so the step fails". The ar, de, es-ES, fr, pt-BR and ru bundles carry the same two clauses. See nit N7 for ja-JP, ko and zh-CN.
  • L1 item (b): closed. The changeset names one fix for a run with no user that carries a caller's grants: move the gate to the entry, so the parent declares the list and the child declares none.
  • S1: closed. Both innerRefusal .describe() strings and the section 7a docblock in automation-api.zod.ts name the refused child start as the third producer. The regenerated automation-api.md carries both strings, and no copy of the two-producer text remains outside history.
  • S2: closed by maintainer ruling; carried separately.
  • S3: closed. The line reads Clause-②: yes (narrowing) — widened: the public AutomationEngine.childFlowStartRefusal(flowName, context) method, identical in the PR body and the changeset. The fleet's reader (readClause2Line) reads both as declared, yes, arm narrowing. The method is a public member of AutomationEngine at this head.
  • N2 and N6 from the earlier record: taken. The no-switch sentence sits beside the BREAKING line, and the FlowSchema text says grants that cannot be read admit no capability.

① Derived judgments

  • The FlowSchema.requiredPermissions docblock and .describe(), flows.mdx and both regenerated reference pages state the case of a run that names no user and carries no caller's grants as behaviour: it is admitted, as the system principal is at a door. No origin of such a run is listed in any of them.
  • The changeset and the admission module's header state the same case as what a step does at this release.
  • The three cases, the fail-closed line and the "same capability check" wording agree across the spec source, the form help, the docs and the changeset.
  • N7 (nit): the ja-JP, ko and zh-CN form help say such a run is treated as holding none of the capabilities, and stop there. They omit the "so the step fails" clause the English source now carries. The meaning is not wrong, and the next translation pass can add it.

② Semver level

  • No level moves in the delta. minor on service-automation, spec and platform-objects with Metadata-protocol: semantic stands as judged at 1725a6516.
  • The Clause-② line now declares both the widening (one public engine method) and the narrowing, and both carriers agree.
  • The upgrade note is consistent: grant or restructure for a run that names a user; move the gate to the entry for a run with no user that carries a caller's grants; no switch.

③ Boundary flags

  • Public text. In the PR's added lines, a grep for origin lists of the no-user, no-grants case finds none in comments, the changeset, docs, test titles or commit messages. The schedule and write wording that remains in the touched files belongs to the runAs text, which this PR does not add.
  • N8 (nit): two inline comments in child-flow-start-admission.ts keep older wording than the module's header. Neither lists an origin.
  • Tests. The pin file holds 13 cases at this head (one, five for each of the two steps, and two). The delta changes one title and no assertion.
  • CI at the head. 76 check-runs, all completed, each success or skipped. Success includes Test Core (12 shards), TypeScript Type Check, Type Check · source gates, Lint & Repo Gates, Lint · docs & code guards, Spec property liveness, Check Changeset, Governed Surface Queue Guard, PR-body guards and the opt-in dogfood battery.
  • SQL push-down. No change. The delta touches no query.
  • N9 (nit, PR body; fixed in the body after this read): the "Readings" paragraph and the "Derived gates" block named 45ed364d8 as the head and the last commit. The head is one commit later, 2360404ac, which changes the FlowSchema text, flows.mdx and the regenerated reference pages. CI at the head covers the generated-artifact gate. The body's test count, engine line count and Clause-② line match the head.

④ Design judgment

The design is unchanged from the record at 1725a6516: one rule function, three askers, no second copy, a refusal before the child starts, and a plain failed step that carries the door's refusal. The delta improves the published text in three ways. The inner-refusal contract now lists every producer. The form help states the consequence for the author. The no-user, no-grants case is written as what a step does, and no longer as a list of who causes it.

Implemented-by: claude/issue-33684-child-flow-start-admission
Reviewed-by: session_017xRBcV4xBHWbZEmo3HuvyX

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX

维护者速读

  • 是什么:流程里的子流程(subflow)和循环(map)步骤,在启动设了 requiredPermissions 的子流程之前,用和入口完全相同的规则检查当前操作人。没有权限,这一步失败。
  • 影响:BREAKING。凡是靠父流程绕过子流程权限才跑得通的组合,从这版起会被拒,没有开关可以恢复。改法:给发起人授权,或把门槛挪到入口。
  • 验证:13 项测试全过,消融测试按预期变红;契约审核档复审 PASS,CI 0 失败。
  • 要你做什么:批准合入。PASS 记录见评论 7452843343,Head-sha 2360404ac6e30032662fe162094aa12b9e9882d8。

席位核对

ACCEPT · head 2360404a · read 2026-12-06T06:36Z

  • Shape: ready, targets main, Fixes #33684. The ruling on Automation: subflow and map start a child flow without checking the child's requiredPermissions #33684 (comment 7450613672) supersedes the subflow clause of 6377848497. Clause-②: yes (narrowing) names the widened public AutomationEngine.childFlowStartRefusal. Metadata-protocol: semantic.
  • Premise measured: 13 pins pass. The ablations recorded in the body red the step cells. The runtime door's admission logic is unchanged; only one doc comment there changed.
  • Gates (check-runs at 2360404ac): 76 check-runs, every one success or skipped, 0 failed. Test Core 12/12, both Type Check lanes, source gates (check:docs), Lint, Spec property liveness and Check Changeset all success.
  • Accepted deviations: L2 nits N7-N9. N9 is fixed in the body. N7 (three locales are less explicit) goes to the next translation pass.
  • Out of scope: Skills-docs: follow-up #39842. A separate follow-up is carried by the security seat.
  • Landing: lands by the maintainer, because it declares a narrowing. check-governed-merges --pr 39839: not governed, 573 lines ≤ 3000. Contract review PASS: comment 7452843343.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX

Hand-off to the maintainer: this PR declares a narrowing and lands by the maintainer. The seat ACCEPT and a same-head contract-review PASS are on this thread; the 维护者速读 is in the seat record above. Requesting review.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Dec 6, 2026
@objectstack-fleet
objectstack-fleet Bot requested a review from os-zhuang December 6, 2026 06:36
@os-zhuang
os-zhuang added this pull request to the merge queue Dec 6, 2026
Merged via the queue into main with commit 80ff391 Dec 6, 2026
90 of 92 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-33684-child-flow-start-admission branch December 6, 2026 07:14
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX

Merged as 80ff391ca; pm:awaiting-merge removed.

@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation needs:dogfood-battery size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automation: subflow and map start a child flow without checking the child's requiredPermissions

3 participants