14 Commits

Author SHA1 Message Date
eust-w
13ceca5c8f 🔀 Merge review/overhaul into feat/wiki-copilot-diagnostics
Some checks failed
CI / Format, types and tests (pull_request) Has been cancelled
CI / PostgreSQL migrations and integration tests (pull_request) Has been cancelled
Brings the branch up to the current base (executor settings, project
skills, Chinese run messages, cloud IDE removal, wish attachments) and
resolves the ten conflicted files, keeping both sides:

- wish-refiner: the tenant's executor settings pick the models first,
  then the Copilot model setting; the tenant credential still goes
  before the operator's login
- worker providers: executor settings apply, and a run with its own
  credential still gets an empty home
- main.ts: Copilot screenshot uploads and wish attachments each keep
  their own body limit
- contracts, http, web types: default budget and skill auto-activation,
  Copilot and attachment entity kinds, ./text and ./attachments exports
- globals.css: Copilot styles and attachment styles, one after the other
- tests: the canceled-release reason is Chinese; the refiner's default
  models have no [1m] suffix, as this branch names them

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 00:39:05 +08:00
wishforge
aab0dc08c8 🐛 Give the local workers the proxy settings the host actually exports
PASSTHROUGH only named HTTP_PROXY/HTTPS_PROXY/NO_PROXY, but a host usually exports the
lower-case pair (and often only NO_PROXY in upper case). The executor and verifier child
processes therefore started without a proxy, and their CLI could not reach a gateway
outside this machine — it hung with nothing on stdout while the run's heartbeat window ran
out.

Both spellings now cross into the workers, kept in step with PROXY_VARIABLES.
2026-11-09 04:12:22 -08:00
eust-w
da1cfcea13 🔥 Remove the cloud IDE
The cluster never ran Theia or the IDE gateway, so every workspace stayed
"未配置" forever. The feature is gone instead of half-present:

- API: workspace, launch and lifecycle endpoints, the gateway identity and
  its internal routes, the dispatcher's workspace provisioning and the
  lifecycle worker. Migration 003 deletes stored workspaces and settles
  their pending outbox items.
- Provisioner: workspace provisioning and lifecycle for both backends.
- Web: the 云 IDE panel, the launch route, the start-branch picker that
  listed IDE branches, and the workspace count on usage.
- apps/ide, infra/oct, dev:ide and the CI job; IDE parts of local k3s,
  network policies, RBAC, docs and the architecture diagram.

A wish can still start from a pushed branch through the API (sourceBranch).
Plan files and stored entitlements may still carry maxWorkspaces; it is
accepted and ignored.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-04 12:43:02 +08:00
eust-w
3b78e8e536 🐛 Release what superseded run generations left behind
- The local provisioner kept a generation whose workers exited by
  themselves as running, so its run's directories could never be
  purged.
- On Kubernetes, only a run's current generation is ever released: a
  superseded generation's Secrets, with its run tokens, its service
  accounts and network policies stayed forever. Starting a new
  generation now deletes them by name for every earlier generation
  without a running pod, found through the volumes kept for the
  retention period, so the provisioner still cannot list Secrets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 22:22:11 +08:00
eust-w
4e5ab1719c ✨ Enable local Claude delivery to Gitea and POC
Add authenticated LAN access, native Claude execution, checkpoint and budget recovery, and signed POC build/deploy/rollback contracts. Include local service management, regression coverage, and evidence from the completed POC delivery.
2026-10-22 16:21:33 +08:00
eust-w
e89f11b396 feat: run the cloud IDE on the local k3s cluster
The local cluster deploys the IDE gateway, and the provisioner creates a
Theia workspace with an OCT sidecar per project in the tenant namespace.
`build` adds the ide, ide-gateway and oct-workspace images; `web`
forwards the workbench (3100) and the gateway (3101).

- On a local development cluster (WF_ALLOW_INSECURE_HTTP), the
  provisioner accepts the in-cluster HTTP platform Git and the localhost
  gateway for workspaces.
- Builds use a proxy from the host environment, at the address the VM
  sees the host at.
- `web` refuses ports already taken on the host, where kubectl would
  otherwise listen on ::1 only. Its defaults stay clear of the local
  development stack (3000, 4400).
