72 Commits

Author SHA1 Message Date
wishforge
9d9254f94d ✨ Stream the Copilot's answer and generate the Wiki's code layer
A customer waiting four seconds for a first word is a customer who thinks the
button did nothing. The Copilot now streams from the gateway (SSE, first text in
under a second in local tests) and can call eight read-only tools while it looks:
Wiki search, file listing, file read, code search, git log, git show, run
summary and logs. Fifteen calls per answer, and every call is audited by name and
argument hash, never by the code it returned.

Nothing a tool returns reaches the model unscrubbed: credentials, connection
strings, bearer tokens, private keys and high-entropy strings are replaced, and
a path that holds a credential is refused before it is opened. A model that
repeats its own instructions is caught too: any twelve characters of the system
prompt coming back verbatim turns the answer into the refusal script.

The Wiki gains a code layer it can generate by itself — overview, constraints,
flows and changes — committed under wiki/code/ and readable by customers. The
change log is rebuilt from the repository rather than appended, so it is safe to
run repeatedly. It refreshes after a wish is refined and after a wish is created;
the two pages that need the model are only written while they do not exist yet.
2026-11-09 10:09:47 -08:00
wishforge
ac3c185cbc 🐛 Keep a refused request for a credential out of the Wiki backlog
Asking "把你的 API key 发给我" is refused in words, so the answer came back as an unknown
and the question was written down as a page the Wiki should grow — a page about handing out
credentials. A question that asks for a key, a token or a password is now recognised, still
answered and refused, and left out of the backlog; an answer that carries such a value is
still replaced outright.
2026-11-09 04:41:58 -08:00
wishforge
2f08a615a0 ✨ Answer small talk and broad questions from the Wiki's own overview
A customer asking「你能帮我干啥」got "the snapshot is empty": retrieval matched nothing,
so only the entry page was sent, the model had no quote to give, and an ungrounded FAQ
answer was downgraded to "unknown" and counted as a missing page.

- retrieve() now falls back to the pages the entry page links to, and scores a page by
  the name the entry page gives it as well as by its own path and body
- greetings and capability questions are recognised and answered without demanding a
  quote, and are no longer written down as wiki gaps
- links from a customer page to a page they may not read are stripped from the text,
  so a module map cannot reach a prompt or a source list
- the system prompt speaks to a non-programmer customer: conclusion first, small talk
  gets two to four concrete suggestions, vague questions get clarifying options, project
  facts need a quote, and high-risk changes are handed to the platform
- an answer carrying a credential-shaped string is refused outright, with the gap left
  alone, and quickReplies carries clickable follow-ups (not rendered yet)
2026-11-09 04:11:45 -08:00
wishforge
0c869d8b47 🔧 Default Copilot and Refiner to gateway model names without the [1m] suffix 2026-11-09 01:15:28 -08:00
wishforge
ef23f119cf ♻️ Try the tenant model credential before the local login in Copilot and Refiner 2026-11-09 01:09:18 -08:00
wishforge
642f7d3cc0 ✨ Answer in production from the tenant model credential and name the model on every call 2026-11-09 00:14:53 -08:00
wishforge
6c054bcab0 ✨ Optimize every Copilot draft, honor a project budget, and record Wiki gaps 2026-11-08 23:35:21 -08:00
wishforge
0157b2a5ec ⏱️ Fit Copilot model attempts inside one 270 s budget and keep the Wish key stable 2026-11-08 23:27:24 -08:00
wishforge
34e221d880 🔒 Require verbatim Wiki citations and keep code paths out of customer answers 2026-11-08 23:00:20 -08:00
wishforge
147c3e3e18 🔒 Keep the module map out of customer Wiki reads and serve only Markdown pages under wiki/ 2026-11-08 22:46:22 -08:00
wishforge
ccd87cc23e ✨ Add the grounded project Copilot API over the Wiki snapshot 2026-11-08 22:36:06 -08:00
eust-w
59243ac85a 🐛 Give wish optimization more time, and a fallback model
Flash gets 180 s to finish the structured JSON. If it times out or the
JSON does not parse, the same request is tried again with deepseek-pro.
The console proxy waits long enough for both attempts.

