11 Commits

Author SHA1 Message Date
eust-w
c5a6c6160d 🚀 Deploy WishForge to the POC cluster, with check Pods and daily backups
- cluster-poc.mjs: image (in-cluster Kaniko), bootstrap, secrets, apply,
  migrate --rehearsal|--final, public HTTPS entry, backup and restore
- One restricted Pod (platform, executor, Runner, PostgreSQL, Temporal,
  MinIO, Caddy, backup) listening only on loopback except Caddy
- Protected checks run in per-workspace check Pods; cancellation during
  start-up now always removes them
- Daily snapshots on the node (consistent dump with row counts, Temporal
  online backup), copied to the Mac by launchd with SHA-256 checks and a
  notification on failure; restore verified on the rehearsal copy
- Downloads and uploads survive the Mac's lossy link to the cluster
- Local public entry, evidence isolation labels, acceptance records

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 16:27:07 +08:00
eust-w
a89cd1b9b3 ✨ Let Claude Code run commands inside its own sandbox, by operator opt-in
With WF_CLAUDE_COMMAND_SANDBOX=true, Claude Code also gets Bash, run in
its built-in sandbox through --settings:

- The sandbox must start (failIfUnavailable), and no command may run
  outside it (allowUnsandboxedCommands: false).
- No network: an empty allowedDomains with strictAllowlist, since an
  absent allowlist leaves the network open. Local binding stays off,
  because it would also open every local port, Temporal's included.
- Commands cannot read the home directories, the CLI's home or the
  worker's own directory, except the workspace, a per-run scratch
  directory and WF_CLAUDE_COMMAND_READ_PATHS; they write only to the
  workspace and the scratch directory; credential variables are unset.
- WF_CLAUDE_COMMAND_ENV gives commands toolchain variables, such as the
  POC's read-only Go module cache.

The executor probes the sandbox first (Seatbelt on macOS; bubblewrap
and socat on Linux) and keeps file tools only where it cannot start,
saying so on the timeline. The adapter now writes the execution
contract into the prompt, for the tools the agent actually has.

scripts/check-claude-command-sandbox.ts checks a machine with one short
real session and judges each probe by its effect, not the agent's
account. On the local Mac every probe was blocked; the login keychain
remains reachable, because Claude Code's Seatbelt profile always allows
the security server. That limit is documented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:48:16 +08:00
eust-w
fc90c932ba 🔒 Confine Claude Code to workspace file tools and keep CodeBuddy off Kata
Claude Code with a tenant key started with bypassPermissions and every
tool, Bash included, and loaded the repository's settings, hooks and MCP
servers. It now runs like the native development login already did:
restricted mode with dontAsk, only Read/Edit/Write/Glob/Grep, confined to
the workspace, and no repository or user settings. Every Claude Code run
is told the verifier runs installs and tests.

CodeBuddy's agent runs commands with no sandbox of its own. Like Codex
without its sandbox, it now starts only in a development (host) sandbox,
says so on the timeline, and stops with PROVIDER_SANDBOX_UNAVAILABLE on
Kata.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 05:25:36 +08:00
eust-w
6fc7eaf00c ✨ Improve local WishForge reliability and LAN access
Detect actual service and Runner readiness, restore LAN access after network changes, protect production web builds with rollback, honor cancellation during executor startup, and show truthful cached-data and credential states.
2026-10-25 03:29:51 +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
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
0b4c09f7eb refactor: declare every entity field instead of an open index signature
Entity carried `[key: string]: unknown`, so a misspelt field compiled and most
records were read as untyped bags. Every stored kind now has an interface in
contracts (workspace, runner task and registration, provider connection,
checkpoint record, resource allocation, integration lease, delivery config) and
the project, run, release and evidence types list all their fields. Entity writes
are generic over the record type, and the project delivery settings no longer
accept a stray target branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 16:32:36 +08:00
eust-w
cce214f8fb feat: close the main loop from wish to integrated commit
Verification ran git inside the tree under test, kept no command output and
treated every infrastructure fault as a test failure; repairs went through an
executor lease the coordinator should not hold; and a project without delivery
could never succeed. This reworks the worker execution path and the control-plane
contracts it depends on.