- Pods reading the settings or secrets carry a digest of them, so a
  redeploy with changed settings rolls them.
- The IDE build context leaves out every local node_modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 23:24:04 +08:00
eust-w
27b6e19d6b fix: run a wish end to end on the local k3s cluster
The first runs on k3s found these problems; a wish now goes from submission
through the Codex executor, independent verification and integration in
per-run pods.

- Development deployments refused to start because the images set
  NODE_ENV=production. The local manifest and the sandbox Jobs now set
  NODE_ENV to the deployment mode.
- The model proxy treated x-client-request-id as a per-request idempotency
  key. Codex sends its conversation id there, so every second request of a
  session failed with 409. Only Idempotency-Key names a single request now.
- Codex's command sandbox (bubblewrap) cannot start in a runc pod. Every
  command failed and the agent retried until the budget ran out. The
  executor now probes the sandbox before starting Codex. A Kata sandbox that
  cannot run it waits as PROVIDER_SANDBOX_UNAVAILABLE. A development (host)
  sandbox runs Codex without it, and the timeline records that.
- The prompt asked agents to commit, but Codex keeps .git read-only and the
  platform commits the checkpoint itself. Agents now leave their changes
  uncommitted, and get the platform's Git identity if they commit anyway. A
  resolved merge is recorded even when its tree equals HEAD.
- scripts/k3s-local.mjs:
  - excludes the VM and cluster ranges from a host proxy (NO_PROXY);
  - uses its own Docker client configuration, so a stale credential
    helper does not break builds;
  - recovers from an interrupted k3s install;
  - reports when Colima switches the current kubectl or Docker context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 01:47:33 +08:00
eust-w
8b77085a5f fix: let Kubernetes sandboxes start, and run on a local development cluster
Sandbox Jobs never received WF_DEPLOYMENT_MODE, which every worker requires
before anything else, so each Kubernetes sandbox exited at start. The
provisioner now passes its own mode.

A local development cluster (k3s) has no Kata, no bubblewrap inside runc and no
TLS between services. For it, and only with WF_DEPLOYMENT_MODE=development:

- WF_ALLOW_INSECURE_HTTP=true lets services reach each other over plain HTTP
  (Git, the model proxy, the provisioner and IDE gateway targets, the worker's
  control-plane client); production refuses the setting outright.
- The provisioner accepts WF_RUN_SANDBOX_MODE=host and WF_KATA_RUNTIME_CLASS=none
  and passes the HTTP settings to its sandboxes.
- The development seed is built into the image (dist/api/seed.mjs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 00:56:07 +08:00
eust-w
ffa066dcf2 feat: remove run volumes after a retention period
Released generations kept their PVCs (and the local backend its run
directories) forever, filling the tenant quota.

- The API's hourly maintenance asks the provisioner to purge the volumes of
  every generation of a run once WF_RUN_STORAGE_RETENTION_HOURS (default a
  week, 0 keeps them) passed since the release, and records storagePurgedAt.
  Checkpoints live in the control plane, so continuing a run never needs them.
- POST /runs/purge deletes the run's PVCs by label (the local backend its
  directories) and answers busy while any of the run's pods or processes is
  active. The baseline Role gains list and delete on PVCs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:09:51 +08:00
eust-w
223f497624 feat: give Kubernetes sandboxes an egress proxy for installs and a remote image builder
In Kubernetes mode the per-run network policy allowed only DNS, the API,
Temporal and Git, so dependency installs could not reach a registry and image
builds had no builder.

- WF_RUN_INSTALL_PROXY_URL points both sandboxes at an operator's egress proxy
  (pods labelled egress-proxy); the per-run policy admits it and installation
  commands get HTTP(S)_PROXY, also inside bubblewrap, while checks still have
  no network.
- WF_VERIFIER_DOCKER_HOST with a TLS client certificate points the verifier at
  a remote builder daemon (pods labelled image-builder); a separate policy
  lets only the verifier pod reach it, and release deletes that policy too.
  Builds pass DOCKER_HOST, DOCKER_TLS_VERIFY and DOCKER_CERT_PATH, and refuse
  a Docker context and a remote builder together.
