fix(cloud): restore disabled Box production mode

This commit is contained in:
dadachann
2026-08-01 04:11:17 +00:00
parent 2456bf1350
commit c7d14676fc
3 changed files with 22 additions and 22 deletions
-19
View File
@@ -57,22 +57,3 @@ jobs:
${{ env.CLOUD_IMAGE }}:deploy-prod ${{ env.CLOUD_IMAGE }}:deploy-prod
cache-from: type=gha,scope=cloud-core-prod cache-from: type=gha,scope=cloud-core-prod
cache-to: type=gha,mode=max,scope=cloud-core-prod cache-to: type=gha,mode=max,scope=cloud-core-prod
- name: Configure SSH
env:
SSH_KEY: ${{ secrets.JP09_SSH_KEY }}
KNOWN_HOSTS: ${{ secrets.JP09_KNOWN_HOSTS }}
run: |
install -m 700 -d ~/.ssh
install -m 600 /dev/null ~/.ssh/id_ed25519
printf '%s\n' "$SSH_KEY" > ~/.ssh/id_ed25519
printf '%s\n' "$KNOWN_HOSTS" > ~/.ssh/known_hosts
- name: Upload release manifest and deploy
env:
HOST: ${{ secrets.JP09_HOST }}
USER: ${{ secrets.JP09_USER }}
PORT: ${{ secrets.JP09_PORT }}
run: |
remote="$USER@$HOST"
ssh -p "$PORT" "$remote" 'install -d -m 700 /opt/langbot-cloud-prod'
scp -P "$PORT" deploy/prod/docker-compose.yml deploy/prod/deploy.sh "$remote:/opt/langbot-cloud-prod/"
ssh -p "$PORT" "$remote" "chmod 700 /opt/langbot-cloud-prod/deploy.sh && /opt/langbot-cloud-prod/deploy.sh prod-${GITHUB_SHA}"
+8 -2
View File
@@ -138,8 +138,14 @@ class VerifiedCloudDeployment:
if plugin_worker.get('require_hard_limits') is not True: if plugin_worker.get('require_hard_limits') is not True:
raise CloudBootstrapError('Cloud Runtime requires plugin.worker.require_hard_limits=true') raise CloudBootstrapError('Cloud Runtime requires plugin.worker.require_hard_limits=true')
box_config = config.get('box', {}) box_config = config.get('box', {})
if box_config.get('enabled') is not True: box_enabled = box_config.get('enabled')
raise CloudBootstrapError('Cloud runtime requires box.enabled=true') if box_enabled is False:
# Explicitly disabling Box removes the sandbox surface entirely and
# therefore does not weaken tenant isolation. Validate the strict
# runtime/admission contract only when the surface is enabled.
return
if box_enabled is not True:
raise CloudBootstrapError('Cloud runtime requires box.enabled to be an explicit boolean')
if box_config.get('backend') != 'nsjail': if box_config.get('backend') != 'nsjail':
raise CloudBootstrapError('Cloud runtime requires box.backend=nsjail') raise CloudBootstrapError('Cloud runtime requires box.backend=nsjail')
runtime_endpoint = str(box_config.get('runtime', {}).get('endpoint', '') or '').strip() runtime_endpoint = str(box_config.get('runtime', {}).get('endpoint', '') or '').strip()
+14 -1
View File
@@ -228,10 +228,23 @@ async def test_cloud_pgvector_contract_is_fail_closed(pgvector_config, message):
) )
async def test_cloud_runtime_allows_explicitly_disabled_box():
config = _cloud_config()
config['box']['enabled'] = False
deployment = await resolve_deployment(
instance_uuid='instance-a',
instance_config=config,
entry_points=lambda: _EntryPoints([_EntryPoint(_Provider())]),
now=1_000,
)
assert isinstance(deployment, VerifiedCloudDeployment)
@pytest.mark.parametrize( @pytest.mark.parametrize(
('mutate', 'message'), ('mutate', 'message'),
[ [
(lambda config: config['box'].update(enabled=False), 'box.enabled=true'),
(lambda config: config['box'].update(backend='docker'), 'box.backend=nsjail'), (lambda config: config['box'].update(backend='docker'), 'box.backend=nsjail'),
(lambda config: config['box']['runtime'].update(endpoint=''), 'box.runtime.endpoint'), (lambda config: config['box']['runtime'].update(endpoint=''), 'box.runtime.endpoint'),
( (