diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ba672f0..c2772586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,86 @@ All notable changes to Fledge are documented here. The format follows ## [Unreleased] +## [0.4.1] — 2026-11-17 + +### Added + +- Written-by: HugoXK + +A repository can be shared with its members: the dashboard, repository page, +work items and jobs are visible to every active `repo_members` row, a `viewer` +reads without writing, a `developer` works without changing the merge policy, +and only a `maintainer` writes repository settings, changes the role, deletes +the repository, publishes a release or stops and restarts its workspace. +- A job now records one `job_attempts` row per dispatch, naming the worker, the attempt number and the lease epoch it owns; the running transition and the attempt commit together, and the stale-running/lease sweeps close a dead worker's attempt as `reaped` instead of leaving a silent reset to queued. A report that arrives from a lease epoch that was taken over is refused and recorded on the attempt it lost, so a late success cannot rewrite a reaped run. +- An iterate job's goal now carries one line of temporal context — `Since 4f2c1a9: 3 commits ahead, 2 merged PRs (#812, #815)` — built from the previous finished run's base SHA, and the job page shows the same line. A first run says `Since: no previous run`, and a compare that failed or a page walk that hit its cap is marked `partial` instead of reporting a smaller number. +- An issue body that tells the agent to push to main is now recorded as named, blocked directives on the job page instead of only being fenced as data. The firewall matches a finite rule table and stores rule ids plus the body hash, never the text. +- A job can now stop and ask instead of guessing: a terminal callback may carry one bounded `decision`, the job waits as `paused`, the question appears in the existing inbox marked with its job, and the first answer starts exactly one retry whose goal carries the question and the answer. +- Each repository now has a development strategy that is versioned and content-addressed: a strategy page shows the bundle version and hash it is on with each section's source, and a maintainer can freeze the current strategy as a new candidate. A stale page is refused with both versions, and a strategy that names a frozen section — evaluator, evidence, CI, merge gate, auth, gateway or capability — is refused before anything is written; stable is never moved by freezing. +- Every job now records the development strategy it was created under — its content hash, its version when that content was frozen, and the section map itself — and the job page shows it. When the repository's strategy changed since the previous job, the page names the section keys that moved, and the earlier job keeps its own hash so history is read rather than rewritten; a job created before this change says it has no recorded strategy instead of showing an empty one. +- Notifications now go through a durable outbox instead of a best-effort call: job, digest and question mail and the operator webhook are queued with an idempotency key, retried on a definite transient refusal, marked unknown when a request may have reached the destination (never resent automatically), and shown with their delivery state in the admin console, where an explicit resend reuses the same key and is audited. +- A schedule's console now has a **Run now** button: one explicit run from the current +moment, identified by the key the page rendered, so a double click starts one run +and a new page starts a new one. It never moves the schedule's next run. +- A schedule on a repository can now be paused and resumed from its console. While it is paused the worker records each instant that passes as skipped with reason paused instead of running it, so the window is visible afterwards and resuming starts from the next instant rather than replaying a backlog. Pausing and resuming are maintainer actions and are audited. +- Written-by: HugoXK + +A failed release run can now be explained from the repository page. An explicit +maintainer action reads the failed job logs of the run the release recorded +through a read-only GitHub App token that is revoked when the read ends, redacts +the text before it is cut, and shows a bounded excerpt with the exact log lines +it kept and a link to the job page. The analysis never changes the release state, +creates a Release or reruns a workflow, and a repository without an installation +is refused instead of being read with a wider user token. +- A draft Release prepared for a connected repository now carries notes built from the release range — the merged pull requests and commits between the previous tag and the confirmed target — with each source listed once and linked, instead of a placeholder sentence. The repository page lists the exact sources the draft was built from. +- A review that requests changes now starts a fix through a budget instead of without one: a third-party review bot can cause at most one fix per pull request, and the platform's own reviewer at most three per head (a repository can lower its own ceiling with the `repo::max_revisions` setting). A person's requests are never counted, a repeated request is still answered by the existing duplicate-fingerprint guard before any budget is spent, and every refusal writes one `trigger.revision_refused` audit row. The count resets when the pull request head moves, and a request that arrives while a review is already running keeps its author into the replay, so the fix it starts is counted exactly like one that started immediately. +- The admin metrics page gains an `Automation health` card and `/metrics` gains the series behind it: how long a repository has had ready work with no active job, the dispatch latency from ready work to a started job, and the queue depth. A repository whose ready work waits longer than `AUTOMATION_IDLE_ALERT_MINUTES` (default 30) now raises an `automation_idle_with_work` alert that clears when a job starts, and `FledgeDispatchLatencyHigh` pages when the p95 dispatch latency is above 15 minutes. +- A provider model its provider has stopped serving is recorded as retired with the date: Settings and the repository page say so, the job's model line names the reason, and an apply that would restart a workspace onto that model is refused with its name. + +### Changed + +- The job page now opens with one review → merge card: a single sentence and a single action for the current state, with the head SHA, the verdict that covers it, checks, path and evidence, base movement and queue state in the same card. A verdict recorded at an older tip, a moved base and a blocked check each have a named state, and the card refuses to offer the merge control for them. The per-pull-request merge control lives on that card; the repository page links to it and keeps its bulk "merge all clean PRs" action. +- A refused repository setting is now visible where the mistake is: the repository Settings form marks the invalid interval with `aria-invalid`, describes it with an `aria-describedby` message under the field, and moves focus to it, while the page banner keeps only a short summary instead of repeating the sentence. A submitted interval the form never offered is refused rather than silently clamped, and a legacy row whose stored interval is not in the offered list can still be saved unchanged. +- Every line the carry-over block states about earlier work now says when that state was observed and what it was — `observed 07:12Z open` — from the same read the block already spent, and the job page shows the same observation after the run instead of re-deriving it. A read that failed says `observed unverified` and carries no time, a pull request closed without merging is `closed` rather than `open`, and a job from before this change says the observation was not recorded instead of showing a borrowed time. +- The repository header now names the interval it prints as the discovery cadence — "Discovery every" / 发现间隔, the word the Add-repository and settings forms use — and reports it at the one-hour floor discovery actually applies, instead of reading "Auto every" beside the automatic-work switch. Automatic work stays an on/off switch, and a repository with a saved schedule still shows the schedule's next run as the answer for when a run happens. +- The `ci-ok` check that gates a merge is now also published by a `workflow_run` workflow, which GitHub always takes from the default branch, so a pull request can no longer rewrite the aggregate that judges it without losing the merge. The aggregate job inside `ci.yml` keeps publishing `ci-ok` for one step so the change itself can merge; branch protection still requires `ci-ok`. +- The console now uses the warm editorial palette: charcoal and warm paper surfaces, a copper interactive accent, sage and sand brand hues, a serif display face on the page title, wordmark and hero heading over the system-sans body copy at 14px/1.55, a 6/8/10/12 radius scale and one tight shadow kept to menus and dialogs instead of an 80px glow on every card. The letter-spaced uppercase section labels are gone, and both palettes keep their WCAG AA contrast ratios. +- A release now closes its own chain: the publish job scans and smoke-tests the exact digest it pushes, runs the verification it used to leave to an operator, attaches the SBOM to the GitHub Release instead of an expiring Actions artifact, and refuses to repoint the `vX.Y.Z` image tag at a different digest. +- Feedback is now a global dialog opened from the footer, so sending a note no longer leaves the page. The Settings form remains as the no-JavaScript fallback and keeps the feedback history, the duplicate feedback button in the About card is gone, and submitting returns to the page the note was written on. +- The work board and the scheduled work selection now share one FIFO order: at equal priority the oldest work item is first. A recently edited item can no longer jump ahead of an older one that has been waiting, so the backlog is drained in the order it arrived. +- The GitHub star link in the footer and the Settings About card now uses a drawn line-star icon with a compact label instead of the `★` text glyph. The URL, the About copy and the accessible name are unchanged. +- The console moves to a flight-deck visual system: a cool mineral and pine palette with brass as the only warm note, flat section rules and square controls instead of identical rounded cards, a dashboard masthead with a Connect → Goal → Work → Review → Merge loop rail, sentence-case labels, and the About card removed from Settings. + +### Fixed + +- Written-by: HugoXK + +The console merge button now runs through the management contract: a merge whose answer from GitHub is lost leaves an `unknown` receipt instead of a 500, and submitting the same form again reads the pull request back, records the merge once (work item, PR state, audit) and never merges it twice. +- The console's create, resume, retry and policy commands now resolve the actor from the database like cancel and pause, so every command on one repository shares one tenant-scoped idempotency receipt instead of a retried form writing a second receipt under an empty tenant; the identity backfill also stops rewriting its unchanged report row on every boot, so a read-only volume no longer fails to start over a write that changes nothing. +- `scripts/rotate-github-token.mjs` now proves a rotation instead of assuming one: inside a single run it checks the old value against `GET /user` and only deletes its timestamped backup when the old value answers `401` while the new one answers `200`. A still-live old token exits `2` and keeps the backup; an inconclusive pair exits `1`; and a new token whose `user.login` is not `EXPECTED_LOGIN` (default `HugoXK`) is refused before anything is written. +- The measured clock offset is now used, not only reported. Above the same 120 seconds the alert rule fires on, `/readyz` answers 503 with `clock.state: "fail"`, `Jobs.enqueue` refuses with `CLOCK_SKEW` before any job row is written (counted as `fledge_admission_rejected_total{reason="clock_skew"}`), and the App JWT refuses with `CLOCK_SKEW_EXCEEDED` instead of signing from a stale correction. A reading is trusted for fifteen minutes, after which the clock is `unknown` and signing fails with `CLOCK_SKEW_UNVERIFIED`, so a GitHub outage can no longer keep a wrong correction alive. Stored timestamps are unchanged and a wrong host clock still needs the host fix. +- Deleting a model provider, or one of its models, no longer silently moves the repositories that used it onto the platform default model. The affected workspaces are marked as needing a model restart and the console names how many repositories were affected, so the change in spend is a visible decision instead of a silent one. +- The daily release waits for the `ci-ok` verdict instead of reading it once: a run whose aggregate is still in progress is re-read at the same tip up to three times, five minutes apart, so a green tip that was still running no longer loses the slot, while a red aggregate still blocks at once. The release summary names the `ci-ok` run id, its status and how many reads were made. +- A release that was left half-made is now finished by the routine instead of by a human: when the tag exists but its GitHub Release does not, the tag job dispatches the publish run instead of skipping, and the scheduled slot repairs a merged release pull request whose tag is still missing. A tag that already has its release stays a no-op, a publish run that finds that release in place stops before it builds an image, and only the squash of the merged release pull request can trigger either write. +- A webhook send that may have reached the destination is now classified `unknown` even when Undici puts the socket code on `error.cause`, so it is not resent automatically; a transient resolver failure is retried instead of being marked `blocked` permanently. +- The current setup step's mark now paints its ink in `--mark-ink` on the `--accent` fill instead of `--accent-ink`: at 12px the old pair was 1.92:1 in the dark palette and the new one is 9.30:1. The AA guard in `test/uiTokens.test.ts` now covers every token ink painted on a token fill in both palettes, so a rule cannot reintroduce an unreadable pair without failing the build. +- The automation alert no longer reports a repository the dispatcher refuses for an exhausted platform quota as idle with work. The refusal and the alert now read one predicate, so quota joins approval and instance readiness as a reason the scheduler names; a user with their own model, or a repository with its own model selection, is unaffected because the platform pays nothing for it. +- A deploy now copies every file of the release it is deploying, including one whose new content happens to have the same byte count and the same timestamp as the file it replaces. Before this, rsync's size-and-time check could leave that single file from the previous release in place while the rest of the tree was replaced, so the host could serve one old file beside a freshly built version: a file under `public/` was refused by the rollout gate's whole-tree comparison and rolled back, but a file outside it, such as `package.json` or a source file, was served unseen because the gate compares only `public/`. + +### Security + +- A per-repository FlyBot container now starts with a read-only root, a single writable tmpfs at `/tmp`, every Linux capability dropped, `no-new-privileges`, a non-root user and the existing CPU, memory and PID ceilings, and the host Docker socket is never mounted into it. A new isolation check starts a throwaway container with exactly those arguments and asserts each fact from inside it — the root refuses a write, the effective capability set is empty, a seccomp filter is loaded, the socket is absent, only the repository's own data directory is a host bind, and a container on another tenant's network is unreachable — and exits 3 where no Docker daemon exists instead of reporting a pass. The builder also refuses a data directory that is not an absolute existing directory, so the one host path a tenant container sees cannot be a relative path the daemon resolves elsewhere or a path Docker would create as root. Egress is unchanged in this slice. +- A `TRUST_PROXY` whose entries together cover the whole IPv4 or IPv6 space is now refused at startup, the same way a `/0` range already was: host bits are masked, the entries are combined, and an IPv4-mapped prefix such as `::ffff:0:0/96` counts as the IPv4 range it actually trusts. An installation running such a list will not boot until the env names the proxy address or its narrow CIDR; a list that stops short of the whole space still starts. Separately, a request address that cannot be parsed - for example nine groups forwarded verbatim by a trusted hop - now falls into one shared rate-limit bucket instead of answering 500. +- Issue text sent to the agent from `/fledge plan` and `/fledge fix` is now wrapped in a labelled untrusted block. A forged fence is escaped, control characters are stripped, the 4,000-character cap is kept, and the job audit records the label and a hash instead of the body. +- Account identifiers no longer reach the log sink, and a development outbox file no longer carries the recipient in its name. A log line masks an email, a GitHub login, a user id, a token and an IP address in every string field — including fields the sink does not name and values nested inside an object or an array — while the stored job row and the job page keep the real value an operator needs; `npm run mail:outbox` expires every `.eml` older than `MAIL_OUTBOX_RETENTION_DAYS` (7 days by default) and then prints the newest one. +- Deleting an account now also removes its captured error reports and its feedback triage rows, and the delete preview counts them. Both tables point at the account with a foreign key that clears the id instead of deleting the row, so the login, the page path, the error text and the triage message survived the deletion and stayed readable; the purge now deletes them explicitly before the account row. +- The release publish job no longer leaves the workflow token in `.git/config` while it installs dependencies from the tag, so a dependency lifecycle script cannot read a token that carries `contents: write`, `packages: write`, `id-token: write` and `attestations: write`. +- The review gate and the PR lint no longer judge a large pull request from a capped prefix of its file and commit lists. Both read until the API returns a short page and refuse, by name, a list that does not match the file and commit counts the pull request reports, so a T3 path or a reviewer-authored commit past the old cap can neither pass without a PASS nor be searched for. +- A T1 change is no longer merged unreviewed when its diff weakens the test suite or adds client-side script: deleting an `assert.`/`expect(` line under `test/`, adding an always-true assertion, or adding an inline `