- The control namespace's baseline admits sandbox traffic to both components.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:05:30 +08:00
eust-w
15e137ff7f feat: isolate tenants in Temporal with per-tenant namespaces and mutual TLS
Sandboxes can reach Temporal, which used to accept any client in one shared
namespace. Now:

- Every Temporal client (API dispatcher, coordinator, deployer, sandboxes) can
  present a client certificate (TEMPORAL_TLS_*); production refuses to start
  without one.
- TEMPORAL_NAMESPACE_PREFIX gives each tenant its own namespace: the dispatcher
  starts and signals a tenant's workflows there, the shared coordinator and
  deployer poll every served tenant's namespace with one workflow bundle, and a
  sandbox polls only its tenant's. Production refuses to serve several tenants
  through one namespace.
- The Kubernetes provisioner mounts the tenant's Temporal client certificate
  into executor and verifier pods (WF_RUN_TEMPORAL_TLS_SECRET, required in
  production); the local provisioner passes the TLS settings through.

Authorizing certificates per namespace remains Temporal server configuration;
the operations guide describes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 19:59:49 +08:00
eust-w
6d2dcebe65 feat(ide): clone the project into IDE workspaces and push back through Git (FR-H2)
While someone has a workspace open, the gateway asks the API for a 15-minute
write token for the project's platform repository on behalf of that person
(membership and role checked each time) and delivers it to the workspace
backend. The backend writes it to a Git config file outside the repository
(a memory volume in Kubernetes) that the clone includes, and on the first
delivery clones the target branch into a folder named after the project. The
workspace cannot mint credentials itself, so access ends with the last
session.

- People commit and push to the target branch like with any Git server; the
  platform only accepts fast-forwards, and the next wish starts from that
  commit (covered end to end in the local loop test).
- Commits are authored by whoever opened the latest session, from the name and
  email in their sign-in; their own git config overrides it.
- Only the gateway can reach the delivery endpoint: it needs Theia's
  connection token, and the gateway refuses the path for browsers.
- The provisioner pins the workspace to its repository and lets the pod reach
  the Git service; the Kubernetes baseline admits that traffic. External
  repositories are not cloned.
- The local shared Theia clones each project into its own folder.
- The Theia image installs Git, and its stage is named theia: the default
  build target of that Dockerfile is the gateway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 18:52:37 +08:00
eust-w
7e04a779f0 ci: add a CI workflow and complete the image targets
- .github/workflows/ci.yml: format check, typecheck (including tests) and all
  unit tests with the provisioner tests; PostgreSQL migrations applied twice (the
  second run must find nothing) plus the PostgreSQL integration tests; IDE
  gateway, collaboration and policy tests against the IDE package's dependencies.
- runtime.Dockerfile gains web (Next.js production build) and provisioner
  (kubectl from an operator-supplied image) targets; tool images default to
  scratch so only the targets that need them fail without them.
- apps/ide/Dockerfile takes reviewed Node images as arguments and adds a slim
  gateway target.
- The Kubernetes provisioner also deletes a stopped generation's capability
  secrets, service accounts and network policy; volumes stay for diagnosis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:11:32 +08:00
eust-w
a9411f586b feat: run the whole loop locally with a local provisioner
Local development had no provisioner, so every wish stopped at "sandbox not
ready", and dev:all started neither the coordinator nor the deployer.

- The provisioner moves from apps/ide to apps/provisioner and gains a backend
  switch: `local` starts an executor and a verifier process per run generation
  on this host (WF_SANDBOX_MODE=host, own directories and run-scoped tokens,
  development mode only) and points workspaces at the local Theia; `kubernetes`
  keeps the Kata Jobs, now started with the image entrypoint instead of the npm dev
  script and allowed to reach the platform Git service.
- In development the resource grant needs no runtime image digest.
- setup:local is one idempotent script that creates or completes .env.local,
  including the deployment mode, provisioner and grant settings.
- dev:all starts Git, API, provisioner, coordinator, deployer and web; dev:ide
  starts Theia and the IDE gateway; ide:install and ide:build wrap the separate
  Theia package. npm test also runs the provisioner tests.
- Project settings accept the target branch and dependency install commands.
- Web development conveniences require WF_DEPLOYMENT_MODE=development.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:36:12 +08:00