diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..ac2f7d3f --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @lucbocahut diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 00000000..66bbf1da --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,49 @@ +name: Bug report +description: Report something in Forge that does not work as documented. +labels: [bug] +body: + - type: markdown + attributes: + value: | + **Do not paste secrets.** Remove API keys, GitHub App private keys, tokens, cookies and provider logins before submitting. Worker output and service logs can contain tokens: redact them, or share only the lines that matter. + + Security vulnerabilities must not be reported here. Use **Report a vulnerability** on the repository's Security tab instead. + - type: textarea + id: what-happened + attributes: + label: What happened + description: What you did, what you expected, and what happened instead. + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: Steps to reproduce + description: The smallest sequence of steps that shows the problem. + placeholder: | + 1. + 2. + 3. + validations: + required: true + - type: input + id: revision + attributes: + label: Forge revision + description: The commit or release you are running. + - type: dropdown + id: area + attributes: + label: Area + options: + - Installation or update + - Operator UI + - Workers and coding accounts + - GitHub publication and merging + - Other + - type: textarea + id: logs + attributes: + label: Relevant output + description: Redacted log lines or error messages. Check again that no tokens or keys are included. + render: text diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 00000000..653ce1d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,23 @@ +name: Feature request +description: Suggest a change or new capability for Forge. +labels: [enhancement] +body: + - type: textarea + id: problem + attributes: + label: Problem + description: What are you trying to do, and what gets in the way today? + validations: + required: true + - type: textarea + id: proposal + attributes: + label: Proposal + description: The change you would like to see. + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Alternatives considered + description: Other approaches or workarounds you have tried. diff --git a/.gitignore b/.gitignore index cce7769d..7cfadd9a 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,9 @@ runner-seccomp.json !/ui/tests/e2e/fixtures/setup/ !/ui/tests/e2e/fixtures/setup/** .superpowers/ + +# Build and OS artifacts +.DS_Store +*.egg-info/ +build/ +dist/ diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..8b50c6e2 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,134 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement privately through +the repository's **Security** tab: choose **Report a vulnerability** to open a +private report that only the maintainers can see, and state that it is a Code of +Conduct report. Do not report conduct issues in public issues or discussions. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/LICENSE b/LICENSE index 704a6e5e..215db26a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 Forge contributors +Copyright (c) 2026 Luc Bocahut Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/SECURITY.md b/SECURITY.md index 88272f78..8d67efee 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,12 +2,10 @@ ## Report a vulnerability -Use [GitHub's private vulnerability report](https://github.com/XRPL-Commons/forge/security/advisories/new) -when available. Private reporting availability has **not yet been verified for -this release**. If GitHub does not offer **Report a vulnerability**, open a -[Security contact request](https://github.com/XRPL-Commons/forge/issues/new?title=Security%20contact%20request) -asking the maintainers for a private channel. Include no vulnerability details -in that public request; wait for the private channel before sending them. +Report vulnerabilities privately through GitHub: open the repository's +**Security** tab and choose **Report a vulnerability**, or go directly to +[the private report form](https://github.com/XRPL-Commons/forge/security/advisories/new). +Do not open a public issue for a vulnerability. Do not publish exploit details, credentials, private source or raw worker output. A private report should identify the affected Forge revision, deployment type, @@ -60,8 +58,7 @@ The mechanisms above are implemented contracts, not a claim that every host, provider or repository has passed live qualification. Setup checks the installed runner and provider; publication requires evidence for its current target and App context. Synthetic tests and sandbox canaries do not prove a complete -production issue-to-merge journey. Track that acceptance separately in the -[onboarding release audit](docs/onboarding-release-audit.md). +production issue-to-merge journey. Resource admission, timeouts and memory limits reduce resource exhaustion. They do not isolate credentials or establish authorization. Do not weaken ownership, diff --git a/docs/README.md b/docs/README.md index 5c252c4f..f1ecc41c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -41,7 +41,6 @@ The four operator Help guides (shown in the UI) are marked **Help**. ## Status and direction - [Implementation status](implementation.md) -- [Current architecture target](target-architecture.md) - Security boundaries: [SECURITY.md](../SECURITY.md) ## Operator UI diff --git a/docs/configuration.md b/docs/configuration.md index bbe65e93..f5e73f82 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -12,7 +12,7 @@ Configuration refers to stored credentials by name (`private_key_env`, `provider | Variable | Read by | Default | Purpose | |---|---|---|---| -| `FORGE_ROOT` | `legacy/forge-status.py`, UI help route | `~/ops/forge-watchdog` (API); `/app` in the UI container | Runtime root: state, configuration, credentials | +| `FORGE_ROOT` | `legacy/forge-status.py`, UI help route | set by setup for the API; `/app` in the UI container | Runtime root: state, configuration, credentials | | `FORGE_BIND_ADDRESS` | `legacy/forge-status.py` | none; must be `127.0.0.1` | Status API listen address. The API refuses to start otherwise | | `FORGE_PORT` | `legacy/forge-status.py` | `8787` in code; setup writes `8788` | Status API port (the UI takes 8787) | | `FORGE_UPSTREAM_SECRET_FILE` | `legacy/forge-status.py` | `/state/ui-upstream.secret` | Secret proving requests came through the UI proxy | @@ -42,5 +42,3 @@ Forge sets these itself. Do not set them by hand. | `FORGE_EGRESS_IMAGE`, `FORGE_EGRESS_USER` | `forge/host_update.py` | Egress proxy build inputs | | `FORGE_ASSIGNMENT`, `FORGE_RESULT`, `FORGE_HARNESS_AUTH`, `FORGE_AUTH_DIGEST`, `FORGE_PROBE_SECRET`, `GH_TOKEN` | runner → worker container | Per-job assignment, result path, provider login and scoped GitHub token | | `FORGE_REQUIRED_SERVICES` | runner (full tier) | Services `forge-services` starts for a job; see `docs/job-environments.md` | - -The legacy tmux supervisor's `MAX_SESSIONS*`, `FORGE_*_BIN` and triage variables were removed with it (#110) and are no longer read. diff --git a/docs/dependency-review.md b/docs/dependency-review.md deleted file mode 100644 index 4b277a03..00000000 --- a/docs/dependency-review.md +++ /dev/null @@ -1,19 +0,0 @@ -# UI dependency review — 2026-11-07 - -Scope: the six open GitHub Dependabot alerts for `ui/package-lock.json`, plus the additional minimatch advisory returned by a current npm audit. No forced overrides, production changes, or advisory dismissals. - -## Fixed - -- **happy-dom 20.14.6 → 21.0.4** (direct development dependency). Addresses [GHSA-834v-8h66-3h79](https://github.com/advisories/GHSA-834v-8h66-3h79) (host code execution through import aliases) and [GHSA-c8p4-j97h-3vg8](https://github.com/advisories/GHSA-c8p4-j97h-3vg8) (SSRF from HTML parsing). Used by the Vitest/Nuxt component test environment, not the deployed server. Both installed test-tool peer ranges accept 21.0.4; its Node >=20 floor is below Forge's Node 24 build runtime. -- **mermaid 11.17.2 → 12.2.0**, resolving **katex 0.16.47 → 0.18.10** through Mermaid's supported `^0.18.0` dependency. Addresses [GHSA-238p-pmpm-9mq7](https://github.com/advisories/GHSA-238p-pmpm-9mq7). The vulnerable path requires existing prototype pollution to bypass KaTeX trust checks. Mermaid is client-side and lazy-loaded for bundled help-document diagrams; `help-diagrams.ts` sets strict security and `htmlLabels:false`. Patched dependency is preferable to treating those constraints as a fix. Latest Mermaid 11 still requires vulnerable KaTeX ^0.16.47; no incompatible override used. [Mermaid 12 release notes](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4012.0.0): Node >=22.12, Safari >=17.4/ES2024, new layout/look defaults. Forge preserves existing appearance with `layout:'dagre'`, `look:'classic'` and validates help diagrams. Existing initialize/render APIs remain supported. - -## Remaining upstream advisories - -- **glob 13.0.6 and 10.5.0** — [GHSA-3g3m-2fjr-6pw4](https://github.com/advisories/GHSA-3g3m-2fjr-6pw4), moderate, fixed in 14.0.2. Paths: `@vue/test-utils → js-beautify → glob`; `nuxt → @nuxt/nitro-server → nitropack → @vercel/nft → glob`; `nitropack → archiver → archiver-utils → glob`. Latest js-beautify 2.0.3 requires ^13.0.6 and @vercel/nft 1.11.1 requires ^13.0.0, so no supported complete upgrade exists. Vulnerability is traversal continuing after AbortSignal cancellation. Inspected NFT's two calls in `out/analyze.js`: no signal option. js-beautify's CLI calls globSync without signal; Vue's formatter uses the beautify library, not that CLI. These are build/test paths, not UI request handlers. Nitro 2.13.6 would remove the old archiver/glob10 subtree but leaves glob13, so omitted incidental churn from this release change. No claim that arbitrary uses of glob are safe. -- **esbuild 0.27.7** — [GHSA-g7r4-m6w7-qqqr](https://github.com/advisories/GHSA-g7r4-m6w7-qqqr), low, fixed in 0.28.1. `@nuxt/ui → @nuxt/fonts 0.14.0 → fontless 0.2.1 → esbuild ^0.27.0`; other build tools share it. Even latest @nuxt/ui 4.12 retains @nuxt/fonts ^0.14.0. Advisory requires esbuild's development server using `servedir` on **Windows**. Forge builds its UI in a Node24 Linux container and runs the bundled Nitro server; it does not serve production with esbuild. Nitro separately already has esbuild0.28.2. Updating Vite/unplugin would not remove fontless's constraint, so no unrelated upgrades or forced0.28 override. -- **deepmerge 4.3.1** — [GHSA-gcqx-w48m-w2h4](https://github.com/advisories/GHSA-gcqx-w48m-w2h4), low, no patched release. `nuxt → @nuxt/nitro-server → nitropack → @rollup/plugin-node-resolve16.0.3 → deepmerge`. Inspected the resolver's only call: `deepFreeze(deepMerge({}, defaults))`, where defaults is a source-code literal containing fixed arrays/booleans. User opts use object spread separately. The reported malicious-source-object premise is absent at this call. Build dependency; no untrusted request object reaches it. Keep tracked until upstream fixes/removes it; npm audit's suggested Nuxt downgrade is inappropriate. -- **minimatch 9.0.9 and 10.2.6** — [GHSA-g3hv-75wg-m249](https://github.com/advisories/GHSA-g3hv-75wg-m249), moderate, newly returned by npm audit, fixed in11.0.1. Paths: `vue-tsc2.2.12 → @vue/language-core → minimatch9`; `js-beautify → editorconfig3.0.2 → minimatch10`; `glob13 → minimatch10` and `archiver-utils → glob10 → minimatch9`. Globparts amplification can exhaust resources with adversarial patterns. Inspected Vue usages take patterns from Vue compiler config; editorconfig takes repository config patterns. Build/typecheck/format paths, not operator web requests. Upstream ranges exclude11; upgrading only vue-tsc would still leave others and adds an unrelated major-version change. No override. - -## Validation and release limits - -The combined validation used Node 24 and a fresh `npm ci`. Typechecking and the production build passed. Of 623 component tests, 622 passed initially; the remaining help-length check passed after shortening the runtime guide (31 help tests passed on rerun). All 47 browser suites passed, including Help diagrams, onboarding, account recovery and settings. The mobile Help rendering was also inspected. The current npm audit still reports 19 affected dependency nodes (3 low, 16 moderate), representing the four underlying advisories above. This is not a clean audit or a substitute for reviewing third-party distribution terms. diff --git a/docs/implementation.md b/docs/implementation.md index 23403133..9c591de6 100644 --- a/docs/implementation.md +++ b/docs/implementation.md @@ -73,11 +73,3 @@ structured results and active/pinned evidence. See [schema upgrades](store-migra Implemented behavior is distinct from release qualification. Synthetic lifecycle, restart and boundary tests and real sandbox canaries provide specific evidence; they do not prove an authenticated production workflow for every deployment. - -The release acceptance batch must follow the public setup instructions on a clean -supported host, recover interrupted consent and login, complete the first-merge -test, and finish ordinary and combined work with the intended approval policy. -Measure the full operator journey separately from the saved installation timer, -which currently starts after the interview. Track receipts and remaining gaps in -the [onboarding release audit](onboarding-release-audit.md). This document does not -claim that those live acceptance runs or the historical latency target have passed. diff --git a/docs/issue-conversations-reference.md b/docs/issue-conversations-reference.md index e249979c..e6360c07 100644 --- a/docs/issue-conversations-reference.md +++ b/docs/issue-conversations-reference.md @@ -1,6 +1,6 @@ # Issue conversations — implementation reference -For the operator walkthrough, read [Talking to a worker](issue-conversations.md). The storage description below applies to selected SQLite installations; qualification dates describe historical checks, not a guarantee about a future release. +For the operator walkthrough, read [Talking to a worker](issue-conversations.md). An issue's **Discuss blocker** control opens a durable conversation. The agent receives the issue, candidate identity, the four latest attempt summaries, recent decisions and twelve recent conversation messages. It has job-bound read-only mirror access and its own disposable runner; GitHub credentials remain outside the worker. Its logical role is the steward, using the same dossier-v1 and decision-v1 contract as planning and recovery. It can explain findings and rank up to four available issue actions. **Choose this option** opens the existing operator confirmation flow; confirming it, or an authenticated exact close command described in the operator guide, submits a stable operator request through normal controller validation. The discussion worker cannot approve a merge or security exception. @@ -12,22 +12,22 @@ Selecting an offered action sends the assistant message ID and stored choice ID. The result, subject and execution identity remain immutable. Later messages or captures do not overwrite them. Existing discussion leases and operator receipts govern execution and application; no synthetic delivery is created for a conversation. Historical discussion results retain their original validation path. -## Historical session continuity qualification (26 September 2026) +## Session continuity -Checked the actual installed image `forge-runner:stuck-recovery` without credentials or network access: +Forge does not resume native provider sessions. Each discussion turn starts a new worker with saved evidence: -| Provider | Installed CLI | Native capability | Existing Forge artifact | Implementation | -| --- | --- | --- | --- | --- | -| Codex | 0.153.4 | `codex exec resume SESSION_ID` | Fresh `exec` per assignment; disposable home removed on reset, no durable session mapping | New discussion with saved evidence | -| Claude | 2.1.273 | `--resume`, `--fork-session` | Adapter explicitly uses `--no-session-persistence` | New discussion with saved evidence | +| Provider | Native capability | Forge behavior | +| --- | --- | --- | +| Codex | `codex exec resume SESSION_ID` | Fresh `exec` per assignment; disposable home removed on reset, no durable session mapping | +| Claude | `--resume`, `--fork-session` | Adapter explicitly uses `--no-session-persistence` | -CLI help establishes the flags, not successful native resumption. Native resume is deliberately **not qualified or enabled** here. Authentication and session history are different: existing ChatGPT and Claude logins are retained, but sharing a login cannot restore deleted conversations. Old issues and unavailable sessions always have the reconstructed-context route. +Native resume is deliberately **not enabled**. Authentication and session history are different: existing ChatGPT and Claude logins are retained, but sharing a login cannot restore deleted conversations. Old issues and unavailable sessions always have the reconstructed-context route. The latest attempt's provider is preferred if verified and available; another connected provider can answer when it is not. The UI identifies the source attempt and labels reconstructed context. No active worker conversation or worktree is modified. A future native-resume implementation would need explicit issue/attempt/session binding, selective transcript persistence excluding credentials, expiry/deletion, isolated forks and real tests across cleanup/restart. Never copy a provider home directory as a session archive or resume `--last` on a shared account. ## Lifecycle and limits -In the selected runtime, SQLite discussion rows store conversations and retained job intent; the pre-cutover compatibility implementation used `state/issues/discussions.json`. The selected runtime does not read that file as a fallback. One discussion worker runs at a time, after productive dispatch. It obeys existing memory admission and provider leases, uses a ten-minute execution deadline and gives up queued admission after ten minutes. It never consumes issue failure attempts. Each authenticated message allows at most three physical worker executions, including failed or cancelled executions. At the limit, the thread records an explanation and becomes unavailable. Send a new question or instruction to continue; repeating the same unanswered text is a retry of the same turn and cannot reset the cap. Setup/reset cancels discussions before touching accounts. Cleanup failure retains the job and lease until absence is verified. +SQLite discussion rows store conversations and retained job intent. One discussion worker runs at a time, after productive dispatch. It obeys existing memory admission and provider leases, uses a ten-minute execution deadline and gives up queued admission after ten minutes. It never consumes issue failure attempts. Each authenticated message allows at most three physical worker executions, including failed or cancelled executions. At the limit, the thread records an explanation and becomes unavailable. Send a new question or instruction to continue; repeating the same unanswered text is a retry of the same turn and cannot reset the cap. Setup/reset cancels discussions before touching accounts. Cleanup failure retains the job and lease until absence is verified. The UI polls bounded snapshots, including public assistant text emitted so far, every 2.5 seconds while open; this is incremental delivery, not token-level SSE. Private reasoning and tool input/output are excluded. Reopening restores server history; older messages paginate twenty at a time. User messages are limited to 4,000 characters. Decision metadata bounds the captured reply to 8 KiB; the displayed answer is trimmed to 1,500 characters and its proposed reason to 400. Retained conversations have a 1,000-message limit per issue. Twelve recent messages and bounded attempt summaries form the handoff; earlier turns remain readable but may be absent from the prompt. @@ -57,24 +57,3 @@ Undo uses another stable request in those same canonical tables, with the authen Activity, header and detail share the factory resource; issue list queries and detail keys have separate entries. The request-scoped Nuxt app owns the cache, with no cross-request singleton data or local-storage persistence. One poll owner per key, shared requests, five-second default freshness, at most eighty idle entries and five-minute idle retention. Active subscribers are retained. Readiness middleware uses a five-second freshness window and a five-second request timeout, revalidating a known-active state in the background; explicit lifecycle invalidation forces a fresh check; server guards remain authoritative. Actions invalidate cached generations before and after the request so an older poll cannot overwrite a newer decision. Views revalidate promptly and retain last-known data on failure. Reset and rejected authorization clear cached data. No optimistic worker-start, merge, approval or eligibility claims. Issue filters and Activity's completed-section state survive client navigation. - -#49 still owns whole-page initial SSR, ETag/304 and heavy-section response work. This change does not change those backend contracts. - - -## Historical release verification (September 2026) - -- Linux: 1,283 Python tests passed (four skips). The broad macOS run is not a passing result because legacy tests require Linux process/cgroup behavior; focused portable tests passed locally. -- UI: 272 unit tests, Vue/server typechecks and production build passed on macOS and Linux. All twelve Chromium browser suites passed locally, including conversation send/apply/reload, plain-HTTP message identity, keyboard controls and no horizontal overflow at 320/390/1440 px. -- Authenticated read-only qualification passed for Codex and Claude using the current accounts and the discussion result schema. Both containers were verified removed afterward. This qualifies reconstructed context, not native session resume. -- The deployed API-to-scheduler-to-Claude-to-UI path completed a read-only question on an existing blocked issue. Its two messages persisted; no proposal was applied. Repeated message identity was deduplicated; a missing-token/cross-origin POST returned 403. - -Controlled navigation benchmark (local Chrome on the Mac development machine, identical fixtures and 750 ms injected latency on client API GETs): - -| Activity measured | Pre-release installed UI artifact | New UI | -| --- | ---: | ---: | -| Reopen a previously viewed issue, through the Issues list, to next paint | 1,525 ms | 17 ms | -| Factory GETs during this specific journey | 7 | 2 | -| Issue-detail GETs during this journey | 3 | 1 | -| Issue-list GETs during this journey | 5 | 2 | - -These are individual controlled runs, not production latency percentiles. Request totals include polling during the journey; the slower baseline also spends longer polling. The old artifact was tested separately without changing production. Reproduce with `FORGE_E2E_SPEC=resources.spec.mjs`; `FORGE_E2E_OUTPUT_DIR` selects a saved build and `FORGE_BENCH_BASELINE=1` records the comparison without imposing the new warm-render target. Browser executable selection follows the normal e2e runner. diff --git a/docs/onboarding-release-audit.md b/docs/onboarding-release-audit.md deleted file mode 100644 index b8779551..00000000 --- a/docs/onboarding-release-audit.md +++ /dev/null @@ -1,132 +0,0 @@ -# Onboarding release audit - -Audited 6 November 2026 from a new operator's perspective. This is a source and -local UI audit against `4a26cc0` plus this change, not a new live installation. -The north-star metric is time from starting installation to a verified first -merge. Operator actions and time spent waiting for a prompt are separate measures. - -## The journey - -| Operator question | Finding | Treatment | -| --- | --- | --- | -| What am I installing? | The README led with internals and offered competing CLI/manual entry points. | One quickstart, prerequisites, costs, browser handoff, and links for advanced operation. | -| What do I need to answer? | The CLI asks for owner, operators, repository names, per-repo policies, providers, login types, hostname, smoke target and fingerprint. Many are defaults a beginner cannot evaluate. | Group A below. | -| Why am I back in a terminal? | Codex can connect from installation progress, but routine account recovery still presents commands to run as the server's service account. | Group B below; do not describe this as completed web onboarding. | -| How many GitHub Apps do I need? | Fresh web setup still requested four roles despite the single-App backend. | Fresh setup requests one App. Existing partial legacy setup retains its continuation path. | -| Is anything happening? | The installation page has real stages, timestamps, blockers and actions, but repeats reassurance and describes API internals. | Shorter copy; retain elapsed time, last progress, observation freshness, errors and actions. | -| Can I enable my repository? | Successful access and policy checks each required another Continue click. | Choose repository → confirm settings and enable. Failed checks stay on the same screen with a retry. Installation completion still gates activation. | -| Where are settings? | Five categories compete for attention. Capacity and reset appear alongside normal operation. | General, Repositories, Connections. Fold capacity/reset; preserve deep links and unsaved edits. | -| What should I do first? | Installation tests itself, but the README buried the path to real issue work. | Explain `ready`, planning groups, approval and Activity. Validate this handover in Group C. | - -## Implementation follow-up - -The next integrated change implements the shorter default CLI interview, numbered -repository/provider choices and editable summary. Advanced choices retain workflow -permission and host identity consent. The browser handoff is announced only after -the server confirms that it accepted the setup plan; otherwise the CLI provides -its resume action. - -Codex browser connect, reconnect and verification now have a post-install web -path using the existing durable device-login lifecycle. Other provider/browser -adapters and API-key/token web entry remain separate work. The original findings -below describe the audit baseline; these two improvements address most of A/B. - -Remaining release work: - -- Move the remaining GitHub consent earlier; host/network preparation still comes - first. Do not claim all approvals happen before installation starts. -- Verify the integrated account-recovery changes on the deployed factory. -- Run Group C on a disposable supported Ubuntu x86-64 host. Record command-start - time separately because the historical saved timer begins after the interview. -- Keep additional provider modes explicit rather than presenting unsupported web - sign-in actions. New adapters and Mac-host support remain outside this release. - -## Delivery groups, in order - -### A — Finish the default installation path (release blocker) - -Track in [#271](https://github.com/XRPL-Commons/forge/issues/271). - -- Reduce the default interview to host, factory name, owner, repositories and - coding account. Show one editable summary before applying. Keep hostname, - extra operators, smoke target and other customization under an advanced choice. -- Offer repository/provider choices rather than requiring their internal spelling. - Keep the deterministic JSON intent surface for agents. -- Retain explicit workflow-write permission and host identity verification. - Fewer questions must not silently grant broader access. -- Complete the early browser-consent sequence. Current code still needs host - preparation before some approvals; “all consent before apply” is a target, - not an achieved property. Show the handoff point at which closing the terminal - is safe, and one resume action when it is not. -- Keep setup progress visible throughout; a paused step must name the action or - dependency it is waiting for. Preserve passkey/missing-manifest recovery and - expiring device-code recovery. -- Reconcile the older #271 requirements: no automatic ruleset creation/repair, - no paid-plan prerequisite. Observe owners' existing GitHub protections. - -**One PR:** interview, consent/handoff behavior, CLI help and canonical setup -instructions. Test old saved intents and interrupted sessions with that change. - -### B — Finish browser recovery and routine settings (release blocker) - -Track in #271, with the identity/account contracts from -[#259](https://github.com/XRPL-Commons/forge/issues/259). - -- Extend the existing account-operation API beyond installation so an operator - can reconnect or verify a coding account from Connections. Reuse its stored - operation, expiry and progress state; do not add a second login implementation. -- Make provider limitations explicit. Codex browser login, other browser providers - and API-key/token modes need separate capability checks. Do not offer buttons - that only reveal SSH commands after clicking. -- Use a single connection entry point, one current status, and one next action. - Keep scope/credential consent visible when approval is actually needed. -- Audit the linked setup/help reference pages for four-App language, obsolete - ruleset steps and terminal-only instructions. Keep historical migration detail - in reference documentation, outside the default journey. - -**One PR:** account API lifecycle, UI recovery and corresponding help. Validate -expiry, concurrent requests, interrupted login, revocation and reconnect together. - -### C — Prove the release journey (acceptance batch) - -Track in #271; record the batch in -[#216](https://github.com/XRPL-Commons/forge/issues/216). -Run after A and B rather than reinstalling after each small fix. - -1. A new operator follows only the README on a clean supported VM. No assistant - edits server files, copies secrets, patches state or runs undocumented commands. -2. Connect two repositories, including one with existing protections. Observe - those protections; do not add a Forge ruleset or alter subscription/visibility. -3. Exercise a passkey interruption, expired provider code, lost CLI connection, - reload of web progress and resume. Verify there are no duplicate Apps, logins, - scratch repositories or smoke issues. -4. Verify the smoke issue's build, independent review/audit, CI and actual merge. - Confirm selected repositories stay disabled until handover. -5. Run a real issue with human approval required. Show the approval hold in the - UI, confirm the approved revision merges, and follow the result from Activity. -6. Record total time, attended time, automatic time, browser/terminal actions, - retries and stage timings. Report cold installation separately from cached - installation. Existing repaired runs do not establish a clean benchmark. - -Retain the ≤12-touch / no-attended-wait target from #271, but measure it before -claiming it. There is no defensible minimum wall-clock estimate yet: artifact -transfer, provider latency and the actual build/review/audit path dominate it. - -## Keep out of the release's critical path - -- Mac hosting and Xcode execution: [#327](https://github.com/XRPL-Commons/forge/issues/327), deferred. -- New coding adapters: [#98](https://github.com/XRPL-Commons/forge/issues/98), - [#5](https://github.com/XRPL-Commons/forge/issues/5), deferred. -- Architecture tracks #269/#267/#258, publication #255, sandbox #265 and planning - #215 remain separate. Pull a concrete unresolved item into the release only - when it blocks the supported install, safe execution or a verified merge. - This UI audit is not evidence to close those issues. - -## Validation for this change - -Group UI checks around complete journeys: fresh and partial legacy GitHub setup; -repository selection, failed/stale access, installation hold and explicit enable; -settings save/discard and deep links; connection navigation; installation progress -and device-code handling. Run unit tests, typecheck, production build and these -browser journeys once against the integrated change, then repeat only failures -or checks affected by subsequent edits. Live clean-install acceptance is Group C. diff --git a/docs/provider-api-key-proxy.md b/docs/provider-api-key-proxy.md index e96bafb4..822382e7 100644 --- a/docs/provider-api-key-proxy.md +++ b/docs/provider-api-key-proxy.md @@ -4,10 +4,9 @@ The runner routes installation-owned Claude API-key accounts through a host broker. Pipeline jobs, discussions and setup probes share this path. Browser sign-in and Grok are unchanged. No browser account is converted to API billing. -The production wiring is implemented; native Linux qualification of the complete -boundary and Bash credential isolation remains pending. Do not close #265 until -that qualification passes for the deployed image. Browser credential isolation -and Grok support remain separate work. +Native Linux qualification of the complete boundary and Bash credential +isolation must pass for the deployed image (see below). Browser credential +isolation and Grok support are not covered. ## Proven behavior @@ -22,7 +21,7 @@ injection. The fake upstream received the host API-key fixture, not the worker's job bearer capability. API-key provider acceptance remains a separate deployment qualification; this test does not establish browser subscription compatibility. -Grok 1.0.34 (3736acbc8658) could not start its strict sandbox under the available +Grok 1.0.34 could not start its strict sandbox under the available ARM Docker host's x86 emulation. Its namespace lockdown returned ENOSYS. The test did not disable its sandbox. Qualify Grok on native x86 Linux before implementing its routes; no Grok support is claimed by this module. @@ -128,8 +127,7 @@ docker run --rm --network none \ --entrypoint python3 "$FORGE_TEST_RUNNER_IMAGE" /test.py ``` -Validated locally using image `forge-runner:e8c319a511e453c8` (image ID begins -`58004769ca52`). The script provides its own fake upstream and supplies no real +The script provides its own fake upstream and supplies no real credentials. Existing user homes and workspaces are not mounted. Official protocol reference: diff --git a/docs/role-qualification.md b/docs/role-qualification.md index fe26711c..4dddce50 100644 --- a/docs/role-qualification.md +++ b/docs/role-qualification.md @@ -3,13 +3,13 @@ After upgrading an idle test instance, inspect its installed image and coding account: ```sh -forge setup qualify-roles --ssh anvil --repo lucbocahut/dd-frigate --issue 10 --json +forge setup qualify-roles --ssh anvil --repo example/repo --issue 10 --json ``` Add `--apply` to run Build, Review, Audit, Recovery, Triage, Strategist, Discussion and Steward serially. Select particular roles with repeated `--role` options. For example, qualify just the new steward contract with: ```sh -forge setup qualify-roles --ssh anvil --repo lucbocahut/dd-frigate --issue 10 --role steward --apply --json +forge setup qualify-roles --ssh anvil --repo example/repo --issue 10 --role steward --apply --json ``` The factory and merge settings must be disabled, with no unfinished jobs or account login. The CLI reads configuration itself and runs as the service account using the qualified SQLite runtime. It takes the normal controller lock; it does not activate or pause the factory. diff --git a/docs/run-1-acceptance.md b/docs/run-1-acceptance.md deleted file mode 100644 index f7d098a1..00000000 --- a/docs/run-1-acceptance.md +++ /dev/null @@ -1,86 +0,0 @@ -# Run 1 acceptance - -## Release and checks - -- [PR #272](https://github.com/XRPL-Commons/forge/pull/272) merged as - `098e38fd69114a5e744896a6578b8f1820c4359b` on 14 October 2026. -- [CI run 38538369509](https://github.com/XRPL-Commons/forge/actions/runs/38538369509) - passed source audit, all three backend shards, the required aggregate backend - check, and UI unit/type/build/browser checks. The independent combined review - and review of its subsequent fixes found no remaining blockers. -- The supported resumable CLI upgrade applied schema 033 through 038. Its final - receipt reports `upgraded`, stage `complete`, schema 038, no pending migrations - and no blockers, at the exact merged release. -- Native host reconciliation completed at **2026-10-14 09:10:47 UTC**. The status, - supervisor and UI services are active. Codex 0.153.4 default-model qualification - passed; optional Claude qualification is still required and Grok is unconnected. - -## Deployed artifacts - -| Component | Identity | -| --- | --- | -| Standard runner | `sha256:3864cf13ce98ceb6f84d73b2f8add3657210dc9af9227e980b3edae76604cb40` | -| Full runner | `sha256:937c209893c72379d288940be956bd7910e9b4393f5a8a778525da70081c8ffc` | -| UI | `670313454fa3f1c2` | -| Schema | 038 | - -These identities were read from the active SQLite configuration, not the old -diagnostic JSON files. Successful CLI reconciliation includes the native runner -build-environment canaries before switching the configured images. - -A separate offline canary on the deployed standard image also passed: the -native Codex tool sandbox could not read, overwrite or rename either private -exit receipt, and the parent confirmed both synthetic receipts were unchanged. -The canary had no network or real credentials and its container was removed. - -## Live observation - -Observation starts at the completed host reconciliation above. The first -read-only SQLite ownership sweep at **2026-10-14 09:22:14 UTC** found 13 current -work members, all with a live/captured job, current next action, pending effect -or applicable gate; zero scheduling orphans. The factory is enabled, observation -reported no errors, and a build resumed for the approved Academy group. - -**The 24-hour acceptance window is not complete.** An initial healthy sweep is -not evidence that every incident scenario has succeeded in production. Continue -checking ownership, bounded retries, cleanup and user-visible exits. Any release -change or discovered failure must be recorded with its effect on acceptance. - -## Subsequent releases - -The initial release did not remain unchanged for 24 hours. Production later -advanced through the runtime cleanup and Run 2. The supported upgrade completed -on `d6113d390a22d1223f0854f25cb5f1813d41235d`, schema 040, at -**2026-10-14 12:09:29 UTC**. The release receipt matches the source, all four -managed services are active, and the updater exited. This is the new completion -baseline for that release; the original Run 1 window cannot be claimed complete. -Production subsequently advanced to `01964ae7652a2faa2db90d81c2d50b772b2001c9`. -Its release receipt is dated **2026-10-14 12:27:54 UTC**, source and receipt -match, schema remains 040, and all four services are active. Use this later -receipt as the current observation baseline; the schema-upgrade journal still -records the earlier completion. - -Before that upgrade, source had advanced while the database remained at schema -038. The mismatch was observed explicitly, admission was drained through the -supported upgrade path, and the subsequent deployment completed reconciliation. -The last ownership sweep before completion found 13 owned members and no -orphans. That sweep does not replace observation of the new release. - -## Failure encountered during deployment - -The first apply failed before writing a new upgrade journal. Source and schema -remained unchanged. A real schema-033 regression reproduced the same failure -when another writer held SQLite's write lock; releasing the lock allowed the -same resumable operation to complete. The second live apply succeeded. - -Run 2 includes a focused diagnostic fix that reports SQLite's safe error code -and retryable busy classification. It changes neither admission, lock timeout -nor retry policy. The original live error did not retain its SQLite code, so -lock contention is the supported explanation, not a directly captured code. - -## Remaining scope - -Generic host-runner and unreadable-store faults remain open under #262. Worker -GitHub credentials are removed with Run 2's host publisher and read-only mirror; -Run 1 does not claim that boundary. Broad parent issues stay open until their -complete acceptance criteria pass. diff --git a/docs/run-2-acceptance.md b/docs/run-2-acceptance.md deleted file mode 100644 index 1e291f26..00000000 --- a/docs/run-2-acceptance.md +++ /dev/null @@ -1,181 +0,0 @@ -# Run 2 acceptance - -Run 2 groups the worker boundary in #255, #259 and #265 with the first CLI -setup improvements in #271. This record distinguishes implementation checks -from live qualification. None of the broad parent issues is closed by this run. - -## Implemented boundary - -- The host freezes source commits, notes, declared Git dependencies, policy and - publication authority before launch. Resumed and recovery jobs retain their - exact previous inputs. Reusable policy identity is separate from each job's - immutable source snapshot. -- Every worker uses a read-only Git mirror with per-job receipts. Declared - dependencies and installed organization repositories are allowed subject to - actual App access; a project deny list overrides both. Refused fetches produce - claims. Request, byte and receipt limits bound the host resources used by a job. -- Worker GitHub tokens and direct GitHub publication have been removed. The host - verifies retained bundles, creates the exact output tree through the selected - qualified App strategy, reconciles uncertain effects and checks the final PR. - Review and Audit receive facts bound to that exact confirmed candidate. -- Each job has its own internal network and bounded work volume. Trusted Git - and provider/registry endpoints are separate containers. Native Linux checks - qualify isolation, live revocation, read-only Git, quotas and stopped capture. -- A terminal host launch refusal is recorded before verified cleanup and becomes - an uncharged owned wait. Mirror access refusal requires a decision; ordinary - issue prerequisite checks cannot clear it. Transient preparation failures have - a durable retry time and still honor cancellation and the execution deadline. - -## Validation record - -Independent review found and prompted fixes for policy/source collisions, -missing resumed-source pins, unbounded denied-fetch receipts, missing host facts -in Review/Audit notes and incorrect automatic clearing of host access refusals. -Focused regressions cover those findings and exact publication/replay guards. - -Real npm and pip VCS installs passed through the local read-only Git endpoint -with external GitHub HTTP refused and no GitHub credential. The pip subprocess -used Python 3.12 because the local Python 3.14 installation's pyexpat module could -not load; this is an environment limitation, not a skipped compatibility check. - -Combined UI unit tests (585), typecheck, production build and browser suite -passed. The initial backend batch exposed old contract fixtures and the source -file-mode/canary-receipt bugs described above. All 142 tests in the combined -fixes batch passed. After integrating main's cleanup changes, all three backend -shards, UI unit/type/build/browser checks and source audit passed in -[CI on `0ee4941`](https://github.com/XRPL-Commons/forge/actions/runs/38549115143). - -## Live qualification - -- The approved scratch signing experiment completed on 2026-10-14. Controller - App `4959034` created REST commit `a914efb78a0e5e12f66dbbfe6261cd3a86a7359f` - without custom author/committer fields; GitHub reported a valid verified - signature and the exact ref update succeeded. Rule suite `4518978971` passed - organization signing rule `20606309`. Unsigned control commit - `ad57f6617be3fc2df67428721d471ec72fcb743f` was refused with the ref unchanged; - suite `4518979811` explicitly failed the same required-signatures rule. The - active rule had no bypass actors. REST therefore works for this installation; - the conditional GraphQL fallback was not needed. -- The workflow-file attempt was refused with HTTP 403 and an unchanged ref. - The installation lacks Workflows write, so positive workflow support remains - unproven. The temporary token was revoked. Scratch repository `1418653585` - was deleted and an independent authenticated read returned 404. -- This experiment does not synthesize a production qualification record. The - supported qualification CLI must still record its own operation bound to the - target repository, branch and current rules before enabling host publication. -- The Controller's current installation lacks Workflows write permission. Test - that limitation and report it; do not expand permission as part of the probe. -- Anvil's native boundary canary passed on Ubuntu 24.04 and Docker 29.1.3, - revision `02cd206`, image - `sha256:a5d60fa4463e13574ceadbbfc3ccfe3d03ec3ca3fc9a29b48b5f6c3be3b5c8c6`. - Real Git clone/fetch, denied push, provider TLS, npm/pip downloads, GitHub/host/ - cross-job denial, external DNS denial, immutable inputs, disk quota, session - revocation and stopped capture passed. Disposable cleanup was confirmed. -- Anvil's supported upgrade completed successfully at `936859b`, schema 040. - All four services are active; automation and merging remain disabled. Verified - cleanup removed the formerly stuck probes. Fixed termination/reuse probes now - send an empty credentials envelope because their fixed programs make no - provider calls; provider probes retain normal authentication. Forty-one - focused tests, independent review and - [full CI](https://github.com/XRPL-Commons/forge/actions/runs/38557722035) passed. -- The seven-role canary stopped before worker launch because fresh setup had no - configured repository policy row. Live read-only checks confirmed all four - Anvil Apps and successful access to the selected private repository. The - correction gives only the disposable canary an explicit policy for that - selection; configured deny rules and actual App access remain authoritative. - Its fresh-store regression and all seven source/broker paths passed focused - tests and independent review. The correction merged in #282, passed full CI, - and Anvil upgraded successfully to `fd0fb78` at schema 040. The next live canary - reached capture and failed with `result_schema_invalid`; this does not prove - malformed model output because schema validation preceded execution checks. - Diagnostic ordering and CLI failure-report retention are corrected in #286; - no role is marked qualified by that failed attempt. -- The diagnostic build on Anvil (`a5676c0`) reported build exit 125 with cleanup - confirmed and automation still disabled. A credential-free reproduction of - clone/fetch/checkout and native sandbox checks passed on a small fixture. - A scoped, read-only measurement of the selected repository then proved the - mirror rejected its 239,187,791-byte Git pack at the 64 MiB buffered-response - ceiling. Cache data was deleted and all temporary tokens were revoked. - Bounded spooling and chunked response transfer passed a generated 65 MiB - native clone with Python peak memory below 16 MiB, 39 focused regressions, - independent review and full CI on `3d12b9a`. The role canary uses the - production worker's bounded work volume. -- Anvil installed `3d12b9a` and image - `sha256:c61ea6ca74d522223b8b7e1be03e388eb05ebd254372b03035b14bbba69e537a`. - All nine native boundary checks passed with confirmed cleanup. The automatic - account check exposed a separate setup-probe path mismatch: it still read - `/work/assignment.json` after inputs moved to `/run/forge-input`. The retained - capture proves failure before provider execution. The upgrade journal - completed through supported CLI resumption; account qualification remained - failed, and the role canary correctly refused `coding_account_not_ready`. -- The setup-probe path correction passed 12 focused regressions and independent - review. Anvil upgraded to `a8e8a98`; Codex verification passed and the rebuilt - image `sha256:801298624fe20068d4a980a17559cb472862f34228b4505cdb258830644a6ce4` - passed all nine native checks. Full CI passed on that source. -- The subsequent real-repository Build canary timed out during clone before - provider execution (exit 124, cleanup confirmed, automation unchanged). - A credential-free profile measured 512 physical SQLite opens across 128 live - authority checks: 6.65 seconds total, including 4.78 seconds opening handles. - Existing request-scoped connection leases reduced those same fresh checks to - 0.93 seconds. A native 16 MiB Git clone measured 16.44 seconds before leases - and 3.04 seconds with them, with exact HEAD and confirmed cleanup in both runs. - The mirror now retains physical handles within each request while preserving - fresh transactions and authority checks for every chunk. No permission - decision is cached and the role deadline remains unchanged. -- The native boundary canary also passed on `e430a9c` and its rebuilt image - `sha256:f75e743bd807d728e9e810d7fca798cd0da5728dadebe737806dce42f4adc172`. - All nine checks passed and disposable cleanup was confirmed. -- Complete the signed-publication and every-role canaries before claiming the - boundary accepted or deploying it to the active Forge factory. The boundary - canary uses direct fixture workers, so it does not establish production role - harness compatibility. The supported `setup qualify-roles` and `setup qualify-publication` commands - now provide those checks. Role candidates are explicitly disposable fixtures; - signing qualification requires a host-recorded API operation and exact - independent read-back. No fixture result certifies a real PR or merge. - -Production completed the merged Run 2 upgrade plus the launcher correction at -`d6113d3`, schema 040, at 2026-10-14 12:09:29 UTC. A later deployment advanced -production to `01964ae`; its release receipt is dated 12:27:54 UTC and all four -services are active. That later receipt starts the current observation window. -Live role and target-bound publication qualification are still incomplete; a -successful deployment does not establish them. The new production observation -baseline is recorded in [Run 1 acceptance](run-1-acceptance.md). - -## Explicit limits - -Existing draft PRs require readiness before host publication; the refusal is -`publication_draft_requires_ready`. The publisher does not assume the Controller -may promote another App's draft. Unsupported Git tree modes under a GraphQL -strategy remain explicit claims. The new steward, one-App identity migration, -provider credential isolation and final fresh-install smoke merge belong to -later runs in [the implementation plan](run-plan.md). - -## Concurrent main changes - -Cleanup PRs #274, #276 and #277 merged while this branch was being validated. -Their changes are retained: removed legacy import tooling stays removed, `uv` -installs the CLI, and API mutations require a signed-in operator. The supported -`forge migrate upgrade` path remains. Run 2's mirror service, narrow rule repair -and qualification commands are integrated with that updated base. Combined CI -passed, including the subsequent source-transfer correction on `02cd206` -([run](https://github.com/XRPL-Commons/forge/actions/runs/38550713982)). The new -qualification commands passed independent review and 63 combined focused tests. -CI caught personal paths in documentation/test examples; generic paths now pass -the source audit and all 17 affected tests. The cleanup repair passed full CI on `62e4999` -([run](https://github.com/XRPL-Commons/forge/actions/runs/38553600750)), before the -standalone packaging failure was found on Anvil. - -Main's SQLite-only runtime deletion (#279) is now incorporated. Tokenless -Discussion startup and setup-specific ProbeRunner cleanup use the surviving -modules. Follow-up #280 joins this gate: fresh stores can pair agents using their -existing UUID identity; discussion leases and memory retries do not block -unrelated accounts or paused repositories; a deployment candidate failure leaves -other candidates and discussions progressing and clears on a successful retry. -Codex login admission now checks the stored account locally before dispatch, -with an account-scoped auth block that preserves independent provider limits. -Deployment regressions passed 69 tests, fresh pairing passed 28 tests, login -admission passed 43 tests, and the standalone migration bundle passed 53 tests -before this integration. Independent review covered the merge and these changes. -The full combined CI gate passed on `e430a9c` -([run](https://github.com/XRPL-Commons/forge/actions/runs/38555781186)). The final -probe correction passed its full CI gate and completed Anvil's upgrade. diff --git a/docs/run-4-acceptance.md b/docs/run-4-acceptance.md deleted file mode 100644 index c8a056ef..00000000 --- a/docs/run-4-acceptance.md +++ /dev/null @@ -1,70 +0,0 @@ -# Run 4 acceptance - -This run combines the remaining Steward and delivery changes in #266/#267 -with the single-App and operator identity work in #259. The operator confirmed -that the default repository setting requires independent Forge Review and -Audit for human-authored PRs as well as Forge-created PRs. - -## Delivered behavior - -- Triage and conversations share stored Steward decisions. Build result v2 - carries typed claims tied to the actual assignment and member revisions. -- Schema 4 consolidates delivery phases and operator writes while retaining - history, uncertain sends, bounded retries and independent holds. The four - gate classes retain historical reason codes. -- A human PR has a review-only unit with immutable source information and - independent Review/Audit jobs. It has no invented issue, Builder, branch - publication or automatic merge. Changes to its source invalidate old evidence. -- Fork input comes from the base repository's authorized PR ref through the - read-only mirror. Workers receive no GitHub credentials. -- Repository scope defaults to all PRs and can be changed in the repository UI. - Changes use revision checks and invalidate outdated protection evidence. -- The supported identity CLI preserves retired App identities, pending work, - operators and agent grants. Trusted Tailscale identity and same-App GitHub - sign-in are supported. Sign-out revokes connected agents. - -## Combined validation - -The local bulk backend run exercised 2,248 tests and found three stale fixtures: -a missing supervisor component, an incomplete mocked settings document, and -protection evidence missing the new scope. All 47 tests in the corrected modules -passed. The combined revision passed all backend shards, UI and source audit in -[CI](https://github.com/XRPL-Commons/forge/actions/runs/38713523760), then merged -as `e12960c` in [PR #297](https://github.com/XRPL-Commons/forge/pull/297). - -All 591 UI unit tests, typecheck, production build and browser tests passed. -Focused tests cover schema upgrade, history retention, uncertain writes, -current-scope admission, fork source, independent results, sign-out and restart. - -Independent review found two shared-commit problems: retiring a peer could -leave another PR's check pending, and a Forge merge could publish success -before a human peer passed its reviews. Both corrections passed independent -review and all 16 authority regressions, including the composed Forge/human -case. GitHub checks belong to a commit, so every success publisher validates -the current peers sharing that commit. - -## Deployment and live acceptance - -Both existing installations completed the supported CLI upgrade from -`c0f2a01`, schema 3, to `e12960c`, schema 4. The CLI reported `upgraded`, stage -`complete`, and no pending migrations. Anvil's automation remains disabled. - -Anvil's real-provider canary qualified Build, Review, Audit and Recovery on -image `sha256:da56f94867613b5a7b7eb20a59834c5e74790439707dbcae5e9398ef5e00e594`. -Triage then failed before provider execution because its new shared assignment -omitted the publisher required by the worker harness. Conversation assignments -had the same omission. Real assignment fixtures reproduce both failures through -the harness entry point. The shared assignment builder is corrected; the -remaining live roles must pass after deployment. Disposable cleanup was -confirmed and automation stayed disabled throughout the failed canary. - -Identity migration is a separate supported CLI operation. New App permissions, -callback configuration, installation changes and repository rules require their -actual configuration and verification before declaring the single-App rollout -complete. Existing stronger repository rules are preserved. - -The following remain live acceptance work: production role canaries, resumable -App/identity migration, actual human PR Review/Audit, and the fresh-install -issue-to-merge measurement. Run 5 also retains installation/consent cleanup and -provider credential isolation. Broad parent issues remain open until their -complete acceptance is demonstrated. diff --git a/docs/run-plan.md b/docs/run-plan.md deleted file mode 100644 index 3be082ec..00000000 --- a/docs/run-plan.md +++ /dev/null @@ -1,220 +0,0 @@ -# Five-run implementation plan - -Source: [the 14 October 2026 run plan in #269](https://github.com/XRPL-Commons/forge/issues/269#issuecomment-6162894077). -This supersedes the earlier delivery order. The architecture and evidence -requirements in [target-architecture.md](target-architecture.md) still apply. - -Planning baseline: `main` at `ccba2ce`, schema 035, no open PRs when checked on -14 October. PRs #253 and #270 are merged. The last production preflight on -13 October reported schema 033 and workers awaiting cleanup; this is historical -evidence, not a fresh deployment check. No implementation or deployment is -performed by this plan. - -## Working agreement - -Each run has one integration branch, one combined PR, one full CI gate, one -independent review, one merge, one deployment and one live acceptance record. -Lanes use separate worktrees and run focused tests while developing. There are -no lane PRs or repeated full suites after individual issues. A failed combined -gate is fixed and rerun; “one CI” is not permission to merge a failed revision. - -Freeze shared interfaces before parallel edits. Assign a single owner to every -shared file, including tests and UI types. Other lanes supply changes through that -owner. Reserved migration numbers do not by themselves prevent conflicting -schema changes. Migrations must apply in sequence from the deployed schema. - -With four agent slots, Run 1 uses one integrator and three implementation agents. -Run 2's fourth lane uses a second wave as a slot becomes available. Independent -review begins after integration, with an agent that did not author the reviewed -code. Implementation of the next run may proceed during observation, but the -release remains under acceptance until its live checks pass. - -## Run 1 — reliability (M0) - -Ship #270 with this run. It already supplies #260, a trusted startup-fault slice -of #262 and the unsuccessful-build candidate guard from #255. - -| Lane | Scope | Primary ownership | Migration | -| --- | --- | --- | --- | -| A | #261 persisted declines, stall detection, build stale-base repair; #264 backoff and bounded uncertainty | Dispatch, merge and effect controllers; effects store; supervisor scheduling; status projection | 036 | -| B | Remaining #262 exit envelope, provider errors, timeout/OOM policy, deduplicated Report to Forge draft | Harness and adapters, runner, job lifecycle, execution classification | 037 | -| C | #263 explicit and automatic re-test of worker claims | Runtime requirements, requirements controller, operator Recheck, wait controller | 038 | - -### Shared contracts before lanes start - -- **Scheduling:** one durable next-action representation, with exact work scope, - reason, due time and responsible component. Admission or a changed assignment - invalidates obsolete schedules. A future schedule counts as owned work; it is - not a stall merely because it is not due yet. -- **Execution:** a versioned envelope bound to the actual job and trusted runtime - observations. Preserve #270's pre-agent proof boundary. Missing or malformed - output must not let a worker forge a trusted timeout, OOM or provider error. - Keep missing-envelope failures distinguishable from a valid `cannot_complete` - result; persist the evidence needed for deterministic classification. -- **Claims:** typed claim identity plus relevant release, repository/rules, - environment and login revisions. Store safe identities/digests, never credentials. - Worker-claimed `github_permission` currently lives inside an environment gate; - preserve that distinction when releasing only the selected obligations. -- **Charging:** one durable disposition per physical attempt. Forge faults and - provider cooldowns are uncharged; timeout and unchanged repeated claims charge - once across replay; OOM follows bounded deterministic escalation. Exhausted - resources produce an owned wait, not an infinite retry. -- **Recovery:** Run 1 records the need for recovery and uses the existing path. - The new steward is Run 3; no Run 1 acceptance claim implies it already exists. -- **Defaults:** pin stall duration, uncertainty duration, backoff and attempt caps - in configuration and clock-driven tests before implementation. These are routine - implementation choices, not additional operator approvals. - -The integrator owns edits to `result_controller.py` (A supplies pending-return -changes; B supplies charging changes), shared lifecycle/schema registration, -runtime wiring and shared tests. Lane A owns the status/UI contract; B and C -supply their display and action requirements. Lane C integrates B's new wait and -retry cases into `wait_controller.py`. B implements fault-report drafts and -deduplication; publication remains an explicit operator action. - -### Required behavior - -- Every dispatch/result/merge decline leaves a durable schedule or an owned gate. - Cleanup, captured results, pending effects, maintenance and bounded scheduler - continuation count as ownership. Preserve fairness and independent child work. -- “Queued” means a real schedule, with reason and next try time. An unowned unit - becomes visibly stalled after the configured bound, without an issue charge. -- Recheck and relevant changes release only worker-claim obligations. Independent - pauses, labels, dependencies, human verification and runtime-selection gates - retain their own authority. Retry bounds survive restarts. -- Backoff applies at both effect selection and claim/send admission. A fresh read - after the last uncertain send can establish an exact merge, a closed-unmerged - PR or a changed head even after multiple sends. Preserve the existing single-send - guard for HTTP-refusal evidence; it is a different proof. -- Sustained observed conflict returns work for rebuilding. Unknown mergeability - stays uncertain and eventually escalates; elapsed time never proves conflict - or success. Future publisher effects reuse this contract in Run 2. -- Fault reports are scrubbed drafts, deduplicated by safe signature. Deploy retries - use relevant qualified release/image evidence, with no repeated retry for the - same identity. Preserve the scoped qualified-image exit already in #270. -- Source inspection found that ordinary build publication is currently performed - by the agent, not by an image-owned publisher. Move #265's Codex shell credential - removal into Run 2 with the publisher; removing it independently would break - successful builds. Canaries must test the boundary when that replacement ships. - -### Combined acceptance - -One regression batch covers this week's stale-base, signing-wait, harness-crash -and stranded-request incidents, plus restart/replay, independent holds, grouped -work, multiple uncertain sends, provider cooldowns, timeout charging and OOM -escalation. Test migrations 034–038 from the deployed schema, canonical status -parity and the visible operator actions. Then run full CI and independent review -on the combined diff; fix any findings before merge. - -Deploy through the supported CLI. Because this run changes schema, use -`forge migrate upgrade` from the exact release, with a read-only plan first and -then the resumable apply command. It drains workers, migrates and invokes the -normal updater. A bare `bin/forge update` is not a substitute for that migration. -The integrator owns completion of drain, service restoration and image qualification. - -Record release/schema/image identities and the start of live observation. For -24 hours, every nonterminal unit must have **a live job, a durable next action, -or an owned gate**, within the defined stall-detection bound. Include cleanup and -effect ownership in the audit. A discovered orphan must become visible and have -an exit; an empty board alone does not prove the incident scenarios. Record gaps -or failures honestly and repeat the affected acceptance after correction. - -## Run 2 — worker/Forge boundary - -| Lane | Scope | -| --- | --- | -| A | #255 supervisor publisher: verified bundles, App commit, read-back, PR/marker, Observed by Forge facts | -| B | #259 mirror and immutable notes for every role; remove worker GitHub credentials, `gh` and GitHub egress | -| C | #265 bounded work volume, worker network isolation and read-only registry proxy | -| D | #271 B1–B3: CLI version/help/re-login, bypass-only repair, interview/preflight and resumable apply | - -Both Run 2 decisions were supplied by the operator on 14 October: - -- Forge serves a read-only Git mirror. Sandbox fetches, clones, submodules and - package-manager Git dependencies use it without receiving credentials. Fetch - uncached repositories on demand when policy allows them: declared project - dependencies and repositories in organizations where the Forge App is - installed are allowed by default. A per-project deny list overrides those - defaults for sensitive repositories. Refuse other repositories and expose the - refusal as a typed claim for the steward. Record every fetch against its job. - The host fetch still requires actual GitHub access; policy is not a grant of - credentials or permission. Pin dependency declarations to the assignment so a - worker cannot expand access by rewriting its manifest during execution. -- The signing test is approved in a throwaway XRPL-Commons repository, temporarily - added to the Controller installation. Create a Git Data API commit without a - custom author/committer, read back verification and prove the organization - signing rule accepts the ref update. Test workflow changes with and without - the relevant granted permission; do not silently expand App permissions. - Delete the scratch repository afterward. If REST commits are unsigned, use - `createCommitOnBranch` and refuse unsupported file-mode changes explicitly. - -Run this proof at the start of Run 2, before choosing the publisher implementation. -Publisher receipts and mirror/note contracts are shared interfaces between lanes -A and B. Signing proof and exact-tree support are separate acceptance checks. - -Acceptance: thegame publishes under its signing ruleset, every role passes on a -canary repository, and an egress test proves workers have no GitHub route. Any -approved private-dependency exception is explicitly excluded from that proof. - -## Run 3 — steward v1 - -Three lanes: core dossier/decision v1, guards, autonomy and durable repository -notes (#258/#217); recovery, stall and brief execution modes (#258/#266); and one -shared UI choices component. Freeze typed decisions before executor and UI work. - -Acceptance: the captured stuck cases resolve automatically or through one -operator choice, while budgets, exact revision guards and independent holds -remain enforced. Forge faults remain deterministic core handling. - -## Run 4 — consolidation and identity - -Three lanes: #267 triage/conversation steward modes, four gate classes, fewer -states, one outbox and result v2; remaining #266 typed dependencies, environments -and ownership; #259 one-App verdict checks/bypass and trusted Tailscale identity. -One schema owner integrates state and contract changes. UI/proxy files also need -explicit ownership across the first and third lanes. - -Repository setting: `forge/merge-policy` defaults to **all PRs**; the operator -may select Forge-created PRs only. Human-authored PRs receive independent Forge -Review and Audit on their exact current candidate; passing those checks does not -authorize Forge to merge or change their branches. Preserve stronger repository -policies. Acceptance includes resumable identity/App migration, independent -logical Review/Audit, spoofed identity-header rejection and agent revocation. - -## Run 5 — install and cleanup - -Three lanes: #271 B4 single-App consent, smoke merge and handover; #268 legacy JSON -runtime removal while retaining the importer; #259 provider credential isolation -using proven access-only support or a host-side model proxy. - -Resolve old wording in #271 against the one-App target: no new role-App wizard, -no signing bypass as a substitute for signed publication, no worker-token -revocation acceptance after tokens are removed. Its touch-count figures also -disagree; use its explicit done-when threshold of at most 12 as the proposed -acceptance target, and measure rather than claim it in advance. - -Acceptance: the supported CLI installs a fresh instance, a real smoke issue -reaches a GitHub-confirmed merge, interruption/resume converges, and the report -measures time to first merge. Include Anvil's supported upgrade and a human-approval -hold. Confirm all known installs use SQLite before removing runtime selection of -JSON. Provider capability proofs precede credential migration. - -## Evidence and issue tracking - -Run 1 merged as [PR #272](https://github.com/XRPL-Commons/forge/pull/272) -and deployed on 14 October. See [the acceptance record](run-1-acceptance.md). -Its 24-hour observation remains open while Run 2 is developed. - -New cleanup issues #273 and #275 belong after the core replacements in this -plan. Check callers before removing each proposed item. In particular, keep -the current repository-rule repair until #271 supplies its replacement, and -keep the observer deferred under the operator's earlier #111 decision. The -proposal in #273 does not itself reverse that decision. Group compatible docs, -dead-code and UI removals with Run 5; do not mix them into the security boundary -change or reset Run 1's observation with an unrelated deployment. - -Keep broad parent issues open until their complete acceptance is met. Each run's -acceptance note records the tested revision, CI/review, deployment identity, -live outcomes and remaining scope. Prepare the note with the run; publish it to -#269 when carrying out the approved reporting step. #111/#98/#5 remain deferred -until the core is qualified. diff --git a/docs/store-foundation.md b/docs/store-foundation.md index 6df12769..e3494c13 100644 --- a/docs/store-foundation.md +++ b/docs/store-foundation.md @@ -1,10 +1,7 @@ # SQLite store foundation -This implements phase 1 of [#209](https://github.com/XRPL-Commons/forge/issues/209), -consolidating [#212](https://github.com/XRPL-Commons/forge/pull/212) and -[#213](https://github.com/XRPL-Commons/forge/pull/213) into one `forge.store` API. -The running supervisor, API, UI and CLI still use their existing stores. Importing -`forge.store` creates no files and selects no backend. +`forge.store` is Forge's SQLite store API. Importing `forge.store` creates no +files and selects no backend. ## Store and commands @@ -42,8 +39,7 @@ the database or authorize a transition by supplying its own report. ## Worker execution adapter `forge.factory.execution_controller.ExecutionController` is an explicit SQLite -caller. It is not yet selected by the production supervisor. It uses the existing -container runner and role-scoped GitHub token issuer, without a JSON ledger shim. +caller. It uses the existing container runner and role-scoped GitHub token issuer, without a JSON ledger shim. - `Lifecycle.reserve_job(..., launch=Launch(...))` saves immutable launch inputs and the capacity lease in one transaction. The adapter currently accepts units @@ -77,10 +73,9 @@ They do not establish a real GitHub first merge or full public-view parity. ### Explicit SQLite supervisor -`forge.factory.sqlite_supervisor.SqliteSupervisor` now composes bounded cleanup, +`forge.factory.sqlite_supervisor.SqliteSupervisor` composes bounded cleanup, ordered GitHub observations, result validation, merge authorization, durable -GitHub effects and dispatch. It is an explicit adapter, not a production backend -selector. Import-only stores reject controller execution. +GitHub effects and dispatch. Import-only stores reject controller execution. - Observation generations are reserved before remote reads. Issue facts, configured hold labels, ownership and repository readiness commit together. New holds fence @@ -106,18 +101,8 @@ selector. Import-only stores reject controller execution. Local integration tests compose the real row controllers with simulated GitHub and worker engines through build, review, audit, human approval and confirmed merge, -including supervisor restarts and failure investigation before retry. The combined -local checkpoint passed 328 store regressions and 14 migration/runtime CLI tests -on SQLite 3.53.1. This is not real -GitHub or production acceptance; Linux and full application qualification remain -at the integrated batch boundary. - -Still required before selecting this runtime: automatic memory/service escalation -and durable environment selection; revision-bound dependency fulfillment and -operator/API routing for verification and other actions; supporting-domain writers -(discussions, deployment, configuration, identity and client operations); API/UI/CLI -read adapters; managed-launcher guards, activation, fresh parity and live qualification. -No legacy reconciliation gate is cleared merely because these adapters exist. +including supervisor restarts and failure investigation before retry. They are +not real GitHub or production acceptance. ### Recovery and verification adapters @@ -136,7 +121,6 @@ independently verifies the original assignment, branch, base, requirements and policy. Findings alone cannot publish, select a candidate or reset a budget. An investigation may request exact-candidate human or configured CI verification; that request cannot pass Review/Audit or refund a failure by itself. -Imported historical failures remain under explicit legacy reconciliation. `VerificationController` completes configured CI verification only for the exact candidate and operator-selected check names/App identities. An explicit human @@ -167,23 +151,7 @@ current candidate evidence, and explicit durable pins. Callers must use `Artifacts.pin_in()` in the transaction that records a durable raw-log reference. Structured results, summaries, launch manifests and all events remain retained. An expired chunk keeps its metadata and returns `ArtifactExpired`; retries do not -recreate its bytes. The explicit SQLite supervisor schedules bounded retention; -production still uses the existing runtime until qualified cutover. - -## Consolidation checklist - -| Capability from the two PRs | Combined implementation | -| --- | --- | -| Private identity, migrations, WAL qualification, snapshots and backup | `db.py` and one versioned SQL schema; FULL durability retained | -| Closed codes, wording, scope/release rules and legal state edges | `codes.py`, `status.py`, matching SQL registries and constraint tests | -| Exact candidate evidence, shared failure budget, stale work and cleanup fencing | Typed lifecycle commands; a lease lasts until verified cleanup | -| Ordered issue observations, retry, merge/closure and dissolution | Typed commands with version, evidence and replay checks | -| Applied and rejected decisions | Atomic command journaling, immutable events and full request identity checks | -| Compression and log expiry | Bounded, digest-checked artifact API with durable pins and 30-day raw-log policy | -| Concurrency and crash behavior | Concurrent command tests, transaction rollback tests and killed writer tests | - -The consolidation retains one module/schema layout. It does not introduce a -second backend or a generic state setter that bypasses candidate evidence. +recreate its bytes. The SQLite supervisor schedules bounded retention. ## Local development @@ -218,26 +186,3 @@ failure accounting, cleanup, retention, transaction crashes, disk-full rollback and consistent backups. No test copies live state. Schema upgrades are described in [the upgrade guide](store-migration.md). - -## Remaining #209 work - -[#209](https://github.com/XRPL-Commons/forge/issues/209) remains the release plan. -Label removal and repaired repository readiness resume eligible work; completed -external closure shows done; batches may include existing PRs with approval. -The store supports these rules, but existing runtime adapters must still adopt it. - -1. **Import and parity:** the captured production stores now have resumable entity - mappings and independent fact checks. Public-view parity and fresh reconciliation - of unfinished work remain; see the migration guide for the dry-run evidence. -2. **Supervisor and API/UI/CLI cutover:** replace every relevant reader and writer, - reconcile external effects, schedule retention, and measure latency on the host. -3. **Units and batches:** migrate existing work without losing candidate evidence - or budget history; add approved composition, dependency-aware execution, - integration, member dropping and a normal merged batch PR. Schema support and - guarded dissolution do not constitute end-to-end batch execution. -4. **Retire JSON:** remove runtime JSON writes and complete CLI update, backup and - forward-recovery documentation and rehearsals. - -Legacy migration is one-way. A pre-migration source copy is kept for diagnosis; -there is no JSON switch-back. This PR performs no live migration or service restart. -#209 stays open until all release criteria pass. diff --git a/docs/target-architecture.md b/docs/target-architecture.md deleted file mode 100644 index c78a123b..00000000 --- a/docs/target-architecture.md +++ /dev/null @@ -1,274 +0,0 @@ -# Current architecture target and delivery order - -Decision: 13 October 2026, [#269](https://github.com/XRPL-Commons/forge/issues/269), -with the publication and identity target in -[#259](https://github.com/XRPL-Commons/forge/issues/259). -This document distinguishes the agreed target from the implementation on `main` -at `e38e367`. It supplements dated decisions; it does not rewrite their evidence. - -**Execution order updated 14 October:** the [five-run plan](run-plan.md), based on -the superseding comment in #269, now controls batching and delivery order. The -phases below remain the architectural breakdown, not the current run schedule. -In particular, provider credential isolation is scheduled in Run 5. Source -inspection during Run 1 moved the Codex shell credential fix into Run 2 with the -publisher: current builds still require agent-side publication. - -## Agreed target - -Forge has a deterministic core and one mover agent, the steward. The core owns -state, gates, budgets, fencing, observation and external effects. The steward -receives a dossier and proposes a move from a typed menu; the core validates and -applies it. Coding harnesses execute assignments without authority over flow. -Every effect follows intent, apply and read-back. Every wait has an owner and an -exit, and every open unit is running, scheduled or owned. - -- **One Forge GitHub App.** The supervisor holds its private key and owns GitHub - writes: commits, refs, PRs, comments, labels, checks and merges. The intended - required permissions are Metadata read and Contents, Pull requests, Issues and - Checks write. Workflows write is optional and subject to repository policy; - Administration read is conditional on classic protection; Deployments read is - optional. Commit-status permission remains an open proof, not a granted scope. -- **Workers receive no GitHub credentials.** A supervisor-owned bare mirror supplies - repository inputs. Captured notes supply issue facts, comments, PR feedback and - CI evidence. The image-owned harness exports a bundle and a typed result. The - supervisor verifies and publishes the result. GitHub CLI tools and GitHub - network destinations leave the sandbox once every worker role can operate this way. -- **Tailscale operator identity by default**, with Login with GitHub through the - same Forge App as a fallback. An explicit operator identity and authorization - replace the mode that treats network reachability as operator authority. -- **Independent logical Build, Review and Audit remain.** One App does not combine - their assignments or let a builder approve its own result. Typed evidence, - exact candidate pins, scoped gates and the shared failure budget remain binding. - -This target supersedes the four-App registration goal and separate identity-App -wizard in [#136](https://github.com/XRPL-Commons/forge/issues/136) and -[#12](https://github.com/XRPL-Commons/forge/issues/12). Existing Apps, sessions, -installation journals and completed qualifications remain migration inputs. -Do not uninstall Apps, alias connections or discard identity state merely because -this target is documented. Current operational instructions still describe the -installed four-App system until its replacement ships. - -## Current boundary - -The current supervisor can mint narrowed tokens, and tracked child/planning work -already uses read credentials. Ordinary publishing builds and integration still -have GitHub write authority. Worker bundles, exact task outputs, durable captures, -scoped cleanup and supervisor-owned check effects are useful foundations; the -supervisor does not yet own every publication. - -Current operator authentication uses its configured GitHub identity App and -sessions. The UI proxy does not forward Tailscale identity. Adding an unchecked -header to the allowlist is not an identity implementation. - -## Delivery phases - -### 0. Observable waits and bounded recovery — #260–#264 - -These small changes ship before the architecture migration: - -- **#260:** reject stale operator requests without opening a gate. Give remaining - `external_change` waits a reload/observation exit, and repair the specifically - identified old request-created gates. -- **#261:** persist each dispatch/result/merge decline with its next action or - owned gate. Detect otherwise unowned stalls; queued work must have a real - schedule. Rebuild stale-base assignments rather than silently declining. -- **#262:** introduce the image-owned exit envelope and distinguish Forge faults, - provider errors, timeouts and OOM. Forge faults and provider cooldowns do not - charge the issue; timeouts charge once; OOM follows deterministic escalation. - Provide a deduplicated Report to Forge draft and retry affected work on deploy. - A trusted pre-agent fault receipt is an initial slice, not the complete envelope. -- **#263:** let Recheck release worker-claimed environment/permission waits for a - new attempt. Re-test on relevant version, repository, environment or login - changes and bounded backoff. Charge an unchanged repeated claim once and invoke - the steward. Keep unrelated gates intact. -- **#264:** apply effect backoff and attempt caps. Resolve bounded uncertainty from - fresh evidence: confirm a merged PR, refuse a closed-unmerged or changed-head - PR regardless of send count, or escalate unresolved ambiguity to a Forge gate. - Long-lived unmergeability returns work for rebuilding. Never infer an outcome - merely because time elapsed. - -Recheck and outbox changes can ship independently of supervisor publication and -one-App setup. Their later steward/publication integrations remain explicit work. - -### 1. Supervisor publication — #255 - -Build this around retained verified bundles and durable external effects: - -1. The image-owned harness exports each ordinary build and final integration - result, with typed PR text. Worker tokens have no write permissions. Only - `pass` or `needs_human_verification` may yield a new candidate; a matching PR - must not promote an `unable` or otherwise unsuccessful report. -2. Verify objects outside an executable checkout against the immutable assignment. - Preserve modes, symlinks, deletions and submodule entries. Compute protected-path - and removed/skipped-test facts for Review/Audit; these facts do not reject a change. -3. Journal supervisor publication intent with exact assignment, input tree, - repository, branch and prior head. Reconcile uncertain API responses and use - non-force head checks before retrying writes. The App creates one published - commit per attempt and owns the submission marker. -4. Read back the published head and exact tree before candidate acceptance. - Bind the GitHub-created commit to the verified worker bundle and task-output - receipts. Flattening worker commits must not weaken prerequisite validation: - original task ancestry stays proven in retained objects, and final publication - has a separate exact-tree receipt. -5. Reuse existing candidate invalidation, Review/Audit, human verification and - merge admission. Preserve approved existing-PR ownership transfers and exact - previous head/author identity; migration is not permission to edit any PR by - a former Forge bot. - -**Proof required before choosing the final publisher:** in an authorized scratch -repository, establish whether a REST Git Data commit made by the installation App -without custom author/committer is verified and passes the intended signed-commit -ruleset. #255 proposes a GraphQL alternative if this fails; it would need an -explicit unsupported-mode contract rather than silently changing files. Neither -alternative is established by this document. - -**Resolve #255's wording conflict:** its content section explicitly makes protected -paths reviewer facts, while its later test list says “protected-path refusal”. Use -the explicit facts-only rule. Workflow permission policy is a separate authority. -Per-file/file-count/bundle limits are transport/resource bounds; do not introduce -an arbitrary total-diff-size quality gate. Pin the actual bounds and LFS refusal -contract before implementation. - -### 2. Tokenless workers and sandbox hardening — #259 phase 2, #265 - -Add a supervisor-owned mirror and immutable job input selection. Pin repository, -base/head and exact dependency outputs; never mount supervisor credentials or a -writable shared mirror into a worker. Transfer ownership and cleanup follow the -existing job/attempt leases. - -Capture bounded, attributable issue/comment/review/CI context for Build, Review, -Audit, triage, discussion and recovery. Incomplete input must be visible; do not -replace a needed fresh observation with a silently truncated or stale note. -Only after all these paths work without GitHub access remove token injection, -askpass, worker token revocation, `gh` and GitHub egress. Retain supervisor credential -lifecycle handling. Existing in-flight jobs must finish under their captured -contract or be explicitly drained before deleting the old path. - -**Decision:** private Git dependencies need a mirror strategy or a declared, -repository-scoped read exception. A credential-bearing exception must be described -as an exception; it cannot count as full tokenless-worker acceptance. - -#265 also covers provider credential isolation, removing GitHub credentials from -Codex shells and updating canaries, a bounded `/work` volume, worker network -isolation, and read-only npm/PyPI pull-through proxies. Verify provider support for -access-only snapshots or the preferred host-side model proxy; reject refresh-token -write-back that did not come from the host refresher. This work is part of Phase 2, -not deferred merely because #259 separately lists provider credentials later. - -### 3. Steward v1, starting with recovery — #258 - -Use a typed move menu, an exact input revision, ranked choices and one recommended -move. Keep durable decision/effect replay and a single decision per failure. The -three steward cycles are distinct from the delivery's three-failure budget; -automatic retries do not reset exhausted budgets or clear independent holds. - -### 4. Consolidation and typed fields — #267, #266 - -Unify triage, recovery and discussion as steward modes sharing dossier/decision v1, -guards, autonomy levels and choices UI; add stall and brief modes. Review and Audit -remain independent executors. Consolidate the gate registry into four classes, -reshape unit states and the separate running/scheduled/owned axis, and merge the -operator-action outbox into the external-effects outbox. Build result v2 uses -`done | cannot_complete` plus typed claims. - -Replace each prose-driven decision only when its typed replacement exists: -dependencies, environment tier, worker/provider errors, recovery approach, -PR-linked issues and dependency claims. Keep the structured operator dependency -override. Verify GitHub's typed linked-issue/ownership fit before replacing that -reader. Each replacement can be a small change; the current rule remains the -single authority until its replacement lands. - -### 5. One App, identity and provider credentials — #259 phases 3–5 - -#### One App and check-based verdicts - -Collapse connection/onboarding configuration only after publication and input -boundaries no longer depend on separate role credentials. Record an explicit, -resumable mapping from existing App/installation identities to the selected Forge -App. Preserve queued effects and immutable historical assignments. Require fresh -installation and policy checks before retiring any old key or App. - -Review/Audit verdicts remain independent evidence and are published as checks and -comments. GitHub review count must not be inferred from machine verdicts. The -intended baseline has the Forge App as its one pull-request bypass actor and pins -`forge/merge-policy` to its App identity. - -Repository settings select the merge-check scope: **all PRs** (default) or -**Forge-created PRs only**. Human-authored PRs must pass independent Forge Review -and Audit for their exact head and base. They receive review-only work with no -builder or automatic merge; stronger repository protections remain in force. - -**Open policy/proofs:** - -- Does configuring the App-pinned required check need any additional permission, - particularly Commit statuses write? Do not add it speculatively. -- Define the baseline human review count and bypass behavior together. Current - two-review baseline wording and #259's counted-human path need one explicit - rule; a check run does not itself count as a human approval. -- Prove signed publication and the chosen required-check/bypass behavior together, - preserving stronger organization rules and non-Forge developers' access. - -A single-App manifest replaces the four-App wizard. Keep resumable browser -handoffs, exact repository selection, local administrator credentials and explicit -Start. Reduced operator steps are a target, not measured acceptance yet. - -#### Tailscale identity and same-App GitHub fallback - -Choose and test the full trusted path: Tailscale Serve → UI proxy → status API. -A loopback bind alone does not prove the forwarded identity came from Serve; the -upstream secret authenticates the UI hop, not the browser's supplied identity. -Strip untrusted identity headers, authenticate the ingress hop, and test direct -local requests as well as normal proxied requests. Decide whether the supported -boundary uses loopback with the required process restrictions or a Unix socket. - -Bind bootstrap to the explicitly selected first operator, not the first visitor. -Map identity into the existing authorization, mutation attribution, CSRF and -scoped external-agent connection model. Define revocation and sign-out behavior: -ambient Tailscale identity must not silently remove the existing operator action -that disconnects approved agents. Decide how GitHub and Tailscale identities map -to the same operator without an accidental account-linking grant. - -**Proof:** same-App Login with GitHub must work for the intended operator without -an installation, with the required minimal scopes. Preserve current OAuth sessions -until a verified migration is available; deleting the old wizard is the final step. - -#### Provider credentials - -Complete #259's provider credential work alongside the #265 boundary established -in Phase 2. Provider-specific capabilities need conformance proof; do not call an -unverified credential path complete or introduce another authority for refreshes. - -### 6. Delete the legacy JSON runtime — #268 - -Confirm every known installation selects SQLite first. Move shared helpers into -neutral modules, make startup refuse an unselected store with a migration message, -then remove the legacy supervisor, ledger and operational JSON branches and their -tests. Retain the importer for old installations. The absence of a selection marker -must no longer silently choose a second runtime. - -## Work that remains useful during the sequence - -Reject unsuccessful build reports before candidate promotion without weakening -late-capture authority. Improve current setup resumption and prerequisite wording -without fabricating readiness. Neither change requires the one-App migration. - -Reporting an issue remains an operator-approved external effect. Deduplicate by a -safe signature without publishing private source or logs. A new release rechecks -a recorded fault; it does not establish an unlimited retry loop. - -## Acceptance carried forward - -| Existing work | What remains valid and what changes | -|---|---| -| #209 SQLite/lifecycle | Keep migration, parity, shared state/gates, ordinary merge and observation evidence. HTTP performance and combined-delivery acceptance remain separate. New publication effects must use this same authority. | -| #207/#217 delivery | Keep one owning builder, tracked task graph, exact outputs, shared budgets, one independent Review/Audit and normal member closure. The publisher moves to the supervisor; it does not change approved composition or create a new delivery ledger. Real parallel/grouped merge evidence is still required. | -| #215 planning | Keep proposals, notes, per-row approval, durable effects, dependencies and explicit merge policy. A new one-App baseline must still enforce human-required cases. | -| #136/#12 onboarding | Replace the four-App/separate identity-App target with #259. Keep deterministic CLI/wizard parity, resumability, credential isolation, truthful readiness, explicit Start, normal first merge and human-approval recovery. Preserve existing installations rather than registering replacement Apps blindly. | -| #216 qualification | Qualify coherent batches together. Keep local/mock proof separate from supported upgrade, scratch-platform proof and real issue-to-merge evidence. No issue closes merely because its architecture changes. | - -The north star remains time from recorded CLI installation to the first normal -GitHub-confirmed merge, including approvals and retries. Missing installation -start remains unknown. A functioning service or a target touch-count estimate does -not establish that measurement. Optional new providers and observer work stay -deferred under the existing core-completion priority; this does not defer #265 -credential isolation for supported providers. diff --git a/tests/test_repository_rules.py b/tests/test_repository_rules.py index c235b880..bd77830b 100644 --- a/tests/test_repository_rules.py +++ b/tests/test_repository_rules.py @@ -8,7 +8,7 @@ def classic(count=2, stale=True, owners=False): return {'required_pull_request_reviews': {'required_approving_review_count': count, 'dismiss_stale_reviews': stale, 'require_code_owner_reviews': owners, - 'bypass_pull_request_allowances': {'apps': [{'id': 4959034}]}}} + 'bypass_pull_request_allowances': {'apps': [{'id': 123456}]}}} # Ruleset fields follow https://docs.github.com/en/rest/repos/rules#create-a-repository-ruleset @@ -24,7 +24,7 @@ class RepositoryRuleTests(unittest.TestCase): item = {'repo_id': 71, 'repo': 'example/project'} def reader(self, protection=None, rules=None, bypass='always'): - settings = Mock(); settings.load.return_value = {'repositories': [], 'connections': {'controller': {'app_id': 4959034}}} + settings = Mock(); settings.load.return_value = {'repositories': [], 'connections': {'controller': {'app_id': 123456}}} github = GitHub(settings, {'human_reviewers': ['maintainer']}, clock=lambda: 1234) def read(role, item, method, suffix, payload=None): self.assertEqual(method, 'GET') @@ -49,17 +49,17 @@ def read(role, item, method, suffix, payload=None): return github def shared(self,reader,scope='all'): - connection={'app_id':4959034,'installation_id':1,'private_key_env':'FORGE_KEY'} + connection={'app_id':123456,'installation_id':1,'private_key_env':'FORGE_KEY'} reader.settings.load.return_value={'repositories': [], 'connections':{role:dict(connection) for role in ('build','review','audit','controller')}} reader.runtime={'repository_merge_check_scopes':{'71':scope}} return reader - def policy_rule(self,app_id=4959034): + def policy_rule(self,app_id=123456): return {'type':'required_status_checks','ruleset_id':13, 'parameters':{'required_status_checks':[{'context':'forge/merge-policy','integration_id':app_id}]}} def test_shared_app_observes_existing_checks_without_requiring_a_forge_ruleset(self): - for app_id in (None, -1, 4959035, True, 4959034): + for app_id in (None, -1, 123457, True, 123456): reader = self.shared(self.reader(None, [rule(4), self.policy_rule(app_id)])) report = reader.protection_report(self.item, {'base_ref': 'main'}) self.assertTrue(reader.protections(self.item, {'base_ref': 'main'})) diff --git a/tests/test_steward_effects.py b/tests/test_steward_effects.py index 97cd4425..a327cec2 100644 --- a/tests/test_steward_effects.py +++ b/tests/test_steward_effects.py @@ -15,7 +15,7 @@ class StewardEffectsTests(unittest.TestCase): def setUp(self): self.f = core.StewardCoreTests(); self.f.setUp(); self.addCleanup(self.f.doCleanups) self.store = self.f.store - self.service = StewardService(store=self.store, actor_id='github:1609016', clock=lambda:self.f.now) + self.service = StewardService(store=self.store, actor_id='github:1000', clock=lambda:self.f.now) self.github = Mock() self.github.publisher.return_value = 'controller[bot]' self.issues = {1: {'number':1,'state':'open','labels':[],'assignees':[]}} diff --git a/tests/test_steward_service.py b/tests/test_steward_service.py index 25d43cdb..72fbd5e7 100644 --- a/tests/test_steward_service.py +++ b/tests/test_steward_service.py @@ -15,7 +15,7 @@ def setUp(self): self.fixture = core.StewardCoreTests() self.fixture.setUp() self.addCleanup(self.fixture.doCleanups) - self.service = StewardService(store=self.fixture.store, actor_id='github:1609016', clock=lambda: 100) + self.service = StewardService(store=self.fixture.store, actor_id='github:1000', clock=lambda: 100) def choice(self, **changes): identifier, _, _ = self.fixture.accepted(judgement='judgement') @@ -34,7 +34,7 @@ def test_selection_is_attributed_replayable_and_distinct_from_application(self): self.assertEqual(self.service.choose(**request), result) with self.fixture.store.read_snapshot() as db: self.assertEqual(db.execute('SELECT actor_id FROM decisions WHERE request_id=?', - (request['request_id'],)).fetchone()[0], 'github:1609016') + (request['request_id'],)).fetchone()[0], 'github:1000') self.assertEqual(db.execute('SELECT count(*) FROM steward_applications').fetchone()[0], 0) self.fixture.life.apply(self.fixture.command(), decision_id=request['decision_id'], apply_move=lambda *args: {}) self.assertEqual(self.service.view('i')['decision']['application']['status'], 'applied') diff --git a/tests/test_store_operator.py b/tests/test_store_operator.py index d197ef1f..4b788fa0 100644 --- a/tests/test_store_operator.py +++ b/tests/test_store_operator.py @@ -43,7 +43,7 @@ class OperatorTests(unittest.TestCase): def setUp(self): helpers.ResultControllerTests.setUp(self) self.github=Remote();self.now=100 - self.actions=OperatorActions(self.store,self.github,actor_id='github:1609016',config=validate({}),clock=lambda:self.now) + self.actions=OperatorActions(self.store,self.github,actor_id='github:1000',config=validate({}),clock=lambda:self.now) def revision(self): with self.store.read_snapshot() as db:return action_revision(db,'i') def request(self,action,reason='Operator reason',**kwargs): @@ -197,7 +197,7 @@ def test_reopen_undoes_an_applied_close_and_asks_for_a_fresh_look(self): self.assertTrue(self.actions.step(undo)['applied']) self.assertEqual(self.github.issue_value['state'],'open') with self.store.read_snapshot() as db: - self.assertEqual(db.execute('SELECT actor_id FROM operator_observation_requests WHERE issue_id=?',('i',)).fetchone()[0],'github:1609016') + self.assertEqual(db.execute('SELECT actor_id FROM operator_observation_requests WHERE issue_id=?',('i',)).fetchone()[0],'github:1000') self.github.calls.clear() self.assertEqual(self.actions.reopen('i',request),undo) self.actions.step(undo) @@ -299,7 +299,7 @@ def test_stop_job_immediately_fences_and_is_attributed_without_github_write(self job=self.reserve();identifier=self.actions.stop_job(job,'Stop this run') self.assertEqual(self.view()['current_blocker']['code'],'operator_pause') with self.store.read_snapshot() as db: - self.assertEqual(db.execute('SELECT actor_id FROM decisions WHERE request_id=?',(identifier,)).fetchone()[0],'github:1609016') + self.assertEqual(db.execute('SELECT actor_id FROM decisions WHERE request_id=?',(identifier,)).fetchone()[0],'github:1000') self.assertEqual(db.execute('SELECT fenced FROM jobs WHERE id=?',(job,)).fetchone()[0],1) self.assertEqual(self.github.calls,[]) diff --git a/ui/app/utils/issues.ts b/ui/app/utils/issues.ts index 73414e52..d3e140b7 100644 --- a/ui/app/utils/issues.ts +++ b/ui/app/utils/issues.ts @@ -388,7 +388,7 @@ export function reviewRequestText(request: ReviewRequest | null | undefined, now } // One line per review Forge found, in words and an icon, never colour alone: -// "@lucbocahut approved · 16:03 · counted". `time` formats `at`; pass nothing +// "@octo-operator approved · 16:03 · counted". `time` formats `at`; pass nothing // before mount, when the operator's time zone is not known yet. interface ApprovalLine { login: string; text: string; counted: boolean; icon: string } export function approvalLines(approvals: IssueApproval[] | null | undefined, time?: (at: number) => string): ApprovalLine[] { diff --git a/ui/server/middleware/security-headers.ts b/ui/server/middleware/security-headers.ts index 2ea03012..269d3bc4 100644 --- a/ui/server/middleware/security-headers.ts +++ b/ui/server/middleware/security-headers.ts @@ -2,13 +2,20 @@ // `X-Content-Type-Options: nosniff` on the pages it served; Nitro is the // front door now, so it has to send them itself. // +// Nothing frames the UI, so every page also refuses to be framed. In +// Tailscale Serve mode, Serve attaches the operator's identity to every +// request from their device, including one made by a hidden cross-site +// iframe; without these headers that iframe could be used for clickjacking. +// // Ordering does the filtering: server middleware runs in filename order and // `forge-proxy.ts` sorts first, so anything it forwards to Python has already // answered by the time this runs. What is left is what Nitro renders — the -// HTML pages, the /_ui/ routes, the bundled assets — and those get both +// HTML pages, the /_ui/ routes, the bundled assets — and those get these // headers. Proxied responses keep the upstream's own (PASS_RESPONSE in -// server/utils/proxy.ts passes both through). +// server/utils/proxy.ts passes them through). export default defineEventHandler((event) => { setResponseHeader(event, 'Referrer-Policy', 'no-referrer') setResponseHeader(event, 'X-Content-Type-Options', 'nosniff') + setResponseHeader(event, 'Content-Security-Policy', "frame-ancestors 'none'") + setResponseHeader(event, 'X-Frame-Options', 'DENY') }) diff --git a/ui/server/routes/_ui/help-assets/[name].get.ts b/ui/server/routes/_ui/help-assets/[name].get.ts index 708313ec..43038463 100644 --- a/ui/server/routes/_ui/help-assets/[name].get.ts +++ b/ui/server/routes/_ui/help-assets/[name].get.ts @@ -12,7 +12,7 @@ export default defineEventHandler((event) => { catch { throw createError({ statusCode: 404, statusMessage: 'Help image unavailable' }) } setHeader(event, 'Content-Type', 'image/svg+xml; charset=utf-8') setHeader(event, 'X-Content-Type-Options', 'nosniff') - setHeader(event, 'Content-Security-Policy', "default-src 'none'; style-src 'unsafe-inline'; sandbox") + setHeader(event, 'Content-Security-Policy', "default-src 'none'; style-src 'unsafe-inline'; sandbox; frame-ancestors 'none'") // Release names change on asset edits; do not retain a previous release forever. setHeader(event, 'Cache-Control', 'private, max-age=300') return body diff --git a/ui/tests/e2e/approvals.spec.mjs b/ui/tests/e2e/approvals.spec.mjs index 2a1f5cb8..4f5305d8 100644 --- a/ui/tests/e2e/approvals.spec.mjs +++ b/ui/tests/e2e/approvals.spec.mjs @@ -20,7 +20,7 @@ export default async function (page, { base, scenario, requests, observeIssue }) await scenario('approval') const now = () => Math.floor(Date.now() / 1000) const approvals = [ - { login: 'lucbocahut', state: 'APPROVED', at: now() - 60, counted: true, why: null }, + { login: 'octo-operator', state: 'APPROVED', at: now() - 60, counted: true, why: null }, { login: 'x', state: 'APPROVED', at: null, counted: false, why: 'No write access to the repository' }, ] await observeIssue('1:614', { approvals, last_checked: now() - 20 }) @@ -35,7 +35,7 @@ export default async function (page, { base, scenario, requests, observeIssue }) const approveBox = await page.locator('#issue-actions').getByRole('button', { name: 'Approve…', exact: true }).boundingBox() assert.ok(benchBox.y + benchBox.height <= listBox.y && listBox.y + listBox.height <= approveBox.y, 'bench, then reviews, then Approve') const list = await page.locator('#issue-approvals').innerText() - assert.match(list, /@lucbocahut approved · \d{1,2}:\d{2}[^·]* · counted/) + assert.match(list, /@octo-operator approved · \d{1,2}:\d{2}[^·]* · counted/) // Not colour alone: every row carries an icon next to its words. assert.equal(await page.locator('#issue-approvals li svg, #issue-approvals li .iconify, #issue-approvals li [class*="i-lucide"]').count(), 2) await waitForText(page, 'Checked on GitHub') diff --git a/ui/tests/e2e/fixtures/bypass-classic/repositories.repo_id.json b/ui/tests/e2e/fixtures/bypass-classic/repositories.repo_id.json index 161e1fdf..e61fbe26 100644 --- a/ui/tests/e2e/fixtures/bypass-classic/repositories.repo_id.json +++ b/ui/tests/e2e/fixtures/bypass-classic/repositories.repo_id.json @@ -74,7 +74,7 @@ "code_owner_reviews": false, "bypass": { "status": "missing", - "detail": "Add the Forge controller App (ID 4959034) as a pull request bypass actor, or Forge cannot merge approved work.", + "detail": "Add the Forge controller App (ID 123456) as a pull request bypass actor, or Forge cannot merge approved work.", "sources": [ { "kind": "classic", @@ -89,7 +89,7 @@ } } ], - "controller_app_id": 4959034 + "controller_app_id": 123456 }, "required_approvals": 2 }, @@ -150,7 +150,7 @@ "code_owner_reviews": false, "bypass": { "status": "missing", - "detail": "Add the Forge controller App (ID 4959034) as a pull request bypass actor, or Forge cannot merge approved work.", + "detail": "Add the Forge controller App (ID 123456) as a pull request bypass actor, or Forge cannot merge approved work.", "sources": [ { "kind": "classic", @@ -165,7 +165,7 @@ } } ], - "controller_app_id": 4959034 + "controller_app_id": 123456 }, "required_approvals": 2 }, diff --git a/ui/tests/e2e/fixtures/bypass-missing/repositories.repo_id.json b/ui/tests/e2e/fixtures/bypass-missing/repositories.repo_id.json index 5887db8b..1ddec4ca 100644 --- a/ui/tests/e2e/fixtures/bypass-missing/repositories.repo_id.json +++ b/ui/tests/e2e/fixtures/bypass-missing/repositories.repo_id.json @@ -83,7 +83,7 @@ "bypass_actors_visible": true } ], - "controller_app_id": 4959034 + "controller_app_id": 123456 }, "required_approvals": 2 }, diff --git a/ui/tests/e2e/fixtures/installation-progress/installation.json b/ui/tests/e2e/fixtures/installation-progress/installation.json index 9c5ad96d..d92ad6ef 100644 --- a/ui/tests/e2e/fixtures/installation-progress/installation.json +++ b/ui/tests/e2e/fixtures/installation-progress/installation.json @@ -78,15 +78,15 @@ "repositories": [ { "id": 1, - "name": "lucbocahut/anton" + "name": "octo-operator/anton" }, { "id": 2, - "name": "lucbocahut/dd-frigate" + "name": "octo-operator/dd-frigate" }, { "id": 3, - "name": "lucbocahut/mises" + "name": "octo-operator/mises" } ] } diff --git a/ui/tests/e2e/fixtures/installation-progress/installation.post.json b/ui/tests/e2e/fixtures/installation-progress/installation.post.json index afd4c8a2..24f8cda6 100644 --- a/ui/tests/e2e/fixtures/installation-progress/installation.post.json +++ b/ui/tests/e2e/fixtures/installation-progress/installation.post.json @@ -75,15 +75,15 @@ "repositories": [ { "id": 1, - "name": "lucbocahut/anton" + "name": "octo-operator/anton" }, { "id": 2, - "name": "lucbocahut/dd-frigate" + "name": "octo-operator/dd-frigate" }, { "id": 3, - "name": "lucbocahut/mises" + "name": "octo-operator/mises" } ] } diff --git a/ui/tests/e2e/fixtures/owned/factory.json b/ui/tests/e2e/fixtures/owned/factory.json index 5a671e9f..00b2ab5c 100644 --- a/ui/tests/e2e/fixtures/owned/factory.json +++ b/ui/tests/e2e/fixtures/owned/factory.json @@ -3,7 +3,7 @@ "controls_token": "synthetic", "active": true, "operator": { - "title": "Assigned to @lucbocahut", + "title": "Assigned to @octo-operator", "detail": "Forge leaves assigned issues to their assignees. Unassign it on GitHub to let Forge work on it.", "action_url": "/issues?issue=1:610", "action_label": "View issue" diff --git a/ui/tests/e2e/fixtures/owned/issues.issue.json b/ui/tests/e2e/fixtures/owned/issues.issue.json index 8247ad62..9b8208ba 100644 --- a/ui/tests/e2e/fixtures/owned/issues.issue.json +++ b/ui/tests/e2e/fixtures/owned/issues.issue.json @@ -12,7 +12,7 @@ "ready" ], "assignees": [ - "lucbocahut" + "octo-operator" ], "key": "1:610", "repo": "XRPL-Commons/academy", @@ -57,7 +57,7 @@ ], "reviews": [], "summary": { - "headline": "Assigned to @lucbocahut", + "headline": "Assigned to @octo-operator", "plain": "Forge leaves assigned issues to their assignees. Unassign it on GitHub to let Forge work on it." } }, diff --git a/ui/tests/e2e/help.spec.mjs b/ui/tests/e2e/help.spec.mjs index fb800643..788b0900 100644 --- a/ui/tests/e2e/help.spec.mjs +++ b/ui/tests/e2e/help.spec.mjs @@ -66,6 +66,9 @@ export default async function (page, { base }) { assert.equal(asset.status(), 200) assert.match(asset.headers()['content-type'], /^image\/svg\+xml/) assert.equal(asset.headers()['x-content-type-options'], 'nosniff') + assert.equal(asset.headers()['x-frame-options'], 'DENY') + // The asset route keeps its own sandboxing policy and adds the framing rule. + assert.match(asset.headers()['content-security-policy'], /frame-ancestors 'none'/) for (const name of ['unknown.svg', 'constructor', '__proto__', 'package.json', '%2e%2e%2fpackage.json']) { assert.equal((await page.request.get(base + '/_ui/help-assets/' + name)).status(), 404) } diff --git a/ui/tests/e2e/ownership.spec.mjs b/ui/tests/e2e/ownership.spec.mjs index 5482f991..d083544f 100644 --- a/ui/tests/e2e/ownership.spec.mjs +++ b/ui/tests/e2e/ownership.spec.mjs @@ -21,7 +21,7 @@ export default async function (page, { base, scenario }) { }) const panel = page.locator('[role="dialog"][data-side="right"]') await panel.waitFor() - await panel.getByText('Assigned to @lucbocahut', { exact: true }).waitFor() + await panel.getByText('Assigned to @octo-operator', { exact: true }).waitFor() assert.match(await panel.innerText(), /Unassign it on GitHub/) await page.keyboard.press('Escape') await panel.waitFor({ state: 'hidden' }) diff --git a/ui/tests/unit/approvals.test.ts b/ui/tests/unit/approvals.test.ts index 3cc3c93e..f0e6129c 100644 --- a/ui/tests/unit/approvals.test.ts +++ b/ui/tests/unit/approvals.test.ts @@ -6,13 +6,13 @@ describe('approvalLines', () => { const time = () => '16:03' it('says whether each review counted, in words and with an icon', () => { const lines = approvalLines([ - { login: 'lucbocahut', state: 'APPROVED', at: 1790000000, counted: true, why: null }, + { login: 'octo-operator', state: 'APPROVED', at: 1790000000, counted: true, why: null }, { login: 'x', state: 'APPROVED', at: null, counted: false, why: 'No write access to the repository' }, { login: 'y', state: 'CHANGES_REQUESTED', at: 1790000000, counted: false, why: 'Requested changes' }, { login: 'z', state: 'DISMISSED', at: 1790000000, counted: false, why: 'Approval was dismissed' }, ], time) expect(lines.map(line => line.text)).toEqual([ - '@lucbocahut approved · 16:03 · counted', + '@octo-operator approved · 16:03 · counted', '@x approved · not counted: No write access to the repository', '@y requested changes · 16:03 · blocks the merge', '@z approval dismissed · 16:03 · not counted', diff --git a/ui/tests/unit/proxy.test.ts b/ui/tests/unit/proxy.test.ts index 4f686ac7..52e74a59 100644 --- a/ui/tests/unit/proxy.test.ts +++ b/ui/tests/unit/proxy.test.ts @@ -12,7 +12,7 @@ import type { IncomingMessage } from 'node:http' import { allowedHosts, guardAction, guardHost, proxyPaths, tailscaleIdentity, TAILSCALE_UPSTREAM_HEADER, upstreamHeaders, readUpstreamSecret, responseHeaders, readCapped, readRequestBody } from '../../server/utils/proxy' const base = { method: 'POST', contentLength: 100, headers: { - host: '100.111.151.38:8787', origin: 'http://100.111.151.38:8787', 'sec-fetch-site': 'same-origin', + host: '100.64.0.7:8787', origin: 'http://100.64.0.7:8787', 'sec-fetch-site': 'same-origin', 'content-type': 'application/json', 'x-forge-action': 'tok' } } describe('guardAction', () => { @@ -52,8 +52,8 @@ describe('proxyPaths', () => { // The DNS-rebinding defence: reaching this process is not enough, the name // the browser used has to be one the app is served on. describe('guardHost', () => { - const allowed = allowedHosts({ HOST: '100.111.151.38', PORT: '8787' }) - it('accepts the exact configured address', () => expect(guardHost('100.111.151.38:8787', allowed)).toBe(true)) + const allowed = allowedHosts({ HOST: '100.64.0.7', PORT: '8787' }) + it('accepts the exact configured address', () => expect(guardHost('100.64.0.7:8787', allowed)).toBe(true)) it('rejects a rebound name on the same port', () => expect(guardHost('evil.example:8787', allowed)).toBe(false)) it('rejects a missing Host header', () => { expect(guardHost(undefined, allowed)).toBe(false) @@ -66,7 +66,7 @@ describe('guardHost', () => { expect(guardHost('localhost', allowed)).toBe(true) expect(guardHost('LOCALHOST:8787', allowed)).toBe(true) }) - it('rejects the right address on the wrong port', () => expect(guardHost('100.111.151.38:9999', allowed)).toBe(false)) + it('rejects the right address on the wrong port', () => expect(guardHost('100.64.0.7:9999', allowed)).toBe(false)) }) describe('allowedHosts', () => { @@ -76,8 +76,8 @@ describe('allowedHosts', () => { expect(guardHost('evil.example:3999', set)).toBe(false) }) it('falls back to the address Nitro reports when HOST/PORT are unset', () => { - const set = allowedHosts({}, { address: '::ffff:100.111.151.38', port: 8787 }) - expect(guardHost('100.111.151.38:8787', set)).toBe(true) + const set = allowedHosts({}, { address: '::ffff:100.64.0.7', port: 8787 }) + expect(guardHost('100.64.0.7:8787', set)).toBe(true) }) it('never trusts a wildcard bind as a name', () => { const set = allowedHosts({ HOST: '0.0.0.0', PORT: '8787' }) @@ -85,10 +85,10 @@ describe('allowedHosts', () => { expect(guardHost('127.0.0.1:8787', set)).toBe(true) }) it('is replaced wholesale by NITRO_ALLOWED_HOSTS', () => { - const set = allowedHosts({ HOST: '100.111.151.38', PORT: '8787', NITRO_ALLOWED_HOSTS: 'forge.example:8787, forge.example.ts.net' }) + const set = allowedHosts({ HOST: '100.64.0.7', PORT: '8787', NITRO_ALLOWED_HOSTS: 'forge.example:8787, forge.example.ts.net' }) expect(set).toEqual(['forge.example:8787', 'forge.example.ts.net']) expect(guardHost('forge.example.ts.net', set)).toBe(true) - expect(guardHost('100.111.151.38:8787', set)).toBe(false) + expect(guardHost('100.64.0.7:8787', set)).toBe(false) }) }) @@ -297,7 +297,7 @@ describe('Tailscale Serve operator identity', () => { }) it('refuses a header sent straight to the tailnet address or under another name', () => { expect(tailscaleIdentity(serve, '100.101.102.103', env)).toBeUndefined() - expect(tailscaleIdentity({ ...serve, host: '100.111.151.38:8787' }, '127.0.0.1', env)).toBeUndefined() + expect(tailscaleIdentity({ ...serve, host: '100.64.0.7:8787' }, '127.0.0.1', env)).toBeUndefined() }) it('is off unless identity mode and an HTTPS origin are configured', () => { expect(tailscaleIdentity(serve, '127.0.0.1', {})).toBeUndefined() diff --git a/ui/tests/unit/security-headers.test.ts b/ui/tests/unit/security-headers.test.ts new file mode 100644 index 00000000..4e1f5b37 --- /dev/null +++ b/ui/tests/unit/security-headers.test.ts @@ -0,0 +1,22 @@ +// @vitest-environment node +import { afterEach, describe, expect, it, vi } from 'vitest' + +afterEach(() => { vi.unstubAllGlobals() }) + +describe('security headers', () => { + it('sends the page hardening headers, including framing protection', async () => { + const setResponseHeader = vi.fn() + vi.stubGlobal('defineEventHandler', (handler: unknown) => handler) + vi.stubGlobal('setResponseHeader', setResponseHeader) + const handler = (await import('../../server/middleware/security-headers')).default as (event: unknown) => void + const event = {} + handler(event) + for (const [target] of setResponseHeader.mock.calls) expect(target).toBe(event) + expect(Object.fromEntries(setResponseHeader.mock.calls.map(([, name, value]) => [name, value]))).toEqual({ + 'Referrer-Policy': 'no-referrer', + 'X-Content-Type-Options': 'nosniff', + 'Content-Security-Policy': "frame-ancestors 'none'", + 'X-Frame-Options': 'DENY', + }) + }) +}) diff --git a/ui/tests/unit/status.test.ts b/ui/tests/unit/status.test.ts index 4d973b07..d7e8e8af 100644 --- a/ui/tests/unit/status.test.ts +++ b/ui/tests/unit/status.test.ts @@ -150,7 +150,7 @@ describe('statusRows · github', () => { }) describe('statusRows · shared App', () => { - const connections = { build: { app_id: 5333360 }, review: { app_id: 5333360 }, audit: { app_id: 5333360 }, controller: { app_id: 5333360 } } + const connections = { build: { app_id: 234567 }, review: { app_id: 234567 }, audit: { app_id: 234567 }, controller: { app_id: 234567 } } function github(roles?: Record) { return row(statusRows({ factory: null, onboarding: null, settings: settings({ config: { connections }, ...(roles ? { roles } : {}) }) }, now), 'github') } diff --git a/ui/tests/unit/tailnet-ssr.test.ts b/ui/tests/unit/tailnet-ssr.test.ts index 768f5963..d5aea4eb 100644 --- a/ui/tests/unit/tailnet-ssr.test.ts +++ b/ui/tests/unit/tailnet-ssr.test.ts @@ -25,18 +25,18 @@ describe('Tailscale identity across server rendering', () => { const login = requestTailscaleIdentity(event, env) calls.push({ path: event.path, login, socket: event.node.req.socket?.remoteAddress }) const forwarded = upstreamHeaders(event.node.req.headers as Record, 'GET', 'localhost:8788', 'private', false, login) - return { ok: true, operator: forwarded['x-forge-tailscale-user-login'] ? { id: 1609016 } : null } + return { ok: true, operator: forwarded['x-forge-tailscale-user-login'] ? { id: 1000 } : null } })) // This is Nitro's localFetch adapter, used by useRequestFetch during SSR. const localFetch = (path: string, init: any) => fetchNodeRequestHandler(toNodeListener(app), path, init) for (const path of ['/api/auth/session', '/api/onboarding']) { const response = await fetchWithEvent(page, path, {}, { fetch: localFetch as typeof fetch }) - expect((await response.json()).operator).toEqual({ id: 1609016 }) + expect((await response.json()).operator).toEqual({ id: 1000 }) } // useForgeApi retains raw response access for ETags and timing headers. const request = createFetch({ fetch: localFetch as typeof fetch }) const response = await request.raw('/api/issues', { headers: { host: origin }, ...{ context: page.context } }) - expect(response._data.operator).toEqual({ id: 1609016 }) + expect(response._data.operator).toEqual({ id: 1000 }) expect(calls).toHaveLength(3) expect(calls.every(row => !row.socket && row.login === 'operator@example.com')).toBe(true) expect(page.node.req.headers.cookie).toBeUndefined()