Skip to content

feat(authoring) (2/5): runtime bindings, execution adapters and docker isolation - #1003

Open
zjncs wants to merge 1 commit into
iflytek:mainfrom
zjncs:feat/authoring-execution
Open

zjncs wants to merge 1 commit into
iflytek:mainfrom
zjncs:feat/authoring-execution

Conversation

@zjncs

@zjncs zjncs commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Layer (b1) of the authoring platform split (#934), stacking on the merged #935. This is the first half of the split runtime layer — the second half (b2: MCP probing and the security policies, the dedicated security-review surface) stacks on this branch and is linked in #934.

What this layer adds

Runtime bindings

  • RuntimeBinding per draft: agent type, config, tool allowlist — validated at save time, persisted as JSONB, managed via GET/PUT /drafts/{id}/runtime. MCP server declarations are validated structurally (name/transport/endpoint format); the SSRF policy, stdio gate and envRef allowlist arrive with (b2).

Execution

  • CONFIG layer: validation.yaml spec parsing (defensive YAML) + assertion syntax checks
  • BEHAVIOR layer: script tasks through the local-script adapter — inline (cleared environment, isolated workspace, interpreter allowlist, path confinement) or docker (locked container: no network, dropped capabilities, read-only root, memory/cpu/pids caps, tmpfs). The workspace permissions and uid:gid mapping keep container files readable and deletable on hardened hosts (umask 077) — found via hosted-runner CI, masked by Docker Desktop locally.
  • The orchestrator keeps every piece of the upstream lifecycle hardening: one FutureTask per run, wall-clock watchdog, settle-first cancellation with worker interrupt.

Verification

  • Spec-parser and assertion-evaluator suites: 20 tests
  • Docker isolation against real containers: 4 tests (auto-skip without a daemon)
  • The upstream ValidationRunOrchestratorTest lifecycle suite passes against the extended constructor: 5 tests
  • AuthoringExecutionFlowIntegrationTest (Testcontainers PostgreSQL): script-only three-layer validation with inline execution — 40 files, +2.9k lines

Copilot AI balanced review requested due to automatic review settings October 22, 2026 05:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@zjncs

zjncs commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Synced onto the latest main (21 commits, incl. #1006–#1008) and folded in the deployment-environment authorization hardening (thank you — the shared ScriptEnvironmentPolicy through both the validator and the adapter is exactly the right shape). Everything green on the merged head: focused suites for the execution layer, the environment authorization tests, docker isolation, and the upstream lifecycle suite.

The security layer (b2) stacked on top now merges the two policies cleanly: RuntimeBindingValidator takes the environment policy and the SSRF security policy side by side — each layer's policy stays independently testable, and your environment tests run against the combined constructor with a permissive security stub. 62 focused tests green on that head, including the full security surface. Stack state is in #934.

…ation

Layer (b1) of the authoring platform (iflytek#934), the first half of the split
runtime layer:

- **Runtime bindings**: agent type + config + tool allowlist per draft,
  persisted as JSONB and structurally validated at save time, managed via
  GET/PUT /drafts/{id}/runtime. MCP server declarations are validated
  structurally (name/transport/endpoint format); the SSRF policy, stdio
  gate and envRef allowlist that guard them arrive with the MCP+security
  layer.
- **CONFIG and BEHAVIOR validation layers**: validation.yaml spec parsing
  (defensive YAML), assertion syntax checks; script tasks execute through
  the local-script adapter — inline (cleared environment, isolated
  workspace, interpreter allowlist, path confinement) or docker (locked
  container: no network, dropped capabilities, read-only root, resource
  caps, tmpfs; workspace permissions and uid:gid mapping so container
  files stay readable and deletable on hardened hosts).
- The orchestrator keeps every piece of the upstream lifecycle hardening:
  one FutureTask per run, wall-clock watchdog, settle-first cancellation.

Verified: spec-parser and assertion-evaluator suites (20), docker
isolation against real containers (4, auto-skipped without a daemon),
the upstream orchestrator lifecycle suite against the extended
constructor (5), and the execution flow integration test (script-only
three-layer validation with inline execution).

Signed-off-by: zjncs <18910855655@163.com>
@zjncs
zjncs force-pushed the feat/authoring-execution branch from 8c6fcbd to 4861213 Compare October 27, 2026 07:01
@zjncs

zjncs commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main again (31 commits incl. the Korean web localization and dsh 0.5.0 releases) — head is 4861213, your environment-authorization commit preserved. Focused suites green on the new head (execution flow, environment authorization, docker isolation, lifecycle, migration guardrail — 26 tests).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants