Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/openshell-smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: OpenShell gateway smoke

# Opt-in live check of the OpenShell fleet integration against a REAL gateway.
# The job runs only when a repository administrator configures gateway access;
# otherwise every step skips and pull requests stay green.
#
# How to enable (repository secrets, set once by an administrator):
# OPENSHELL_SMOKE_GATEWAY_URL the gateway control-plane base URL (https)
# OPENSHELL_SMOKE_GATEWAY_CREDENTIAL the bearer credential the gateway's OIDC
# token provider returns to the OpenShell SDK
# Optional repository variable:
# OPENSHELL_SMOKE_TEMPLATE sandbox template to spawn; unset falls
# back to a worker-labeled template listed
# by the gateway.
# What the gateway must expose: health, sandbox template listing, sandbox
# create/wait/get/delete, and label filtering on `t3-managed-by`.
# Budget: the script defaults to 900 seconds (OPENSHELL_SMOKE_TIMEOUT_SECS).

on:
workflow_dispatch:
schedule:
# Avoid minute zero, when GitHub scheduled jobs are busiest.
- cron: "17 4 * * 1"
pull_request:
paths:
- "packages/openshell/**"
- "apps/server/src/environment/**"
- "scripts/openshell-smoke.ts"
- ".github/workflows/openshell-smoke.yml"

permissions:
contents: read

concurrency:
group: openshell-smoke-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
smoke:
name: Gateway smoke
runs-on: ubuntu-24.04
timeout-minutes: 25
steps:
# Same presence pattern as the EXPO_TOKEN check in mobile-eas-production.yml.
- id: smoke-secrets
name: Check for gateway secrets
env:
SMOKE_URL: ${{ secrets.OPENSHELL_SMOKE_GATEWAY_URL }}
SMOKE_CREDENTIAL: ${{ secrets.OPENSHELL_SMOKE_GATEWAY_CREDENTIAL }}
run: |
if [ -n "$SMOKE_URL" ] && [ -n "$SMOKE_CREDENTIAL" ]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
echo "OPENSHELL_SMOKE_GATEWAY_URL and OPENSHELL_SMOKE_GATEWAY_CREDENTIAL are not configured; skipping the live gateway smoke."
fi

- name: Checkout
if: steps.smoke-secrets.outputs.present == 'true'
uses: actions/checkout@v6

- name: Setup Vite+
if: steps.smoke-secrets.outputs.present == 'true'
uses: ./.github/actions/setup-ci-deps
with:
task-cache-read-token: ${{ secrets.T3_TASK_CACHE_READ_TOKEN }}

- name: Run the gateway smoke
if: steps.smoke-secrets.outputs.present == 'true'
env:
OPENSHELL_SMOKE_GATEWAY_URL: ${{ secrets.OPENSHELL_SMOKE_GATEWAY_URL }}
OPENSHELL_SMOKE_GATEWAY_CREDENTIAL: ${{ secrets.OPENSHELL_SMOKE_GATEWAY_CREDENTIAL }}
OPENSHELL_SMOKE_TEMPLATE: ${{ vars.OPENSHELL_SMOKE_TEMPLATE }}
run: node scripts/openshell-smoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import { useSettingsEnvironmentFilter, type SettingsTarget } from "./settings-en
import {
changeDraftProject,
editDraft,
leavesSandboxWorkspace,
parseIntervalMinutes,
scheduledTaskDefaultModel,
scheduleFromDraft,
Expand Down Expand Up @@ -891,11 +892,13 @@ function TaskForm({
? { type: "root" }
: draft.workspace === "existing_worktree"
? { type: "existing_worktree", worktreePath: draft.checkoutPath.trim() }
: {
type: "worktree",
baseRef: worktreeBaseRef,
startFromOrigin: draft.startFromOrigin,
},
: draft.workspace === "sandbox"
? { type: "sandbox" }
: {
type: "worktree",
baseRef: worktreeBaseRef,
startFromOrigin: draft.startFromOrigin,
},
// Tasks have no mode picker; a mode above the administrator's ceiling is refused.
runtimeMode:
clampManagedRuntimeMode(config?.managedPolicy, draft.runtimeMode) ?? draft.runtimeMode,
Expand Down Expand Up @@ -1091,9 +1094,20 @@ function TaskForm({
? gt("New worktree")
: draft.workspace === "root"
? gt("Project checkout")
: gt("Specific checkout")
: draft.workspace === "sandbox"
? gt("Fleet worker sandbox")
: gt("Specific checkout")
}
actions={[
...(draft.storedSandbox
? [
{
id: "sandbox",
title: gt("Fleet worker sandbox"),
state: draft.workspace === "sandbox" ? ("on" as const) : undefined,
},
]
: []),
{
id: "worktree",
title: gt("New worktree"),
Expand All @@ -1111,10 +1125,22 @@ function TaskForm({
},
]}
onSelect={(id) => {
if (id === "worktree" || id === "root" || id === "existing_worktree")
if (
id === "worktree" ||
id === "root" ||
id === "existing_worktree" ||
id === "sandbox"
)
setDraft((current) => ({ ...current, workspace: id }));
}}
/>
{leavesSandboxWorkspace(draft) ? (
<Text className="px-4 pb-3 text-sm text-warning-foreground">
<T>
Future runs will no longer use the fleet worker sandbox this task is paired with.
</T>
</Text>
) : null}
{draft.workspace === "worktree" ? (
<PickerRow
label={gt("Base branch")}
Expand Down
53 changes: 52 additions & 1 deletion apps/mobile/src/features/settings/scheduledTaskDraft.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { describe, expect, it } from "vite-plus/test";
import {
DEFAULT_SERVER_SETTINGS,
type ScheduledTask,
type ServerConfig,
ProviderDriverKind,
ProviderInstanceId,
ProjectId,
ScheduledTaskId,
type ScheduledTask,
} from "@t3tools/contracts";
import {
createDraft,
editDraft,
hasScheduledTaskDraftChanges,
leavesSandboxWorkspace,
scheduledTaskDefaultModel,
DEFAULT_SCHEDULE,
scheduleDraftForTask,
Expand Down Expand Up @@ -245,3 +247,52 @@ describe("scheduled task worktree base", () => {
).toBe("release");
});
});

describe("sandbox workspace retention", () => {
const task = (workspaceStrategy: ScheduledTask["workspaceStrategy"]): ScheduledTask => ({
id: ScheduledTaskId.make("task"),
title: "Nightly review",
prompt: "Review open issues",
enabled: true,
schedule: { type: "interval", everyMs: 60_000 },
projectId: ProjectId.make("project"),
threadId: null,
workspaceStrategy,
modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
runtimeMode: "full-access",
interactionMode: "default",
createdBy: "user",
creationSource: "mobile",
createdAt: "2026-09-17T00:00:00.000Z",
updatedAt: "2026-09-17T00:00:00.000Z",
nextRunAt: null,
lastRunAt: null,
lastRunStatus: "never",
lastRunError: null,
runCount: 0,
});

it("keeps a stored sandbox strategy when editing an unrelated field", () => {
const initial = editDraft(task({ type: "sandbox" }));
expect(initial.workspace).toBe("sandbox");
expect(initial.storedSandbox).toBe(true);
expect(leavesSandboxWorkspace(initial)).toBe(false);
// Renaming the task does not move it off its fleet worker.
const renamed = { ...initial, title: "Renamed" };
expect(hasScheduledTaskDraftChanges(initial, renamed)).toBe(true);
expect(leavesSandboxWorkspace(renamed)).toBe(false);
});

it("surfaces a warning only when the workspace control leaves the sandbox", () => {
const initial = editDraft(task({ type: "sandbox" }));
const moved = { ...initial, workspace: "worktree" as const };
expect(leavesSandboxWorkspace(moved)).toBe(true);
expect(hasScheduledTaskDraftChanges(initial, moved)).toBe(true);
// A task that never ran in a sandbox is never flagged.
const worktreeDraft = editDraft(
task({ type: "worktree", baseRef: "release", startFromOrigin: false }),
);
expect(worktreeDraft.storedSandbox).toBe(false);
expect(leavesSandboxWorkspace({ ...worktreeDraft, workspace: "root" as const })).toBe(false);
});
});
14 changes: 13 additions & 1 deletion apps/mobile/src/features/settings/scheduledTaskDraft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export function scheduleFromDraft(draft: ScheduleDraft): ScheduledTaskUpsertSche
};
}

type Workspace = "worktree" | "root" | "existing_worktree";
type Workspace = "worktree" | "root" | "existing_worktree" | "sandbox";
export type ScheduledTaskDraft = {
readonly task: ScheduledTask | null;
readonly title: string;
Expand All @@ -209,6 +209,8 @@ export type ScheduledTaskDraft = {
readonly schedule: ScheduleDraft;
readonly threadMode: ScheduledTaskThreadMode;
readonly workspace: Workspace;
/** The stored task runs in a fleet worker sandbox; leaving it is surfaced. */
readonly storedSandbox: boolean;
readonly baseRef: string;
readonly checkoutPath: string;
readonly enabled: boolean;
Expand Down Expand Up @@ -301,6 +303,7 @@ export function createDraft(
schedule: DEFAULT_SCHEDULE,
threadMode: "new_thread",
workspace: "worktree",
storedSandbox: false,
baseRef: "",
checkoutPath: "",
enabled: true,
Expand All @@ -309,6 +312,11 @@ export function createDraft(
};
}

/** An edit that moves a stored sandbox task off its fleet worker; the editor surfaces it. */
export function leavesSandboxWorkspace(draft: ScheduledTaskDraft): boolean {
return draft.storedSandbox && draft.workspace !== "sandbox";
}

export function editDraft(task: ScheduledTask): ScheduledTaskDraft {
return {
task,
Expand All @@ -320,7 +328,11 @@ export function editDraft(task: ScheduledTask): ScheduledTaskDraft {
modelSelectionIsExplicit: true,
schedule: scheduleDraftForTask(task),
threadMode: scheduledTaskThreadMode(task),
// A sandbox workspace stays: editing an unrelated field must not silently
// move the task off its fleet worker.
workspace: task.workspaceStrategy.type,
storedSandbox: task.workspaceStrategy.type === "sandbox",
// Main's newer editor keeps the base automatic unless a worktree pinned one.
baseRef: task.workspaceStrategy.type === "worktree" ? task.workspaceStrategy.baseRef : "",
checkoutPath:
task.workspaceStrategy.type === "existing_worktree"
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3595,6 +3595,7 @@
"85728e592594c929": "Ausführen in",
"c7fe4313def0ef2f": "Neuer Worktree",
"e91a39ca1b5d9bbd": "Projekt-Checkout",
"c1b7be381b2a2df1": "Fleet worker sandbox",
"27a6259d0e7c054e": "Bestimmter Checkout",
"8b724804e55e48e6": "Checkout-Pfad",
"b325f97ceab8bc64": "Zeitplan",
Expand Down Expand Up @@ -3653,6 +3654,7 @@
"3c5185df378edef9": "Wird nur ausgeführt, wenn alle Filter zutreffen. Andere Anfragen werden als gefiltert protokolliert. Trenne „ist eines von“-Werte mit Kommas; ein Wert darf kein Komma enthalten.",
"d1a74724f70edb0b": "Diese Aufgabe existiert nicht mehr.",
"c191069dded46bcc": "Diese Umgebung ist getrennt. Verbinde sie erneut, bevor du speicherst.",
"46cea643e5ae4196": "Future runs will no longer use the fleet worker sandbox this task is paired with.",
"0d15db4c81851479": "Anfragen mit demselben Schlüssel werden innerhalb von 7 Tagen nur einmal ausgeführt.",
"a5bbe09b0c89d86c": "Beim Zusammenfassen wird die neueste Payload ausgeführt, wenn das Zeitfenster ab der ersten Zustellung endet. Leere Schlüssel werden normal ausgeführt.",
"0e2233fb297f7c07": "Intervalle müssen mindestens 1 Minute betragen. Passe dieses Intervall vor dem Speichern an.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3597,6 +3597,7 @@
"85728e592594c929": "Run in",
"c7fe4313def0ef2f": "New worktree",
"e91a39ca1b5d9bbd": "Project checkout",
"c1b7be381b2a2df1": "Fleet worker sandbox",
"27a6259d0e7c054e": "Specific checkout",
"8b724804e55e48e6": "Checkout path",
"b325f97ceab8bc64": "Schedule",
Expand Down Expand Up @@ -3655,6 +3656,7 @@
"3c5185df378edef9": "Runs only when every filter matches. Other requests are logged as filtered. Separate “is one of” values with commas; a value can't contain a comma.",
"d1a74724f70edb0b": "This task no longer exists.",
"c191069dded46bcc": "This environment is disconnected. Reconnect before saving.",
"46cea643e5ae4196": "Future runs will no longer use the fleet worker sandbox this task is paired with.",
"0d15db4c81851479": "Requests with the same key run only once within 7 days.",
"a5bbe09b0c89d86c": "Coalescing runs the latest payload when the window from the first delivery closes. Empty keys run normally.",
"0e2233fb297f7c07": "Intervals must be at least 1 minute. Update this interval before saving.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3590,6 +3590,7 @@
"85728e592594c929": "Ejecutar en",
"c7fe4313def0ef2f": "Nuevo worktree",
"e91a39ca1b5d9bbd": "Checkout del proyecto",
"c1b7be381b2a2df1": "Fleet worker sandbox",
"27a6259d0e7c054e": "Checkout concreto",
"8b724804e55e48e6": "Ruta del checkout",
"b325f97ceab8bc64": "Programación",
Expand Down Expand Up @@ -3648,6 +3649,7 @@
"3c5185df378edef9": "Se ejecuta solo cuando coinciden todos los filtros. Las demás solicitudes se registran como filtradas. Separa los valores de «es uno de» con comas; un valor no puede contener una coma.",
"d1a74724f70edb0b": "Esta tarea ya no existe.",
"c191069dded46bcc": "Este entorno está desconectado. Vuelve a conectarlo antes de guardar.",
"46cea643e5ae4196": "Future runs will no longer use the fleet worker sandbox this task is paired with.",
"0d15db4c81851479": "Las solicitudes con la misma clave solo se ejecutan una vez en 7 días.",
"a5bbe09b0c89d86c": "La agrupación ejecuta la carga más reciente cuando se cierra la ventana abierta por la primera entrega. Las claves vacías se ejecutan con normalidad.",
"0e2233fb297f7c07": "Los intervalos deben ser de al menos 1 minuto. Actualiza este intervalo antes de guardar.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3590,6 +3590,7 @@
"85728e592594c929": "Exécuter dans",
"c7fe4313def0ef2f": "Nouveau worktree",
"e91a39ca1b5d9bbd": "Checkout du projet",
"c1b7be381b2a2df1": "Fleet worker sandbox",
"27a6259d0e7c054e": "Checkout précis",
"8b724804e55e48e6": "Chemin du checkout",
"b325f97ceab8bc64": "Planification",
Expand Down Expand Up @@ -3648,6 +3649,7 @@
"3c5185df378edef9": "S’exécute uniquement si tous les filtres correspondent. Les autres requêtes sont journalisées comme filtrées. Séparez les valeurs « fait partie de » par des virgules ; une valeur ne peut pas contenir de virgule.",
"d1a74724f70edb0b": "Cette tâche n’existe plus.",
"c191069dded46bcc": "Cet environnement est déconnecté. Reconnectez-le avant d’enregistrer.",
"46cea643e5ae4196": "Future runs will no longer use the fleet worker sandbox this task is paired with.",
"0d15db4c81851479": "Les requêtes avec la même clé ne s’exécutent qu’une fois en 7 jours.",
"a5bbe09b0c89d86c": "Le regroupement exécute la dernière charge utile quand la fenêtre ouverte par la première livraison se ferme. Les clés vides s’exécutent normalement.",
"0e2233fb297f7c07": "Les intervalles doivent être d’au moins 1 minute. Modifiez cet intervalle avant d’enregistrer.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -3586,6 +3586,7 @@
"85728e592594c929": "実行場所",
"c7fe4313def0ef2f": "新しいワークツリー",
"e91a39ca1b5d9bbd": "プロジェクトのチェックアウト",
"c1b7be381b2a2df1": "Fleet worker sandbox",
"27a6259d0e7c054e": "特定のチェックアウト",
"8b724804e55e48e6": "チェックアウトのパス",
"b325f97ceab8bc64": "スケジュール",
Expand Down Expand Up @@ -3644,6 +3645,7 @@
"3c5185df378edef9": "すべてのフィルターに一致した場合のみ実行します。それ以外のリクエストはフィルター済みとして記録されます。「いずれかに一致」の値はカンマで区切ってください。値にカンマを含めることはできません。",
"d1a74724f70edb0b": "このタスクは存在しません。",
"c191069dded46bcc": "この環境は切断されています。保存する前に再接続してください。",
"46cea643e5ae4196": "Future runs will no longer use the fleet worker sandbox this task is paired with.",
"0d15db4c81851479": "同じキーのリクエストは 7 日以内に 1 回だけ実行されます。",
"a5bbe09b0c89d86c": "集約すると、最初の配信からの期間が終了したときに最新のペイロードで実行します。キーが空の場合は通常どおり実行します。",
"0e2233fb297f7c07": "間隔は 1 分以上にする必要があります。保存する前にこの間隔を更新してください。",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -3590,6 +3590,7 @@
"85728e592594c929": "실행 위치",
"c7fe4313def0ef2f": "새 워크트리",
"e91a39ca1b5d9bbd": "프로젝트 체크아웃",
"c1b7be381b2a2df1": "Fleet worker sandbox",
"27a6259d0e7c054e": "특정 체크아웃",
"8b724804e55e48e6": "체크아웃 경로",
"b325f97ceab8bc64": "일정",
Expand Down Expand Up @@ -3648,6 +3649,7 @@
"3c5185df378edef9": "모든 필터가 일치할 때만 실행합니다. 다른 요청은 필터링됨으로 기록됩니다. “다음 중 하나” 값은 쉼표로 구분하며, 값에는 쉼표를 넣을 수 없습니다.",
"d1a74724f70edb0b": "이 작업은 더 이상 존재하지 않습니다.",
"c191069dded46bcc": "이 환경의 연결이 끊어졌습니다. 저장하기 전에 다시 연결하세요.",
"46cea643e5ae4196": "Future runs will no longer use the fleet worker sandbox this task is paired with.",
"0d15db4c81851479": "키가 같은 요청은 7일 이내에 한 번만 실행됩니다.",
"a5bbe09b0c89d86c": "병합하면 첫 전송부터 시작된 기간이 끝날 때 최신 페이로드로 실행합니다. 키가 비어 있으면 정상적으로 실행됩니다.",
"0e2233fb297f7c07": "간격은 1분 이상이어야 합니다. 저장하기 전에 간격을 업데이트하세요.",
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -3590,6 +3590,7 @@
"85728e592594c929": "Executar em",
"c7fe4313def0ef2f": "Novo worktree",
"e91a39ca1b5d9bbd": "Checkout do projeto",
"c1b7be381b2a2df1": "Fleet worker sandbox",
"27a6259d0e7c054e": "Checkout específico",
"8b724804e55e48e6": "Caminho do checkout",
"b325f97ceab8bc64": "Agendamento",
Expand Down Expand Up @@ -3648,6 +3649,7 @@
"3c5185df378edef9": "Executa só quando todos os filtros correspondem. As outras requisições são registradas como filtradas. Separe os valores de “é um de” com vírgulas; um valor não pode conter vírgula.",
"d1a74724f70edb0b": "Esta tarefa não existe mais.",
"c191069dded46bcc": "Este ambiente está desconectado. Reconecte antes de salvar.",
"46cea643e5ae4196": "Future runs will no longer use the fleet worker sandbox this task is paired with.",
"0d15db4c81851479": "Requisições com a mesma chave executam só uma vez em 7 dias.",
"a5bbe09b0c89d86c": "O agrupamento executa o payload mais recente quando a janela iniciada pela primeira entrega fecha. Chaves vazias executam normalmente.",
"0e2233fb297f7c07": "Os intervalos devem ser de pelo menos 1 minuto. Atualize este intervalo antes de salvar.",
Expand Down
Loading
Loading