15 Commits

Author SHA1 Message Date
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
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
f9eb1f5dfd 📝 Document code review, undo, accounts and notifications
The architecture gains the code_review wait and gate, revert runs, Feishu
notifications, wish optimization, the new entities and how the console acts
for a local account; the POC operations guide covers accounts and the bot's
settings; the repository contract notes the review and the revert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 17:08:27 +08:00
eust-w
b201fd04a9 ✨ Wait for people when commits pushed to the target branch broke it
When a run's change passed its checks but failed one once merged onto
a target branch that moved meanwhile, the agent got a repair round for
it, even when the failure came from commits other people had pushed:
it would change their code, and spend rounds and tokens doing so.

The verifier now runs that check, recording no evidence, on the target
branch alone. If the branch passes, combining the two caused the
failure, and the agent repairs it as before. If the branch fails too
while the commit the run started from passes, the commits pushed since
broke the branch: the run waits on the new reason target_broken, uses
no repair round, and has its own verified change as its checkpoint
again. A run that started from a commit already failing the check may
be its fix, and is repaired as before.

Continuing merges the verified change onto the repaired branch and
checks the merge. An integration that continues reuses the change's own
verification under the same policy instead of repeating the checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 18:14:19 +08:00
eust-w
92a06dd3b2 🐛 Repeat the POC acceptance checks a settling rollout can fail, and show every retry
The public checks after a POC rollout (health, readiness, the entry
page, the API build commit and the protected smoke checks) were each
made once. Just after a rollout the public address can still reach a
Pod that is shutting down, which answers with the old build commit, and
the link can drop: either failed a healthy release and rolled it back.
They now take up to six attempts, waiting 2 to 10 seconds; a release
whose checks never pass is still rolled back.

Retries were also silent: a build slowed down by a flaky link looked
stuck. Every repeat now says what went unanswered and when the next
attempt comes, in the run's timeline during a build and in the Runner's
log during a release. Requests and checks share one retry helper.

The third live test found kubectl cp and exec reporting a failed dial
as "error: dial tcp ...: connect: operation timed out", without the
"Unable to connect to the server" of get. That upload was not retried
and the build stopped; dial failures and connection timeouts now count
as unanswered, checked against the messages seen on the POC link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 05:06:46 +08:00
eust-w
56a845f53c 🐛 Ride out a flaky link to the POC cluster during builds and releases
In the 2026-10-26 POC run the Mac's link to the cluster API dropped
about once a minute. One unanswered kubectl call ended the whole build
twice, though the Kaniko Pod kept building, and each manual resume
re-ran the protected verification. The release path had the same
weakness with worse consequences: a dropped rollout watch counted as a
failed rollout and rolled a healthy release back.

Only requests that are safe to repeat are repeated, and only when the
cluster API left them unanswered (no connection, a broken connection,
kubectl hung), never when it refused them:

- Reads take up to six attempts, waiting 2 to 30 seconds between them.
- The builder looks its Pod up by its attempt-unique name before each
  create, adopting a Pod whose create answer was lost.
- A lost source upload is sent again. Unpacking runs once at a time,
  refuses an upload whose SHA-256 differs from the archive, and marks
  the context ready only when complete, so Kaniko never starts from a
  partial context; a damaged upload is sent again.
- A dropped rollout watch resumes for the rest of the rollout timeout.

Patches are still never repeated. A link that stays down longer still
stops the run as an infrastructure fault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 02:25:34 +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
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
3eb8ea03bf feat: run models through an operator's OpenAI- or Anthropic-compatible gateway
The model proxy always forwarded to api.openai.com and development runs gave
Codex no base URL or model, so a company model gateway could not be used.

- WF_OPENAI_BASE_URL points the production proxy (and development Codex runs)
  at an OpenAI-compatible gateway with the Responses API; WF_ANTHROPIC_BASE_URL
  gives Claude Code an Anthropic-compatible one as ANTHROPIC_BASE_URL. Both are
  operator settings in the provider catalog, HTTPS without credentials
  (loopback HTTP outside production); an invalid gateway disables the proxy.