- Verification exports the exact commit to a directory without .git, installs
  dependencies (network allowed) and runs the protected commands under
  bubblewrap in kata mode or directly in host mode; evidence records exit code,
  duration, digest, a redacted output tail and the isolation used. Production
  rejects host evidence. A failed installation waits as infrastructure.
- Waiting reasons are an enum with a redacted detail; dispatcher, GitHub and
  model-proxy states map onto it, and the console explains each one with a way out.
- Repairs are requested by the coordinator through /internal/runs/:id/repair;
  the control plane derives the failure summary from the verifier's evidence and
  enforces the repair budget. Continuing after the budget is spent grants one more
  round; a new requirement revision starts a fresh budget.
- Execution identities may only move a run within their own stages and only to
  running or waiting; success comes from integration evidence (no delivery
  configured) or deployment acceptance. The unused preview stage is gone.
- Integration fast-forwards when the target has not moved, merges and re-verifies
  otherwise, retries when a push finds the target moved, and turns merge conflicts
  into a repair round that merges the current target for the agent to resolve.
- Successful runs that needed a repair leave a project lesson; active lessons are
  injected into later prompts, and admins can list, add, disable and delete them.
- Executor progress (messages, commands, file changes, plan updates) is stored as
  normalized events; previously agent messages were recorded as the literal word
  "output". Provider failures keep the work as a checkpoint and wait as
  provider_error instead of failing the run.
- Workers declare WF_SANDBOX_MODE=host|kata (host refused in production),
  heartbeat with retries until the lease could have expired, and retry safe
  control-plane reads with backoff.
- tests/local-loop.test.ts runs the loop end to end with real Git, the in-process
  control plane behind its internal routes and a scripted agent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 15:15:54 +08:00
eust-w
ba5fe56e88 refactor: replace platform meta-evolution with versioned agent configuration
The meta-evolution machinery (failure clustering meta-tasks, signed
offline evaluation, shadow/canary stages, external release receipts,
evaluator identity and its UI) could never take effect: promotions were
written to the system tenant only, the benchmark/runner/observer it
depended on did not exist, and its statistical gates were effectively
unreachable. It is removed as agreed in docs/requirements.md section 3.

What remains is the part every run actually uses, now explicit:

- packages/evolution becomes packages/agent and keeps only the bundle
  schema, content digest and prompt assembly; consumers import it as the
  @wishforge/agent workspace package instead of by relative path.
- apps/api/src/domain/agent-bundles.ts: immutable, content-addressed
  agent configurations per tenant, with create, activate and rollback
  restricted to human owners/admins. A run pins the active version at
  submission; later activations never change it.
- /v1/agent-bundles routes replace /v1/evolution*; all /internal
  evolution routes, the evaluator service token and the rsi:rollout
  script are gone.
- Web: the experiment page becomes an "Agent 配置" page.
- Tests for the deleted modules are removed; control-plane tests cover
  version pinning, rollback and authorization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:38:53 +08:00
eust-w
0ef99b1e6d style: add Prettier and EditorConfig, format the codebase
Adds prettier 3.9.8 (exact) with a shared config (single quotes,
120 columns, trailing commas), .prettierignore, .editorconfig and the
`format` / `format:check` scripts, then formats all TypeScript,
JavaScript, CSS, JSON and YAML sources.

Purely mechanical: no behaviour change. Typecheck passes, the vitest
suite and the 74 IDE node tests produce the same results as before
(socket-binding tests still cannot run inside this sandbox).
Previously the longest source line was ~3000 characters; reviewing the
following semantic changes now produces readable diffs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:32:43 +08:00
eust-w
b47a07e8d2 chore: baseline snapshot of the Codex-delivered code before review
Imports the previously untracked working tree as-is so that the review
changes that follow (requirements -> design -> implementation) can be
reviewed as diffs and reverted if needed. No content changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:18:04 +08:00