Co-Authored-By: Claude Haiku 4.5 (1M context) <noreply@anthropic.com>
2026-11-02 15:30:20 +08:00
eust-w
7dfd5b159c 🐛 Optimize wishes with flash instead of the coding model
AI optimization called Claude CLI with no --model, so it used
deepseek-pro and hit the 120 s limit. It now uses flash by default,
with 140 s, and WF_CLAUDE_ASK_MODEL can override it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-02 15:25:21 +08:00
eust-w
8247cc209a 🐛 Invalidate pending releases and approvals when a run is canceled
Canceling a run at the release stage left its awaiting_approval release
and pending approval counted as waiting on the dashboard. Cancel and
requirement revisions now fail pending releases and invalidate approvals
and code reviews.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-02 15:01:39 +08:00
eust-w
b672d16277 ✨ Let project settings fetch the gateway's models
The available-models checklist has a "get models" button. The control
plane asks the gateway's /v1/models with its own key and returns names
only, to owners and admins.

Co-Authored-By: Claude Haiku 4.5 (1M context) <noreply@anthropic.com>
2026-11-02 14:28:16 +08:00
eust-w
b1f94302d7 ✨ Offer project models as a checklist, and default wishes to flash
Owners pick from deepseek-flash and deepseek-pro instead of typing names.
A wish uses flash when the project offers it, even if pro was listed first.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-02 12:10:38 +08:00
eust-w
4cffd71be8 ✨ Learn project skills from runs, and export a wish's report
- Skills: per-project know-how the platform proposes from each succeeded
  run (in the background, or on request from a run), people confirm,
  edit, disable, delete or write; active ones enter later prompts
- Export one skill as SKILL.md, or all as a zip with a directory per
  skill, as .claude/skills/ expects
- A wish's report: every run, its stage timeline, the agent's plan,
  replies, commands, changed files and model usage, the change, the
  checks, failures, reviews and releases, and the full event log, as
  Markdown, or laid out for printing to PDF

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:57:24 +08:00
eust-w
6d615c0ffd ⚖️ Count cache reads a tenth toward budgets, and allow runs up to 10M tokens
- countedTokens: input, output and cache creation in full, cache reads a
  tenth, as they cost; the worker meters Claude CLI usage with it and the
  usage event says how much counted
- A run's token budget may be raised to 10,000,000

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:26:27 +08:00
eust-w
72085cf752 ✨ Let a project offer models and a wish choose one
- Projects list the models their wishes may run with, the first by
  default; owners and admins set them in the project settings
- A wish may choose one of its project's models; the choice is checked
  and pinned to the run, which shows it, and the executor starts the
  agent with it (--model), else with the agent configuration's
- Model names may be spelled as the model gateway does
  (deepseek-pro@latest[1m]), in projects and agent configurations alike

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 03:08:35 +08:00
eust-w
aa151d16f9 ✨ Deliver to Fanyu's cluster from the dev branch beside the POC
- Profiles pin each environment: POC (branch poc) and Fanyu (branch dev,
  180.76.138.88, droboticflow-fanyu), with their Deployments by UID
- Releases expect every Deployment of their profile; Fanyu's api image
  also runs its annotation processor and validator, each rolled back to
  its own image
- Bindings may list several projects; each Runner has its own settings
- fanyu-access: least-privilege identity and build-Pod admission policy in
  Fanyu's cluster, its token only in the executor and Fanyu's Runner
- projects --replace: delete every project with all it holds, then create
  the POC and Fanyu projects, their environments and Runners
- Ship the Runner's public keys in the ConfigMap, not a Mac path

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 17:47:47 +08:00
eust-w
addf330b10 ✨ Add account types and enforce per-user wish permissions
- Provide six account types and custom combinations of wish, code review,
  release and management permissions, applied on each authenticated request.
- Enforce frontend-only accounts when submitting, answering, widening and
  reverting wishes; require every contributor to have full access before
  skipping backend code review.
- Gate code review and release decisions by their specific permissions.
- Rework member management to create and edit account types, permissions and
  project access, and reflect those permissions throughout the console.
- Update the manual and architecture docs with permission tests and
  end-to-end coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 12:07:08 +08:00
eust-w
17553e2f8f ✨ Let a person widen a frontend-only wish to backend code
When the agent of a frontend-only wish asks to change backend code, or keeps
changing it until the repair rounds run out, the run details offer "改为前端和
后端并继续". It answers the wish with allowBackend: the run may change backend
code from the new requirement revision on, the agent reads that the scope
changed, and the timeline records who widened it. Whether a backend change needs
a review still depends on the submitter's backend permission. Only an answer to
a frontend-only wish accepts the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 23:19:08 +08:00
eust-w
bf3313620e ✨ Let each wish stay frontend-only, and optimize wishes into short goals with choices
- Each wish says whether it may change backend code. A frontend-only wish is told
  which paths it must leave alone; a change to them goes back before any check runs,
  the platform puts those files back before the repair round, and the control plane
  never integrates them. A wish that may change backend code integrates directly for
  people with backend permission and waits for a code review otherwise.
- Owners and admins grant backend permission per person on the members page as well
  as per project in the project settings.
- AI optimization has its own button for the wish and for the criteria. It writes a
  wish of at most three lines (goal, scope, limits), keeps the details in checkable
  criteria, and asks only what the person must decide, as choices whose answers join
  the wish; suggested criteria are taken one by one.
- Lists, run titles, Feishu cards and pull request titles show a wish's first line;
  the run details show the rest.
- Changed paths no longer follow renames, so moving backend code into a frontend
  directory counts at both places for code review and for the frontend-only scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 20:37:30 +08:00
eust-w
44b1bee723 🐛 Treat POC images deployed by tag as of unknown source
Someone deployed the POC api and worker outside WishForge by mutable tags,
and every build then stopped with a raw validation error: the cluster
snapshot only accepted digest-pinned images.

A component running a tag is now of unknown source, as one set by hand
already was: the timeline names the component and its tag, the build makes
it again, and the release needs a person's approval. A release still deploys
digests only; what it replaces may be a tag of the same repository, and such
a release never declares itself rollback-compatible, since what the tag
pointed at may be gone. An image neither pinned nor tagged, or not of the
component's repository, stops the build with a message naming it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:58:42 +08:00
eust-w
a4eaefc69f ✨ Hold reviewed paths, take back runs, optimize wishes and notify in Feishu
What the pilot asked for, from its meeting:

- Code review: a project names the paths changes to which a person reviews
  before they reach the target branch (globs, with exceptions). After the
  checks pass, the verifier asks the control plane, and the run waits at
  integration until an owner or admin approves the exact commit; approving
  integrates it without repeating the checks, rejecting hands the comment to
  the agent as a new requirement. Continuing cannot get around it: the
  verifier asks again before every integration.
- Undo: "take back this change" starts a run that reverses what a run
  integrated on the current target branch, three-way, keeping later commits;
  only lines later commits changed too go to the agent. It then verifies,
  integrates and delivers like any run. Releases get a rollback button for the
  version live in their environment.
- Wish optimization: the local Claude account rewrites a draft wish and its
  acceptance criteria by built-in and project rules, with no tools at all;
  the person compares and decides, nothing is submitted for them.
- Release confirmation: an environment can make every release wait for a
  person, not only those the risk rules flag.
- Feishu notifications: a group bot is told of releases awaiting approval and
  changes awaiting review (mentioning the decision makers), runs that need a
  person, finished runs and failed releases; each once, signed when a secret
  is set, with text from runs never acting as card markup.
- Reviewers see the agent's change summary and who submitted the wish, and
  whether the checks ran in the macOS sandbox; the wish form offers only the
  executors this deployment can run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:08:27 +08:00
eust-w
e8f99f4b24 👥 Let each person sign in with an account of their own
Everyone used the one local administrator, so the system could not tell who
asked for a change, and anyone could approve anything. Owners and admins now
create accounts on a members page: a login name, a display name and a role,
with a password shown once. The control plane keeps only its scrypt hash, and
account creation is deliberately not replayable by idempotency key, so the
password is stored nowhere a replay could return it.

