HostSection gets a monospace "Setup script" textarea (saved on blur, blank
as none) with the 32 KiB UTF-8 limit checked using the backend's message,
and notes on when it runs (as claude, bash -e, after the clone, every start,
30 minutes, output in the Overview card) and what it gets under
copy-at-connect.
Also in Host settings: the environment's advisory lifetime cap (Q8), read
by a new aws_environment_max_hours command, and the copy-at-connect limits
(no CA before the first connect, removed credentials linger in a running
task, no setup re-run after a re-clone), documented in CLAUDE.md too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A read in flight blocks the visibilitychange restart, so hiding and showing
the window mid-read no longer starts a second poll chain.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After a timed-out replace (secret force-deleted, not made again) the next
start retries the create/put for up to 30 s, then says to start again in a
minute; no more advice to restore the secret in the console.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
begin_follow runs in spawn_follow and the token is passed in, so a quick
Stop→Start can't leave the old follower registered last.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Attaching to a running task no longer needs the provider key or gateway
models; the payload is built lazily on the prepare path only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- start_clone_repos waits for the first connect when a setup script exists,
not only when there are repositories, so the script sees the CA, SSH keys
and Git credentials.
- wip_ref appends 8 hex of sha256(raw folder) when sanitising changed the
name, so `a b` and `a_b` never share a WIP branch.
- triple-c-apply-connect moves new CA files to a temporary name and swaps
them in; a failed move keeps the CA installed before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a_phase6_workspace_round_trips: one environment (max_workspace_hours 1)
and one project with EFS storage, a setup script, copy-at-connect with a
CA file, a port mapping and the gateway sidecar, two task starts, then
removal with discard. Passed live in us-west-2 (results in aws/README.md
and the spec). The phase-5 setup moves into deploy_for_workspace_user;
aws_host::ensure_started_with takes the sidecar's provider key from the
caller (the live tests have no keychain). scripts/aws-e2e-workspace.sh
runs TRIPLEC_E2E_TEST when set. The guard's task-definition retirement
listed nothing (ECS familyPrefix is a whole family name); it now filters
the full list by prefix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Q5: aws/pricing.rs reads on-demand Fargate rates (x86 and ARM vCPU-hours,
GB-hours, ephemeral storage GB-hours) from the Price List API in us-east-1
(AmazonECS; regionCode, termType=OnDemand, usagetype CONTAINS Fargate),
caches them per region for 24 h under <data_dir>/triple-c/aws-pricing/,
and estimates a config's hourly cost (ephemeral storage billed above
20 GiB; the gateway sidecar adds nothing). aws_cost_estimate(connection_id,
region, config) never errors: denied, offline or slow (8 s) is None,
shown as "Estimate unavailable"; a failed region is not re-asked for
5 minutes and a stale cache still answers.
pricing:GetProducts on * joins workspace-user-tasks.json with its check,
a policy test, the README and a live test (passed). HostSection shows the
estimate while configuring, Overview while running, with the Spot and EFS
notes. Fixture: a recorded us-west-2 GetProducts answer.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A non-essential 'gateway' container runs the digest-pinned LiteLLM image
next to the workspace (Q7): its secrets are exactly the three
TRIPLEC_GATEWAY_* keys, the config uses os.environ/ references (no key
in it), /bin/sh writes it to a 0600 file and execs LiteLLM on
127.0.0.1:4000. The workspace's ANTHROPIC_BASE_URL/AUTH_TOKEN point at
it with a master key minted per task start; under copy-at-connect that
token and the gateway keys stay in the secret (R1). Needs the
OpenAI-compatible backend and a gateway model (validated on save, start
and in the UI). Requests with the toggle off are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Opens hold a per-project lock and re-read the stored mappings, so
overlapping saves converge on the last one without false 'in use' errors.
Unchanged forwards keep their live connections. The sidecar's 4000 is
refused while it runs (mappings reach workspace loopback). Stored rows
that would be refused no longer block unrelated saves; they are skipped
with a warning at connect. Port-mapping logs get their own prefix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each TCP mapping of an AWS project becomes a loopback-only listener
carried into the task over socat-over-attach (the auth bridge's
PortForward, generalised to separate host and container ports; mappings
skip the bridge's first-byte/web gate). One set per project, opened after
every connect and on a save while connected, closed with the tunnel
(stop, remove, task death, exit). A failing mapping is a workspace-warning;
UDP and reserved ports are refused on save. The Config tab offers the
editor on AWS, TCP only, "Reachable only from this machine (localhost)".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Copy-at-connect tries CreateSecret first and reads the current value only
when the secret exists, so a first start never reads a missing secret
(which the owner-tag condition may refuse).
- triple-c-apply-connect: --prepare makes and prints a per-connect nonce
dir; the app uploads into it and applies exactly that dir, so concurrent
connects never mix files. CA files move to a fixed path so an unchanged
CA is not reinstalled.
- connect.env parsing kept a trailing '=' (base64 padding) — it was dropped.
- Pending-deletion errors from GetSecretValue are reported as such; message
and doc-comment fixes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- triple-c-apply-connect: the background re-clone closes the apply lock's
fd, so a later connect never waits on it; --prepare takes the lock.
- R6: under copy-at-connect Hybrid/EFS no longer link ~/.ssh to EFS; the
copied keys vanish with the task (UI says so, and that old keys on EFS
stay until removed).
- R7: a copy-at-connect start that finds credentials still in the secret
force-deletes it and creates it again (retrying ~30 s while AWS finishes),
so no AWSPREVIOUS version keeps them.
- TRIPLE_C_CUSTOM_ENV (unsalted fingerprint) left out of the secret.
- Terminals get only the credential pairs (no file reads; keychain off the
runtime), so a bad SSH/CA file never drops the API keys.
- ConnectBundle values are Zeroizing; UI copy updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy-at-connect (phase 6, Q2): with secrets_delivery copy_at_connect the
project secret keeps settings, repos and the agent token but drops
TRIPLEC_FILES and every credential pair (SECRET_ENV_KEYS and all custom
variables), marking TRIPLEC_CREDENTIALS=connect. After every connect (start,
attach, background re-attach) the app uploads the SSH/CA files and a
connect.env as root into /dev/shm/triple-c and runs the new
triple-c-apply-connect: CA install as root, SSH merge and git credential
helper as claude, a `connected` marker the first clone waits for, and a
background re-clone of failed repos only. Terminals add the pairs to their
own ExecSpec env. A failed push is a workspace-warning.
The entrypoint's CA, SSH, git-credential, Hybrid-home and clone functions
move to container/entrypoint-lib.sh (sourced first; defines only), so both
scripts run the same code; Docker behaviour is unchanged. HostSection gets
the Credentials choice with its warnings (and the gateway note, R1).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ruling R5: the start ends after Connecting (Running, lock released) and a
background follower (cancelled on Stop, Remove, tunnel close, app exit)
reports only a failure it saw or one on a task this start ran. A stale
Starting/Stopping AWS project loads as Error, and reconcile also checks a
Stopped one that still has a task ARN, so a crash never hides a live task.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The payload carries TRIPLEC_SETUP_SCRIPT and TRIPLEC_MAX_LIFETIME_MINUTES
(environment hours x 60 when capped); the 64 KiB error names the largest
parts. After Connecting, the start follows triple-c-workspace-status through
the agent (background exec, 2 s, progress on change, 35 min cap, quiet stop
when the tunnel goes). A failed clone/setup is a workspace-warning event and
a warning toast; Overview shows an AWS status card via aws_workspace_status.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two folders sharing a remote no longer force-push over each other's
triple-c/wip/<run-id>; the folder is part of the branch name (sanitised,
check-ref-format validated, hash fallback). A setup chain that dies with
the setup still running records failed so the idle stop is not blocked.
TRIPLEC_MAX_LIFETIME_MINUTES 00 means no cap and 08 means 8. The run record
is written after the agent-token block.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TRIPLEC_SETUP_SCRIPT runs as claude after the background clone (bash -e,
stdin /dev/null, 30 min timeout) with status/log in /run/triple-c-setup;
the idle watcher counts it as busy and enforces TRIPLEC_MAX_LIFETIME_MINUTES
(best-effort WIP push, marker lifetime, exit 76 = StopKind::LifetimeCap).
WIP pushes go to one triple-c/wip/<run-id> branch per task run, skipping an
unchanged tree. New triple-c-workspace-status prints clone + setup JSON.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clone_repos now clones into /workspace/.triple-c-clone/<folder> and renames
into place only on success, emptying scratch at each start; nothing at a
final path is ever deleted by the clone code. Replaces the in-repo
triplec.cloning marker, whose failed unset could get a working repository
deleted on the next start. triple-c-wip-push skips the scratch folder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EFS storage is Hybrid plus /workspace on a second access point of the
user's own file system, rooted at /triple-c-workspaces/<owner_key>/<project>
(a sibling of the home roots) and mounted at /workspace. The workspace
access point is found by root + owner + project tags or created, waited
for before RunTask, recorded store-owned, kept when switching to Hybrid or
Ephemeral, and deleted with the home one by a discarding removal. Hybrid
and Ephemeral task definitions are byte-identical to before (pinned
fingerprints).
The entrypoint links home state for efs as for hybrid, warns when
/workspace is not mounted, and marks a clone in progress in its own
.git/config so a clone a killed task cut short is redone on the next start
while existing repositories are still skipped.
The EFS segment is enabled in HostSection, with a note when /workspace
files remain on an access point after switching away.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
remove_aws_resources cleared access_point_id even without discard_data, though the
access point stays; the project could then move hosts and orphan it. The id is
now kept, so a later start reuses it, a later removal with "Also remove the
access point" deletes it, and moving the project is refused until then (the
message and the Host section say so).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its 2 s sha256sum poll now carries X-Triple-C-Background, so an open viewer does
not keep an idle AWS workspace up. Opening and saving a file stay foreground;
Docker is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The death watch's stopped marks are keyed by target id, and an unattached AWS
project's id (http://unattached.invalid/<id>/) is reused by every later unattached
spell, but only an endpoint URL's mark was ever removed. A stale mark could make
the watch report a live, billed task as stopped. Registering a tunnel now clears
the project's placeholder mark, and reconcile forgets it before asking ECS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard pushed and recorded `pushed` while terminals (and Claude in them) were
still open; the TERM hook then skipped its push, so later edits were lost. Stop now
closes the project's exec sessions and auth bridge first, then pushes, records the
marker and stops the task. A failed push still aborts the stop with the status
restored; the auth bridge is re-armed and the error says the terminals were closed.
The script also runs under `/usr/bin/timeout -k 5` ending 10 s before the client's
timeout: the agent does not kill an exec its client gave up on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- clone_repos records `<folder>\tcloning` as each clone begins; triple-c-wip-push
skips a folder whose last state is `cloning` while the clone is not done (dry run
reports "cloning": true; RepoState/TS carry it, the stop guard lists it as
"still cloning — nothing to push" and never asks because of it).
- The idle watcher re-checks quiet() after a successful push and goes back to
watching if someone came back during it.
- The entrypoint installs its stop trap before the idle watcher and the background
clone start, so a TERM in between still runs aws_before_stop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The connection-wide 30 s operation limit counts retry backoff, so a
throttled SimulatePrincipalPolicy got about six of its ten adaptive
attempts. The IAM client used by the check now has a 120 s operation
limit, and Settings tells the user a check can take a few minutes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The idle wait now keeps an attach open (silent) and runs the auth
bridge's background exec every 2 s; the task must still stop itself and
ECS must report it as an idle stop (exit 75 -> StopKind::Idle).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The task has no ~/.aws from this machine and SSO can't refresh there;
the note points at static keys or a bearer token (m10). The auth bridge
stays enabled on AWS (its poll is now a background request).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- validate_repo_url rejects https URLs with userinfo (user:pass@ or
token@), pointing at the project's Git HTTPS token setting (m4).
- validate_branch rejects HEAD (m5).
- The FIXED_ENVIRONMENT doc comment sits on FIXED_ENVIRONMENT again (m6).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New reconcile_aws_projects command (handler, capability, TS wrapper)
that App runs on mount regardless of Docker; reconcile_project_statuses
now skips AWS projects. Projects reconcile concurrently, 4 at a time,
each still bounded at 15 s.
- reconcile_task falls back to find_project_task when the stored task is
gone or stopped, before calling the project Gone (m3).
- An AWS project with no registered tunnel gets a placeholder target id
(http://unattached.invalid/<id>/) instead of the last run's loopback
URL, so a reused port can't match the wrong project; the death watch
still reports it by that id until a re-attach registers (m9).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- classify_stop is wired into the death watch: stopped_among returns
each task's StopKind, the tunnel registry keeps it, and ContainerExited
carries a StopNote. Spot -> 'Spot interruption'; TaskFailedToStart ->
Error with the reason; the entrypoint's idle exit (75, read from the
workspace container's exit code) -> 'stopped after being idle'; a user
stop is applied silently (P8). is_quota_error, dead, moved to tests.
- The SDK config has a TimeoutConfig (30 s operation / 10 s attempt); the
watch's per-group poll and StopTask also have tokio bounds.
- Watcher tests cover silent sessions, unsaved work with the WIP push on
and off, a failing push and the idle exit status; docs updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The auth bridge reads /proc/net every 2 s; on the agent that now goes
through ContainerTarget::exec_oneshot_background, which sends
X-Triple-C-Background: 1 so the agent does not count it as activity.
Docker behaviour is unchanged. The idle-stop hint says what idle means
now (R11) and what happens to unsaved work.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Removing a project's AWS resources now deletes its secret with
ForceDeleteWithoutRecovery (R10) so the next start can create it again,
and the EFS option is renamed: it removes the access point, while the
files stay on the user's own file system until offboarding (R9).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of Task 9:
- the phase-5 body runs under a 45-minute timeout and each exec under
180 s, so a hang becomes a panic the guard catches; the body future is
boxed (moved into the timeout it overflowed the test thread's stack,
which aborts without any guard);
- scripts/aws-e2e-workspace.sh builds and pushes the image to a throwaway
ECR repository, runs the test and deletes the repository in an exit
trap; the test's guard deletes it too (TRIPLEC_E2E_ECR_REPO);
- the guard survives a poisoned lock, closes the tunnel and restores
AWS_CONFIG_FILE;
- new live probe: a bare elasticfilesystem:TagResource on the user's own
file system is denied; README records it and the final run (R8 removal
end state), and the admin command uses xargs -r.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ruling R8. ECS authorizes ecs:DeregisterTaskDefinition against * only,
with no tag condition (verified live), so the workspace tier's
RetireOwnTaskDefinitions could never match, and allowing it on * would
let any user deregister any revision in the account. DeleteTaskDefinitions
is resource-level but deletes only INACTIVE revisions, so it goes too.
Removing an AWS project now stops the task, schedules the secret and
(with discard) deletes the access point, and leaves the task definition
revisions registered, saying so in the log: they hold no secret values,
cost nothing, and RunOwnTasks still needs the owner tag. aws/README.md
tells admins how to deregister them. The policy statement, its checks and
owner-scoped rows, the RuntimeApi methods, the fakes, the removal UI copy
and the live test's final assertion follow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aws::live_tests::environment::a_fargate_workspace_round_trips (ignored):
a public environment deployed by the environment admin, a role holding
only the workspace-user files onboarded to it and driving ProjectHost::Aws
through a profile connection: start (Hybrid, 1 vCPU / 2 GB, one public
repo), exec, background clone, ~/.claude persistence across stop/start,
attach without a second RunTask, the stop guard's dry run, the SIGTERM
WIP path, idle stop at 5 minutes, bubblewrap, denials on another owner's
revision and secret, and project removal. TRIPLEC_E2E_IMAGE names the
image; a private ECR image gets a test-only pull policy on the exec role.
A guard stops tasks, retires revisions, deletes access points and the
secret before the fixture destroys the modules.
aws/README.md gains the phase 5 results; the spec's To verify items are
answered. Open: DeregisterTaskDefinition is authorized against * only,
so the workspace tier cannot retire revisions (the test's last assertion
fails until that is decided).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EFS authorizes the elasticfilesystem:TagResource that a tagged
CreateAccessPoint needs against the parent file system's ARN, not the new
access point's: a workspace user's first Hybrid start was denied
("not authorized to perform: elasticfilesystem:TagResource on the
specified resource"). Verified live with a probe role: access-point/*
is denied; file-system/* is allowed, as is * with each of
elasticfilesystem:CreateAction, aws:RequestTag and aws:TagKeys.
TagOwnAccessPointsAtCreate now names file-system/* with the same
conditions (CreateAction = CreateAccessPoint, owner request tag, the
three tag keys); its check and owner-scoped test follow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failed StopTask removes the stop marker it recorded, so a later stop
pushes as configured. The unchecked guard's Stop anyway sends no choice
and records nothing, so the workspace's own shutdown push still runs as
the dialog says. The idle watcher keeps a pushed/discard marker instead
of overwriting it; the remove-resources dialog sends discard only when
there may be saved files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stop guard's choice now reaches the workspace: after a successful
push (or for Stop without pushing) the app records pushed/discard in
/run/triple-c/stop-reason as root, and the entrypoint's shutdown hook
then skips its own push; a marker that can't be written is reported
and the stop goes on. The push runs before the auth bridge is stopped;
a guarded stop of a workspace that already stopped succeeds. The
Fargate table allows only 512/1024/2048 MiB with 256 CPU, pinned on
both sides by a shared fixture. Removal's missing-connection refusal
carries a stable prefix. OpenAI Compatible is allowed on AWS, with a
warning for local addresses and the app's own gateway. HostSection
locks resource actions unless Stopped, the add dialog drops the
environment on a region change, and the repository editor keeps rows
in progress across a refresh.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add Project picks Local or an AWS connection, a region and a ready,
joined environment, with repositories instead of folders. The Config
tab's Host section edits CPU/memory (valid pairs only), architecture,
storage, ephemeral size, Spot, idle stop, WIP push and repositories, and
can remove the AWS resources or move the project back to this machine.
Docker access, VPN, port mappings and the gateway backend are disabled on
AWS with the reason; the sandbox shows Off on AWS for now. Stop on an AWS
workspace with unsaved work asks first (Push to WIP branch preselected);
a failed start shows the task's last log lines; removing an AWS project
can delete its saved files, and asks again when its connection is gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
check_unsaved_work runs triple-c-wip-push --dry-run through the agent as
claude (checked:false with the reason when the workspace can't be asked);
stop_project_container takes wip: push runs the push first and a failure
aborts the stop with its output. aws_task_log reads the current or last
task's stream in the environment record's log group. remove_aws_resources
removes a stopped project's AWS resources and clears its runtime handles,
so it can move off AWS. add_project takes the host fields; an AWS project
takes repositories, no folders, and no runtime handles from the caller.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clone repos in the background after the agent starts (progress in
/run/triple-c-clone; an unfinished clone keeps the workspace from idling),
give the task definition stopTimeout 120 for the SIGTERM WIP push, reserve
the TRIPLEC_ env prefix on both hosts, and stop root writing through
claude-controlled links (~/.claude.json written as claude only via the exact
Hybrid link; ~/.ssh merged only through the exact Hybrid link, Docker paths
unchanged). Keep the user's ssh command and add BatchMode, cover dot-folders,
refuse undecodable or over-long file names by name, and upload LFS objects
before the --no-verify push.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With TRIPLEC_HOST=aws the entrypoint decodes TRIPLEC_FILES into
/tmp/.host-ssh and /tmp/.host-ca and unsets it (and TRIPLEC_REPOS) before
the agent's environment snapshot; links ~/.claude, ~/.claude.json and ~/.ssh
into /mnt/triple-c-home for Hybrid storage; clones TRIPLEC_REPOS as claude
after git credentials and ~/.ssh are set up; runs triple-c-wip-push from the
TERM trap; and starts triple-c-idle-watch, which signals the entrypoint
itself (PID 1 is docker-init under initProcessEnabled). Docker mode is
unchanged: every new step is gated on TRIPLEC_HOST=aws.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ensure_started cancels a background re-attach instead of waiting for it,
and every register bumps the project's generation, so a late re-attach can
never replace a newer tunnel. A task StopTask refused after a failed start
keeps its ARN. A re-attach that gives up clears the pending flag only if
still current; close_if_task checks and takes under one lock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A start stores the task ARN when RunTask returns (or the task is found),
reconcile finds an unrecorded live task, and a failed attach leaves the
project in Error rather than hiding a running task. The winner of a start
race puts its agent token back in the secret. A background re-attach
registers only if the project still runs that task and was not stopped
meanwhile. Removing a project whose connection is gone needs explicit
confirmation. Names come from tofu_modules; files are read with a hard cap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ProjectHost::Aws and the tunnel registry: start looks for the project's
live task before preparing (a running task is attached to with the token
read back from its secret, never rotated), waits for a new access point,
runs, waits, tunnels and checks the agent; a task the start ran is stopped
on any later failure. Stop, remove (resources; data only on request),
reconcile (background re-attach) and the AWS death watch, with exits
confirmed through the registry. Docker-only Reset, migration, staleness
and container info refuse or skip AWS projects; an AWS project with
resources can't be moved off its host. Shutdown closes every tunnel.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>