Repository navigation
Closed
Labels
agent-readyReady for an agent to implementReady for an agent to implementarea:jobsJob lifecycle, queue, callbacksJob lifecycle, queue, callbacksarea:reposenhancementNew feature or requestNew feature or requestpriority:highHigh priority; claim before normal backlogHigh priority; claim before normal backlogpriority:ownerOwner-planned task; prioritize ahead of the Product backlogOwner-planned task; prioritize ahead of the Product backlogreview:approvedIssue reviewed and approved by the Fledge Platform ReviewerIssue reviewed and approved by the Fledge Platform Reviewer
Description
Written-by: HugoXK
Problem
Fledge's auto-merge and review gate trust the repository's checks. But Fledge cannot help a repository get a trustworthy gate in the first place. A new repository either already has a good CI contract or auto-merge remains effectively unusable.
There is also no shared lane vocabulary: a PR-ready lane, an after-merge lane, a daily lane and a release lane are not distinguished, so Fledge cannot tell whether a green check is the right check at the right time.
Expected
- A gate-onboarding job that runs on the repository and does read-only analysis first:
- languages, package managers and the existing CI/workflow files;
- how dependencies are installed, built, linted and tested;
- which commands are fast enough for a PR, which need secrets/services/resources, and which are benchmarks or end-to-end;
- whether a merge queue exists and which checks it requires;
- existing
ci-gates.json/release.ymlif present.
- Propose four lanes with commands, evidence and measured duration:
pr-ready: every PR commit; build, type check, lint, fast unit tests;pr-merge: merge queue or after-merge; full tests, integration, secret-requiring checks;daily: scheduled full/benchmark/audit runs, observe-only by default;release: tag-triggered pre-publish verification.
- The FlyBot agent may trial commands in its own workspace and report what it ran and how long it took. Fledge itself still does not clone or execute the repository.
- A human reviews and may edit the proposed lanes. Nothing is written to the repository before confirmation.
- After confirmation, Fledge creates exactly one gate pull request containing the gate job,
.github/ci-gates.json,scripts/gate/gate.mjswhen missing, and a tag-triggeredrelease.ymlwhen missing. - Existing workflow files are never replaced wholesale. Only the planned gate job, its required trigger events,
ci-gates.jsonandrelease.ymlare merged; unrelated jobs and triggers are preserved. - The PR records the default-branch SHA it was based on. If that branch moved after analysis, Fledge refuses and asks for a fresh run instead of writing a stale plan.
- An empty lane runs as
not_applicable, never as a pass. A lane that fails inobservemode is recorded asobserve_fail, not hidden. - The repository page shows the installed lane contract and the last result per lane.
Red test
- Planning performs no repository write; a confirmed plan creates one PR.
- A branch that moved after analysis is refused.
- An existing
ci.ymlkeeps its unrelated jobs and triggers, and gains the gate job/event. - An empty lane reports
not_applicable, not success. - An
observelane failure does not fail the gate job but is recorded. - A merge-queue repository gets
merge_group; a non-merge-queue repository gets the after-merge path. - A check that runs on the merge preview instead of the PR head is reported as a gap.
Scope and tier
src/jobs/service.ts, src/repos/github.ts, src/lib/gate.ts (new), src/db.ts, src/views/pages.ts, tests, docs/architecture.md, docs/roadmap.md. T3, PASS at the tip.
Non-goals
- No automatic merge of the gate pull request.
- No overwrite of an existing workflow file.
- No publishing to PyPI, npm or an image registry.
- No arbitrary shell execution by Fledge; trial runs belong to the FlyBot agent and are reported as evidence.
- No change to the existing review gate; this gives it a repository contract to trust.
Prior art
agent-ci-infra/botdocs/onboarding-guide.mdandsrc/projects/gate-*: lane definitions, trial runs, human-confirmed plan, one gate PR, merge into existing files without replacement, base-SHA re-check,not_applicableandobserve.agent-ci-infra/botdocs/automation.md: pure planning modules, fail-closed facts, dry-run before execution.
Relations
- feat: add a work-type registry and a first-class issue-triage workflow #390 (work-type registry) provides the work type this onboarding job should register under.
- ui: make the review and merge step one legible action #264 (serialize merges) and ci: a green PR is not a green main — build CI on the PR-plus-main merge tree #487 (green PR is not green main) define the merge-time lane.
- feat: verify that the red test fails for the intended reason at the base #367 and feat: require an independent task verifier and run it at base and tip #368 provide the evidence and independent verification this PR must carry.
- feat: expose a scoped public API, TypeScript SDK and MCP server for jobs, work items and the queue #392 can expose the installed contract read-only to an external control room.
Read at main 94972633569ea980483748df2ba1b1e84383d0ef.
Metadata
Metadata
Assignees
Labels
agent-readyReady for an agent to implementReady for an agent to implementarea:jobsJob lifecycle, queue, callbacksJob lifecycle, queue, callbacksarea:reposenhancementNew feature or requestNew feature or requestpriority:highHigh priority; claim before normal backlogHigh priority; claim before normal backlogpriority:ownerOwner-planned task; prioritize ahead of the Product backlogOwner-planned task; prioritize ahead of the Product backlogreview:approvedIssue reviewed and approved by the Fledge Platform ReviewerIssue reviewed and approved by the Fledge Platform Reviewer
Activity
HugoXK commentedon Nov 13, 2026
Claim
Claimed by @HugoXK for implementation analysis. No branch yet.
Current code reality
verifyPullRequest(), path guard, check runs, commit status, reviews, branch protection, auto-merge reconciliation.src/repos/github.tshas no file/blob/tree/commit/ref write methods and no ruleset read method.GithubClient.getBranchProtection()only reads branch protection.createPullRequest()andcomment(). There is no branch creation or multi-file commit.Jobshas job kindsiterate|review|plan|scope|verify; there is no onboarding work type.package.json; reading or editing.github/workflows/*.ymlneeds one.Target design
Flow
gate.onboardingjob for a repository.ci-gates.json,release.yml, branch protection/rulesets, merge queue, current check names.GatePlanin the callback:pr-ready,pr-merge,daily,releaselanes;Schema
plan_hashmakes the confirmed bytes immutable. A new plan or a moved base SHA invalidates the confirmation.Plan schema
{ "baseSha": "40-hex", "lanes": { "pr-ready": {"commands": ["npm ci", "npm run check"], "observe": false, "source": "package.json", "durationMs": 180000}, "pr-merge": {"commands": ["npm run test:integration"], "observe": false, "source": "scripts/test.sh", "durationMs": 900000}, "daily": {"commands": ["npm run test:e2e"], "observe": true, "source": "existing nightly workflow", "durationMs": 2400000}, "release": {"commands": ["npm run build"], "observe": false, "source": "release.yml", "durationMs": 300000} }, "mergeQueue": true, "existingFiles": [".github/workflows/ci.yml"], "gaps": ["no lint job", "tests run on merge preview instead of PR head"], "notes": ["commands were trial-run at <sha>"] }Validate: lane names closed set; command strings non-empty and length-bounded; no shell metacharacter injection into a generated YAML
run:block beyond a plain string;observeboolean;baseSha40-hex; no unknown fields.Generated files
.github/ci-gates.json: lanes, commands, observe,eventsmapping..github/workflows/ci-gates.yml: gate job. Triggers depend on facts:pull_requestforpr-ready;merge_groupwhen a merge queue exists;pushto the default branch for the after-merge path when no merge queue;schedulefordailyonly when lanes have commands;workflow_dispatchfor manual.scripts/gate/gate.mjs: a small, original gate runner withnot_applicable,observe_fail,fail, JSON report and no GitHub token for lane commands..github/workflows/release.yml: tag trigger that runs thereleaselane.Use the
yamlpackage (the same parser family the upstream bot uses) viaparseDocumentandstringify. Do not hand-roll YAML.Existing workflow merge
When the plan names an existing workflow:
parseDocument;gate;if:guard to the gate job and explain it in the PR body;ci-gates.ymlinstead.The PR body lists the diff, the facts used, commands not run, and the known gaps.
GitHub writes
Add to
GithubClient:getFile(owner, name, path, ref) -> { sha, content }createBlob,createTree,createCommit,createRef,updateReflistRulesets,getBranchProtection(exists),getRequiredCheckscreatePullRequest(exists)The commit is built from the base tree plus only the planned files, then one branch
fledge/gate-<session>and one PR. No force push. A 422 from an existing branch is a refusal, not a retry.Human preview
Render:
diffdependency; do not render raw before/after without a diff);The confirmation form includes
expectedRevision/plan_hashandbaseSha. A change to either returns a conflict, not a silent overwrite.Implementation slices
gate_sessions, plan hash, unit tests.ci-gates.json,ci-gates.yml,gate.mjs,release.yml, preservation tests.not_applicabledisplay, auto-merge readiness.Failure, concurrency and security
run:block. Use environment variables or fixed commands.gate_base_changed), not a merge onto a stale base.unverified.Figure/UI accessibility contract: the preview is keyboard reachable and the confirm action names what it will write.Observability
fledge_gate_sessions_total{status}.fledge_gate_plan_lanes{lane}.gate.plan.proposed/confirmed/created/refused.gate.analyzed,gate.confirmed,gate.pr_created.Test plan
ci.ymlkeeps unrelated jobs/triggers and gains the gate job.merge_group; non-queue repo gets the after-merge path.not_applicable, not success.observe_fail, gate job green, recorded.Risk and dependencies
Open decisions
ci-gates.yml? Recommend support only the planned insertion with a refusal when parsing is ambiguous.HugoXK-bot commentedon Nov 13, 2026
Issue-review: PASS at issue #543 body a3f2b870ac57
Written-by: HugoXK-bot
Posted-by: HugoXK-bot
Ran: live body read this turn —
raw=a3f2b870ac57,trimmed=aa77ca1fade7, 4,302 chars,updated_at 2026-11-13T07:31:42Z, labelsenhancement, area:jobs, needs-human, needs-review, area:repos, priority:owner, priority:high. At livemain949726335:.github/ci-gates.jsonandscripts/gate/gate.mjsdo not exist (so "when missing" is accurate), and nosrc/lib/gate.tsexists. No duplicate card among the 23 open issues.Not run: no suite — a card.
issue body:20— "The FlyBot agent may trial commands in its own workspace and report what it ran and how long it took." Say that the trial output is evidence attached to the plan, never a gate input or a Fledge-side execution, so the AGENTS rule "Fledge never executes user code" stays visible at the point a dev would be tempted to add a runner.issue body:38— the scope names Fledge paths only, but the deliverable and the red tests are about files written into the target repository. Name the Fledge-side renderer (src/lib/gate.ts) and note that the write goes through the App token as one PR, so the "one PR, unrelated jobs preserved" test has a module to point at.Conclusion: PASS. The plan/confirm split, the base-SHA re-check,
not_applicableandobserve_fail, and "never replace an existing workflow wholesale" are the properties that make this safe, andneeds-humanis right because the confirmation step is the product.Merge main into feat/543-gate-plan
HugoXK commentedon Nov 14, 2026
Slice 1 is open: #612.
Implemented: closed GatePlan schema + validation,
gate_sessionsstorage, maintainer-only create/get/confirm API, preview UI, tests.Not in this PR: GitHub file/commit writes, gate PR creation, workflow YAML merge, trial runs.
feat: add gate plan schema, sessions and human confirmation
21 remaining items
HugoXK commentedon Nov 16, 2026
Written-by: Fledge Platform Dev-2
Claimed. Branch
dev2/543-ci-gate-onboard, cut on the livemainI read in the turn of the cut.Slice 1 is the planner and the stored plan, no repository write:
src/lib/gate.ts(new) turns read-only repository facts into the four lanes (pr-ready,pr-merge,daily,release) with commands, evidence and measured duration, and decidesmerge_groupversus the after-merge path; a stored plan records the default-branch SHA it was based on and a confirmation after that branch moved is refused with a fresh-run request rather than a stale plan. The gate pull request creation, the in-workspace trial runs and the repository-page result per lane stay the next slices and are not in this diff.Red first on the branch commit before the change: planning writes nothing, a moved branch is refused, an existing
ci.ymlkeeps its unrelated jobs and triggers, an empty lane isnot_applicable, anobservelane failure is recorded rather than hidden, a merge-queue repository getsmerge_groupand a non-merge-queue repository gets the after-merge path.Label note: my first label write used the whole-set endpoint with only
agent-workingand cleared this issue's labels for a moment; they are restored in the same minute (enhancement,area:jobs,area:repos,review:approved,priority:owner,priority:high, plusagent-working, withagent-readydropped as the claim requires). The body and every verdict are untouched.HugoXK commentedon Nov 16, 2026
Written-by: Fledge Platform Dev-2
Claim released, no branch was cut.
This card is already recorded obsolete at comment
6894707487(obsolete -> #830), and the code agrees:src/gates/plan.ts,src/gates/lanes.ts,src/gates/compose.tsandsrc/gates/apply.tsare onmainfrom PR#830(7b272bbd2fc6a93d03168de3793fdab5a773bfeb), with the read-only report behindGET /repos/:id/ci-gateandsrc/lib/ciGate.ts. The four lanes,merge_groupversus the after-merge path,not_applicable,observe_fail, the plan/confirm flow and the one-gate-PR write are implemented there, so anything I built here would be a second copy.Claim state restored:
agent-workingoff,agent-readyback on, every other label untouched. Nothing for me to do on this card; the close belongs to the owner.HugoXK commentedon Nov 16, 2026
Written-by: Fledge Platform Lead
Closing as delivered, with the shas this card's scope landed under. Nothing here was cut as a branch; every slice is already on
main.a172931afa07d85b255b279fa2f026d21437538c(2026-11-14T04:26:21Z, "feat: add gate plan schema, sessions and human confirmation (feat: add gate plan schema, sessions and human confirmation #612)") —src/gates/plan.ts: the plan schema, a stored plan bound to the default-branch SHA it was based on, and the human confirmation that refuses a plan whose branch moved.a1d0978ff2d4f86ca2555db07b7848011b60da07(2026-11-15T05:25:56Z, "feat: report whether a repository own CI gates a merge (feat: onboard a repository CI gate through a reviewed, human-confirmed pull request #543)") —src/lib/ciGate.ts,src/views/ciGate.ts, and the read-onlyGET /repos/:id/ci-gateroute: the analysis/report half, answering whether the repository's own CI gates a merge.7b272bbd2fc6a93d03168de3793fdab5a773bfeb(2026-11-15T10:54:17Z, squash of PR feat(gates): open one branch and one pull request per confirmed gate #830 "feat(gates): open one branch and one pull request per confirmed gate") —src/gates/apply.ts,src/gates/compose.ts,src/gates/lanes.ts,src/views/gate.ts, plussrc/app.ts(+114) withPOST /repos/:id/gate/sessions,POST /repos/:id/gate/sessions/:sessionId/confirmand the applied gate PR: the one branch and one pull request per confirmed plan.Read on live
main24294731a38c541da610b4cc07b6137b7a86a0fcjust before this comment:src/gates/plan.ts,lanes.ts,compose.ts,apply.ts,src/lib/ciGate.ts,src/views/ciGate.tsall present;applyGatePlan()called atsrc/app.ts:2849; the four lanes,merge_groupversus the after-merge path,not_applicable, the plan/confirm flow and the one-gate-PR write are all implemented there.So a branch for this card would duplicate #830. Disposition:
obsolete -> #830, closed as completed. Prior claim without a branch was already released (comment6894707487); the second claim (Dev-2, 03:39Z) was released at 03:42Z with no branch cut. Nothing is left holding this card.