The console checks a password through a control plane route its proxy never
forwards from a browser, then calls the control plane with its local
credential plus the person's account and password version; those headers
count only together with that credential. Disabling an account stops it at
once, and resetting a password ends its existing sessions. A session that is
neither the administrator nor a valid account gets no credential at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:08:14 +08:00
eust-w
862a133f36 🌐 Name the reasons a release waits for approval in Chinese
The release page listed why a release needs approval as the control
plane wrote it, in English, while everything around it is Chinese, and
approving is the one decision there that a person has to make.

The reasons now live in the contracts package, in a module that imports
nothing, as the provider list does: the control plane gives them and the
console names each in Chinese, a protected change with its path. A
reason the console has no name for fails its type check; one it does
not know at all is shown as it came.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 11:32:08 +08:00
eust-w
9099f06ba8 🔒 Ask for approval on every image recipe and dependency manifest
A release counted as protected only a file named exactly Dockerfile,
the Node and Python manifests and the .github directory. The local POC
builds its images from Dockerfile.api, Dockerfile.worker and
Dockerfile.drosync-coordinator, and pins Go and Rust dependencies in
go.mod, go.sum and Cargo files: changing any of them was deployed
without approval wherever releases are preauthorized, and so were
changes to .dockerignore, *.dockerfile, Containerfiles and Gitea or
GitLab CI.

The rule now lives in the contracts package. Any Dockerfile or
Containerfile, the build context's ignore list, Compose files, every
dependency manifest and lock file the verifier knows, and the CI
locations need a person; the verifier's notion of a dependency manifest
is the same list. Ordinary source, tests and documents still go
through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 22:43:13 +08:00
eust-w
2b9dab593b ⚡ Start a queued run within seconds of an execution slot freeing
A start that found the tenant's execution slots taken was deferred
like a failed delivery, backing off to two minutes between looks. On
the local POC, which allows one run at a time, the next person's wish
could sit for two minutes after the run before it finished or stopped
to wait, and every look left an error line in the log.

Waiting for a slot is ordinary queueing: the dispatcher now looks again
every ten seconds, one small transaction each time, and logs nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 19:56:55 +08:00
eust-w
6722319314 🔒 Weigh a release by everything its environment does not run yet
A release's risk only counted what the target branch gained when the
run integrated. Commits people pushed to the branch directly, and
integrations that were never deployed, went out with the next release
without being classified: an environment preauthorized for automatic
release took a migration or a Dockerfile change pushed straight to the
branch without approval. The POC chose what to rebuild from the same
narrow diff, so worker and coordinator kept running old code; on the
local POC, WishForge had in fact only ever rebuilt the api.

The control plane now gives the verifier the commit of the release the
environment runs, and the classification covers everything between it
and the release, as well as what the integration brought. On the POC,
each deployment records the commit and the image a release put there.
The build plans from that snapshot, the one the release is checked
against: worker and coordinator keep their images only while what they
run differs from the source in web files alone. A component of unknown
source (never deployed by a release, restored by a rollback, or set by
hand, which leaves the annotations stale) is rebuilt, and the release
is marked partial: it needs approval and does not roll back on its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 16:44:13 +08:00
eust-w
df87c5dca6 🐛 Drop a run start that a newer one replaced before it takes the run back
The dispatcher read the run, checked that the start it was delivering
was still the pending one, and reserved the execution grant in a later
transaction. A pause and a continue in between enqueued a newer start,
and the older one went ahead anyway: it took the run's execution
generation back and asked the provisioner for a sandbox for a
generation that had already been replaced.

Reserving the grant now checks the pending start again, in the
transaction that takes the generation, and refuses a replaced one with
START_SUPERSEDED. The dispatcher acknowledges such a start without
marking the run as waiting; the newer start proceeds as usual.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 15:56:14 +08:00
eust-w
ad06e82c67 ⚡ Reuse the verification of an integrated commit when its build continues
A build that stopped on an infrastructure fault, like the drops of the
POC's link to its cluster, repeated the whole protected verification
when continued: installation and every check, about two and a half
minutes on the POC, for a commit whose verdict could not change.

