Skip to content

fix(portal): persist governed Custom model selection - #357

Merged
FumingZhang merged 5 commits into
mainfrom
fix/custom-sandbox-model-selection
Oct 30, 2026
Merged

FumingZhang merged 5 commits into
mainfrom
fix/custom-sandbox-model-selection

Conversation

@FumingZhang

Copy link
Copy Markdown
Member

Summary

Persist explicit, currently permitted model-source switches when the Portal creates a Sandbox-bound Custom Agent. Previously the Custom early return omitted spec.modelAccess; the Sandbox API correctly defaulted both sources off, leaving the Agent at NoModelEntitlement even when its policy and Gateway offered a shared model.

Reuse the existing policy/catalog checks and request handling. Custom images do not require a built-in OpenClaw/Hermes catalog profile; their separate Operator image approval remains unchanged. Add ten creation regressions and update the contract and Pi manifest example.

Related issue

Focused follow-up to #354, discovered during authorized isolated validation. This PR targets feat/custom-sandbox-runtime so its diff contains only this repair. It should accompany #354; it does not merge or replace that PR.

Validation

Offline checks used Go 1.27.3, Helm 3.22, Node 24.18.0, npm 12.0.1 and Hugo 0.164.0 extended. Commands below are relative to the repository root.

Command: go -C app/cetirun-portal test ./internal/handler -run '^TestCreateCustomSandboxModelSelection$' -count=1
Result: reproduced the missing model selection and validation failures before the repair.

Command: npm --prefix app/cetirun-portal/web ci --offline --ignore-scripts --no-audit --no-fund
Result: passed; restored locked dependencies after the new worktree's frontend build reported missing tsc.

Command: npm --prefix app/cetirun-portal/web run build
Result: passed, including TypeScript checking; existing bundle-size advisory remains.

Command: go -C app/cetirun-portal test ./... -count=1
Result: passed. Initial attempt lacked embedded frontend assets and used an older ambient Helm; the same full suite passed after building assets and selecting the pinned toolchain.

Command: go -C app/cetirun-portal test -race ./internal/handler -run 'TestCreate(CustomSandboxModelSelection|PersistsEffectiveModelDefaultsAndPolicyBinding|InstanceAIGateway)' -count=1
Result: passed.

Command: go -C app/cetirun-portal vet ./...
Result: passed.

Command: go -C app/cetirun-portal build ./...
Result: passed.

Command: make docs-check
Result: passed, including 43 generated HTML pages. Initial attempt selected an older ambient Go; the same gate passed with the pinned toolchain.

Command: git diff --cached --check
Result: passed.

Not run: real external provider sign-ins, Entra federation/OBO, or Copilot inference. These need separate provider prerequisites.

Authorized live evidence: two owner-created Custom Agents on separate runtime backends reproduced the missing selection before this fix. Both were deleted through their ordinary owner APIs; their Agents and namespaces were confirmed absent. The patched live rerun is still pending and is not claimed as passed here. No deployment configuration, raw diagnostics or credentials are attached.

Compatibility and operational impact

Only Sandbox-bound Custom creation changes. It now records effective source switches and rejects unavailable or unauthorized model selections before creating resources, like managed Agent creation. Existing Custom without a Sandbox retains its previous behavior. Direct Agent manifests still need explicit model-source switches; the fail-closed API defaults are unchanged.

No CRD, dependency, Operator authorization, image-approval or storage change. Existing blocked Agents are not silently granted model access. Maintainer review is required; the new PR's CLA and CI checks must complete independently.

Checklist

  • The change is focused and preserves unrelated work.
  • Tests cover the changed behavior, or I explained why no new test is needed.
  • Documentation and examples match any public behavior changes.
  • Generated artifacts were updated from source, or none are affected.
  • Dependency changes include lockfiles, source attribution, and license information, or none are affected.
  • I checked the diff and attachments for secrets, private endpoints or identifiers, customer data, agent conversations, and internal information.
  • I followed the applicable CLA instructions, or asked a maintainer about an unclear check.
  • I identified checks that need credentials or a live environment and did not run them without authorization.

FumingZhang and others added 4 commits October 29, 2026 06:58
Reuse the common executor for governed Custom creation, retained lifecycle, typed Gateway and network controls, private Chat and isolated terminal access. Preserve image entrypoints and non-root identities while retaining existing managed and non-Sandbox behavior.\n\nInclude generated policy schemas, Portal wiring, static probe packaging and offline regression coverage. Keep unsupported identity, mTLS and desktop combinations fail-closed and document the live qualification boundary.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Retain Custom ingress and terminal contracts alongside native identity pinning and expectation validation. Update the Entra renderer tests for the shared validation signature and preserve fail-closed handling of unsupported Custom Entra projection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Yield to the Node scheduler within act before arming the window access trap. Preserve the stale-dispatch negative control and late Chat completion assertions without retries or a longer timeout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Record current policy-authorized model sources for Sandbox-bound Custom creation instead of leaving both fail-closed switches unset. Keep ungoverned Custom behavior, image approval, and ordinary Sandbox defaults unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@feiskyer Pengfei Ni (feiskyer) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Base automatically changed from feat/custom-sandbox-runtime to main October 29, 2026 23:19
Resolve #357 post-squash documentation conflicts while preserving the original governed model-selection patch and current main changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@FumingZhang
FumingZhang merged commit d37cc87 into main Oct 30, 2026
33 checks passed
@FumingZhang
FumingZhang deleted the fix/custom-sandbox-model-selection branch October 30, 2026 01:11
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