- Development credentials now carry the run's model, so WF_CODEX_DEFAULT_MODEL
  selects a model the gateway serves.
- tests/integration/real-model.test.ts (WF_REAL_MODEL_INTEGRATION=1, key from
  WF_TEST_MODEL_API_KEY) runs one wish through the real Codex executor, the
  verifier and integration into a local repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 22:28:33 +08:00
eust-w
1d75b03430 feat: register executors in one catalog and add Claude Code (FR-D1)
Adding an executor touched the contracts, the API's availability check, the
worker and the console separately. Now it is an adapter plus one entry in
@wishforge/contracts' providerCatalog (name, executable variable, whether the
model proxy isolates its credentials) and one in the worker's
providerRegistry; the API, the console's options and MCP's submit_wish read
the catalog, and a test checks every entry is registered with the worker.

The CodeBuddy adapter already parsed Claude-Code-style stream-json, so it is
now a StreamJsonCliAdapter with a dialect per CLI. Claude Code runs headless
with --verbose and --permission-mode bypassPermissions inside the per-run
sandbox and receives only ANTHROPIC_* credentials (WF_CLAUDE_BIN). Like
CodeBuddy it is development-only until the model proxy supports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:23:05 +08:00
eust-w
0bcfbc13dd feat(ide): push IDE work to ide/ branches and merge it through a verified wish
People's changes now reach the target branch the same way the agent's do. The
IDE credential carries a ref prefix and the Git service runs a pre-receive hook
on every push that refuses updates outside it, so the IDE can push only
`ide/` branches; the platform's own integration is unaffected.

- A wish may name a source branch. The run starts from that branch's head, the
  agent builds on it, and verification, repair rounds, merging onto a moved
  target and conflict repair work as before. A missing branch makes the run
  wait (git_storage) until it is pushed.
- Release risk is now computed from the target branch before integration, not
  from where the run started: a migration committed on the source branch would
  otherwise have been missed and could have skipped approval.
- Clones work on `ide/work`; a plain `git push` publishes it.
- The console lists a project's IDE branches with a button to submit a wish
  that merges one, and the new-wish form has a starting-point field; MCP
  `submit_wish` accepts `sourceBranch`. The Git service lists branches under
  a prefix for this (`POST /refs`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 19:17:14 +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
b38db08eeb docs: align documentation with the code and write it in Chinese
Operations, development and architecture docs, the reference pages and the
component READMEs were rewritten against the code: every documented variable
exists, and the settings operators need (runtime image, Git service, listen
addresses, Runner targets, single-tenant gateway and provisioner bindings) are
documented.

Gaps the docs used to present as working are now stated as such: IDE
workspaces do not clone the project yet (FR-H2), and in Kubernetes mode
dependency installs and image builds have no network path until an egress
proxy and builder access exist. The Kubernetes README describes what the
provisioner creates, what the Runner needs in a target namespace, and the
cluster acceptance that is still outstanding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 18:01:39 +08:00
eust-w
86649af4d6 docs: rewrite architecture and restructure documentation
- docs/architecture.md replaces system-design.md: component map,
  run state machine with an explicit waiting-reason catalogue, key
  sequences (dispatch, execute/verify/repair, integrate, release,
  IDE launch, lessons), data model, API surface, identity and trust
  model, isolation modes (host for local development, kata for
  production), deployment topology, ADRs, known limitations and a
  requirement-to-test verification matrix.
- docs/development.md: local setup, one-command start, first wish,
  IDE, MCP and the test matrix (integration toggles are explicit).
- docs/operations.md: production prerequisites, explicit deployment
  mode, component configuration, Kubernetes provisioner, tenants and
  quotas, IDE gateway routing and lifecycle, delivery, monitoring,
  backup/restore, incident handling and known risks. Merges the former
  observability, recovery, billing-entitlements and runbook documents.
- Contract documents move to docs/reference/; evidence narratives that
  pointed at machine-local /private/tmp files are removed and the UI
  reference is rewritten for the target console.
- Delete docs for removed scope: workspace snapshot handoff and private
  application access.
- README rewritten as a concise entry point.

The documents describe the target state that the following
implementation commits realise.

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