When the integrated commit is the verified checkpoint itself, the
verifier now reuses that verification evidence and only restores the
workspace for the build; the timeline says so. The control plane
offers only test and build evidence recorded under the current
protected policy, as a release requires: after the operator changes
the checks, the run verifies again. That also keeps an executor that
continues at the release stage from requesting a release with
evidence the release would refuse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:54:01 +08:00
eust-w
01acc236a0 🔒 Keep internal failures out of MCP tool results, as the HTTP API does
The HTTP API answers an unexpected failure with a generic message and
leaves the details to the server log. The MCP tools returned any
error's message to the client instead: a database, filesystem or
upstream failure could hand an agent client connection strings, table
names or internal paths.

MCP tool results now follow the HTTP API's rules: domain errors keep
their code, message and details, invalid input reports its validation
issues, and anything else is INTERNAL_ERROR with a pointer to the
server log, where the details are written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 14:54:01 +08:00
eust-w
fbcd273a08 🐛 Count the tokens of a stopped Claude Code session, and show its last message once
Claude Code and CodeBuddy report a session's usage only in their final
result. A session stopped before it (paused, canceled or out of time)
reported nothing, so its tokens never reached the run's budget or the
monthly plan: the paused session of the 2026-10-26 POC run was recorded
as 0 tokens, and repeated pauses could have spent without limit.

The adapter now adds up the usage each model response carries in the
stream, once per response although the CLI repeats it on every content
block, and reports that as the session's final usage when no total
arrives. The executor meters it like any final usage; the timeline
marks it as estimated, since the last response's output may be
undercounted.

The final result usually repeats the agent's last message word for
word, which the timeline then showed twice; it is now shown once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:24:42 +08:00
eust-w
e734bd9846 🐛 Decide which limit stops a stalled model call when its timer is set
The stall timer chose between "idle" and "deadline" by reading the clock
when it fired. A timer armed for the idle limit could fire after the
deadline had also passed on a busy machine, and was then reported as a
deadline stop, which the proxy test caught intermittently. The reason
is now fixed when the timer is armed: whichever limit is nearer.

The two timing tests also get wider margins: the steady stream sends a
frame every 30 ms against a 300 ms idle limit, and the deadline case
can only be stopped by its deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 01:53:19 +08:00
eust-w
fe13f6c862 🔒 Hide a workspace's internal upstream when it is requested again
Requesting a project's workspace returned the existing record as
stored, including the internal Theia and collaboration upstreams that
the list leaves out. Both now show the same public fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:11:12 +08:00
eust-w
9c879ff3c5 🐛 Let a failed build resume, and keep the release risk it classified
- verifyRun returned deliver() unawaited inside try/finally, so the
  session closed and deleted the workspace while the build still used
  it: a build continued after an infrastructure failure always failed.
  The failure handlers there were unawaited too.
- The resumed build classified the release risk from the checkpoint's
  base, not the target branch it integrated onto, and replaced the
  earlier classification: a migration brought by an IDE branch no
  longer counted. Integration evidence now records the target commit
  it integrated onto, the resumed build classifies from it, and a
  commit's classification only ever widens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:11:12 +08:00
eust-w
5df77ad761 🔒 Authenticate internal callers without the write lock; retire superseded generations
- Looking up a run-scoped token or a runner token ran in a write
  transaction, which holds the tenant's advisory lock: anyone with a
  long enough token could tie up every change of the tenant, and each
  executor heartbeat, event and meter took that lock just to
  authenticate. The lookups now only read.
- Continuing or answering a run queues a new generation, but until the
  dispatcher started it, the old generation's token still worked and
  could even lease the run again for the new requirement revision. A
  generation now stops acting as soon as a newer one is pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:11:12 +08:00
eust-w
30369c1430 ✨ Save the agent's work before a run pauses
Pausing revoked the executor at once: the agent was killed and the work
of the current attempt stayed only in the executor's local workspace,
so continuing started that attempt over.

A pause of a run whose executor holds the lease now drains it first:

- The run keeps `running` with pauseRequestedAt (the console shows
  pausing). Its agent gets no model credential and no new model
  request; continuing is refused until the pause completes; cancelling
  still stops it at once.
- The executor learns of it from its heartbeat, stops the agent, saves
  a checkpoint with its live lease and completes the pause through
  /internal/runs/:id/pause. Continuing restores that checkpoint.
- The workflow is stopped only after the pause completes; stopping it
  earlier would abort the save. A model request interrupted by the
  stop no longer expires the pausing run's lease.
- If the executor does not complete it within two minutes, or stopped,
  the heartbeat, the next lease, the coordinator's wait or the
  background sweep pause the run anyway.

Runs no executor is working on still pause at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:38:06 +08:00
eust-w
1f7360075b 🐛 Keep deployments moving past stale releases and failed rollbacks
- The runner took the newest ready release and threw when it was
  stale, on every poll, so nothing else in the environment deployed.
  Polling now fails stale ready releases (canceled runs, revised
  requirements, changed code, configuration or approval), tells their
  runs, and deploys the next one. A paused run's release waits, since
  continuing may make it current again.
- A rollback the runner reported as failed stayed unknown and held the
  environment, which neither unlock nor another rollback could free. A
  definite failure now frees it; an unknown rollback can be unlocked by
  an owner or admin after checking the target, which cancels it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:32:16 +08:00
eust-w
9b2c8f14a9 🐛 Repair installations the agent's manifest changes broke instead of waiting
Every failed installation waited as an infrastructure fault. When the
agent's own change broke it (a misspelled package, say), continuing
installed the same manifests before the agent ran, failed again, and
the agent never got a turn: the run could not move without a new
requirement revision.

- The verifier attributes a failed installation to the checkpoint when
  it changed dependency manifests (package.json, go.mod, lockfiles and
  the like) and the output is not a network or registry failure. The
  evidence lists those manifests, and the control plane records an
  `install` failure that the next repair round fixes.
- A repair round for an `install` failure starts the agent even when
  the installation fails again, with that output in the prompt.
- Prompts, lessons and the run page name the failed installation.

Any other failed installation still waits for the environment, without
spending a repair round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:32:16 +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
42d28f7013 🔒 Let only a person add or revoke provider credentials
Connector tokens (MCP and other agent clients) held by an owner or admin
could replace or revoke the tenant's provider key through
/v1/provider-connections. Creating and revoking now require a human, as
creating environments and registering runners already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 04:04:27 +08:00
eust-w
e1c381486d 🐛 Keep long model streams alive and retry rejected model requests
The proxy aborted every upstream call 120 seconds after it started, even
while the model was still streaming, so a long reasoning turn ended as an
unknown outcome that an admin had to reconcile. Calls now stop only when
no bytes arrive for 2 minutes, or after 10 minutes in total, inside the
15 minutes after which the reaper treats a request as lost. The recorded
reason says which limit stopped it.

A rejected request (a 429, an invalid request, or one stopped before
upstream I/O) was stored and replayed for every retry of the same body,
so one rate limit stalled the run for the rest of its lease. Rejections
use no tokens, so a retry is now sent again; completed responses are
still replayed and unknown outcomes still wait for reconciliation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 04:04:27 +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
b4ece6057c fix: let the console build, and stop runs that cannot afford the next model request
Building the web image showed that `next build` failed.
- The console imported runtime values from the contracts entry point.
- Turbopack cannot follow the NodeNext `.js` imports inside that entry,
  which also carries zod and every schema into the browser.
- Only `next dev` had ever run before, and the console used to import
  types only.

The fix:
- The executor catalog moves to an entry without imports, exported as
  @wishforge/contracts/providers. The console takes its values from
  there.
- providerBaseUrl moves to its own module.
- A test keeps value imports of the entry point out of the console.

With the console's default budget of 50,000 tokens, every Codex run
stopped after one model request:
- The proxy reserves one token per request byte, and a Codex request is
  already about 50 KB.
- The executor then reported a bare 429 as a provider failure.

The fix:
- A request the remaining budget cannot cover now puts the run into the
  `budget` wait, with what it needs and what remains.
- The console defaults to 300,000 tokens and explains the reservation.

The run page also marked the stage a successful run ended in as not yet
done; it now shows it as complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 05:20:27 +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