Skip to content

Experiment: deliver one feature through a T3 Workflow run with local state, publishing to GitHub only when ready #573

Backlog

Description

@eowca

Ask

Test, on one real loop-zero feature, whether coordination can run as a single T3 Workflow run that keeps fine-grained state in the local T3 database and publishes to GitHub only the large units (feature issue, milestone comments, a small PR stack at the end). Then hold a decision discussion with the owner on whether "loop-zero next" is built this way.

Requested by the owner on 2026-11-25. Related: #552.

Start condition

Do not start until every T3 Code instance used in the run is on 0.1.12 or later (the release that adds Workflows, typed turn results and stack auto-merge). On 2026-11-25 the main host ran 0.1.11 with Workflows off. Upgrading is a separate host action and is not authorized by this issue.

Hypotheses

  1. A workflow run needs less supervision than a coordinator thread, because the run holds the state and no session has to survive, hand over or rebind.
  2. Building locally and publishing once costs fewer CI runs, queue entries and GitHub calls per feature.
  3. A meaningful share of docs/DELEGATION.md (rollover, handoff, schedule rebinding, wait and wakeup rules) becomes code and could be deleted.

Constraints

  • loop-zero's CLI, contract, skills and gates do not change during the experiment. check, review, ready and merge stay the only delivery gates, and the review that gates each merge is a fresh formal review on the published head.
  • The workflow definition is a host file (~/.t3/workflows/), not loop-zero core. Attach its final text to this issue.
  • The architecture guide's "no new scheduler or ledger" statement stays in force until the discussion decides otherwise. This experiment is the evidence for that decision, not a reversal of it.
  • One host, one single-repository project. No multi-repository projects, no linked environments.
  • Unpublished code is pushed to origin as a branch without a PR after each local step, so no work lives on one disk only.
  • Heavy commands go through the host's heavy slot. No paid API calls beyond normal account use.
  • Time box: three working days from the first workflow start. Stop and report at the box or on a stop condition.

Steps

1. Baseline (first, before any workflow is written)

Objective: numbers to compare against, taken from recent ordinary deliveries.

Acceptance: a comment here with, for the last 10 merged loop-zero PRs: time from first commit to merge, CI runs and merge-queue entries per PR, changed lines per PR, and for the features they belonged to, the count of coordinator interventions that can be found in the record (stops, re-homes, manual resumes). State what could not be measured.

2. Compatibility probes on a disposable workflow

Objective: learn the engine's real behavior before trusting it with a feature, following docs/T3-UPSTREAM.md step 4.

Acceptance: a comment here recording the installed version and, for each probe, expected and observed result:

  • a plain step, an agent step with a typed return, and a question to the owner all complete;
  • a server restart in the middle of a run resumes without repeating a finished step;
  • a failed agent step pauses the run, and how that pause is noticed without a person watching;
  • starting twice with the same key creates one run;
  • an agent step that runs a loopzero command in a loopzero start worktree works under the intended runtime mode with no approval stall;
  • whether typed results are available to delegate_task children or only to launched threads.

Stop condition: any probe showing lost state or a repeated external effect ends the experiment at this step.

3. Pick the feature

Objective: one open loop-zero issue that splits into two to four PR-sized slices.

Acceptance: the issue is named here with its slices. It must not change review, readiness, merge authority, trust boundaries or sandboxing, so a failed experiment cannot damage the delivery gates.

4. Write the workflow

Objective: one workflow definition that takes the feature issue and runs:

  1. a planning agent returning the slices as typed data;
  2. per slice: an implementing agent in its own loopzero start worktree, loopzero check, a local review round, a branch push without a PR, and a short milestone comment on the feature issue;
  3. a publish stage that, per slice in order, runs loopzero pr, review, ready --wait and merge;
  4. a question to the owner only for a decision reserved to a person.

Acceptance: the definition loads, a dry run on a throwaway issue reaches the publish stage without publishing, and the definition text is attached here. Models and effort come from models.toml.

5. Run and measure

Objective: deliver the chosen feature through the workflow inside the time box.

Acceptance: a comment here with the same measures as the baseline, plus:

  • every human or agent intervention outside the workflow, with its cause;
  • behavior on each failure or restart that occurred;
  • PR sizes against the existing size caps, and any drift or conflict with main at publish time;
  • what the owner could see about progress while work was unpublished;
  • the sections of docs/DELEGATION.md the run made unnecessary, listed by heading with line counts.

Stop conditions: a duplicated external effect (PR, comment, merge), lost run state, or more interventions than the baseline feature needed.

6. Report and decision discussion

Objective: an owner decision on the direction.

Acceptance: a report on this issue that leads with the recommendation and separates measured facts from interpretation, followed by a discussion with the owner that settles:

  1. coordination layer: move to workflows, use workflows for periodic jobs only, or stay as is;
  2. publish unit: a stack of small PRs per feature, or one PR per feature;
  3. progress visibility: milestone comments on the feature issue, or the T3 Workflows page only;
  4. owner decisions: workflow questions in the app, or p0 issues as today;
  5. whether the architecture guide's boundary on schedulers and ledgers changes.

If the decision is to adopt, the next deliverable is a design document and an architecture guide update, filed as its own issue. This issue closes with the decision recorded in a comment.

Out of scope

Changing loop-zero code or documents, upgrading T3, moving periodic jobs (status run, session cleanup) to workflows, multi-repository projects and linked environments.

Activity

  1. added
    enhancement
    on Nov 25, 2026
  2. eowca commented on Nov 26, 2026

    @eowca
    ContributorAuthor

    Start condition checked on the sole host planned for this experiment. The active t3code.service ExecStart and the running process executable both resolve to ~/.t3/runtime/versions/0.1.12/t3. That executable reports t3 v0.1.12. From the builder session, t3 workflow list --json exited 1 with Workflows are off on this server. The version requirement is met. The running server needs Settings → Labs → Workflows enabled before this session can run the experiment. Stopped before baseline collection, feature selection, or workflow creation. No host settings were changed.

  3. eowca commented on Nov 26, 2026

    @eowca
    ContributorAuthor

    Start and scope amendment (Owner Decisions ruling, 26 Nov 2026 ~17:20Z, recorded by the Lean line)

    • Started 26 Nov 2026 ~17:22Z on Claude account a (claude-opus-5-5). Start condition: Marcin enabled T3 Labs > Workflows; the miki T3 server is 0.1.12. Steps 1 (baseline) and 2 (compatibility probes) run tonight.
    • Step 1 adds IntelFlo: pushes, CI runs and merge-queue entries per PR for IntelFlo's last 10 merged PRs, next to the loop-zero baseline.
    • Step 3: the feature must be a loop-zero workflow fix that IntelFlo uses, not an internal-only change.
    • Amendment: if every step-2 probe passes, a second workflow runs in parallel on IntelFlo outcome 3's backend gap. The order is: species + official symbol in the registry, then the source-grouped entity read, then the release label. The hand-off is agreed with the IntelFlo coordinator before it starts. The second workflow has the same constraints: loopzero start worktree only, heavy slot, branch pushed after each step, gates unchanged, three-working-day box.
    • Stop conditions are unchanged. Probe results will be posted here.
  4. eowca commented on Nov 26, 2026

    @eowca
    ContributorAuthor

    Amendment 2 (Owner Decisions ruling on Marcin's "start now", 26 Nov 2026 ~17:30Z, recorded by the Lean line)

    • The second workflow (IntelFlo outcome 3's backend gap: species + official symbol in the registry, then the source-grouped entity read, then the release label) no longer waits for the probes to pass. It started now on Claude account a, in parallel with the baseline, the probes and the loop-zero run.
    • The step-2 probes still run first. They are the stop condition for both runs. If a probe fails (lost state, a finished step repeated after a restart, a failed step nobody noticed, an approval stall), both runs stop, the result is posted here, and the outcome-3 slices go back to ordinary IntelFlo builders.
    • The outcome-3 backend slices now belong to the Lean line. OD has told the IntelFlo coordinator.
    • Constraints are unchanged: loopzero start worktree only (never the live IntelFlo checkout), heavy slot, branch pushed after each step, gates unchanged, three-working-day box. The risk is only wasted Claude-a time.
  5. eowca commented on Nov 26, 2026

    @eowca
    ContributorAuthor

    Second workflow (IntelFlo outcome 3 backend gap) started — Lean line, Claude account a.

    • Definition: ~/.t3/workflows/outcome3-backend.ts (workflow outcome3-backend v1), text below. It will be re-attached in final form at the end.
    • Dry run o3-dry-1 (run 9929da94…), 17:26:59Z–~17:31Z: completed all 27 pre-publish steps (probe gate, typed plan, issue/claim/build/local review/push/milestone per slice) and returned reachedPublish: true without publishing. Cheap model, no edits, no issues, no pushes.
    • Live run o3-live-1 (run a585b049…) started 2026-11-26T17:30:10Z. Time box: three working days from then.
    • Coordinator handoff: no IntelFlo issues existed for the three slices; the run files one issue per slice under outcome 3 (#14237 order) and posts milestones there. Slice 1 is re-scoped by the planning step against prior merged work (#12517/#12520, #13046, #14029 "stop choosing species").
    • Shared stop condition: before every slice and every publish, the run reads this issue's comments after its start. A comment containing W573-STOP (or a failed probe written with uppercase FAIL/FAILED) stops it at that boundary. I also check by hand at each boundary.
    • Agents: plan gpt-6.2-astra low, build/repair/publish gpt-6.2-sol high (IntelFlo models.toml, Codex account c2), local review Claude Opus 5.5 (other family; not a gate). All in the intelflo-workers T3 project, bound to loopzero start worktrees; never the live checkout.
    outcome3-backend.ts (v1)
    // loop-zero #573, second workflow (OD amendment 2, 2026-11-26): IntelFlo outcome 3 backend gap.
    // Slices in order: species + official symbol in the entity registry, source-grouped entity read,
    // release label. Owner of this file: the Lean line's outcome-3 run (Claude account a).
    //
    // Shape: plan (typed slices) -> file one issue per slice -> per slice: loopzero start worktree,
    // build + loopzero check (heavy slot), local cross-family review, repair, push branch (no PR),
    // milestone comment -> publish per slice in order: loopzero pr, review, ready --wait, merge --wait.
    // Gates are unchanged; this file only sequences them. Never touches /home/marcin/dev/intelflo.
    import { execFile } from "node:child_process";
    import { appendFile, readFile, writeFile, access } from "node:fs/promises";
    
    const { workflow, step, agent, ask, stop, title, tags } = T3;
    
    const REPO = "feder-positronics/intelflo";
    const WORKERS = "/home/marcin/.cache/intelflo-scratch/workers/repo";
    const PROJECT = "mcp:29010971-bb80-4b99-966c-4638c0c01afa"; // intelflo-workers T3 project (WORKERS)
    const STATE = "/home/marcin/.cache/lz-logs/lean178";
    const LOG = `${STATE}/w573-outcome3-effects.log`;
    const SLOT = "/home/marcin/.cache/intelflo-scratch/locks/heavy-slot.sh";
    const MOCKUPS = "/home/marcin/.cache/intelflo-scratch/coordinator-gen/v556/mockups/outcome3";
    const HANDOFF = "/home/marcin/.cache/intelflo-scratch/coordinator-gen/v557/outcome3-backend-handoff-573.md";
    const POLICY = "/home/marcin/.cache/intelflo-scratch/coordinator-gen/brief-policy-478.md";
    
    // IntelFlo models.toml: planning = deep, implementation/review_repair = standard. Codex account c2.
    const DEEP = { instanceId: "codex-c2", model: "gpt-6.2-astra", options: [{ id: "reasoningEffort", value: "low" }] };
    const STANDARD = { instanceId: "codex-c2", model: "gpt-6.2-sol", options: [{ id: "reasoningEffort", value: "high" }] };
    const FAST = { instanceId: "codex-c2", model: "gpt-6-luna", options: [{ id: "reasoningEffort", value: "xhigh" }] };
    // Local (non-gating) review from the other family.
    const REVIEWER = { instanceId: "claudeAgent", model: "claude-opus-5-5", options: [{ id: "effort", value: "high" }] };
    
    type Sh = { code: number; out: string };
    const sh = (cmd: string, args: string[], cwd = WORKERS, timeoutMs = 600_000): Promise<Sh> =>
      new Promise((resolve) => {
        execFile(cmd, args, { cwd, timeout: timeoutMs, maxBuffer: 8 << 20 }, (error, stdout, stderr) => {
          const code = error ? (typeof (error as any).code === "number" ? (error as any).code : 1) : 0;
          resolve({ code, out: `${stdout}${stderr}`.slice(-4000) });
        });
      });
    const exists = (p: string) => access(p).then(() => true, () => false);
    const note = (line: string) => appendFile(LOG, `${new Date().toISOString()} ${line}\n`);
    
    const Payload = Schema.Struct({
      parentIssue: Schema.Number, // IntelFlo issue holding outcome 3 (#14237)
      dryRun: Schema.Boolean, // true: no issues, comments, pushes or publish; cheap model; local-only worktrees
      startedAt: Schema.String, // ISO time; #573 comments after it are checked for a stop marker
    });
    
    const Slice = Schema.Struct({
      slug: Schema.String, // kebab-case, becomes lz/<slug>
      title: Schema.String,
      body: Schema.String, // full issue body: context, acceptance, non-goals, OpenAPI fields
      action: Schema.Literals(["build", "skip"]),
      reason: Schema.String,
    });
    const Plan = Schema.Struct({ slices: Schema.Array(Slice), ownerQuestion: Schema.String });
    
    const Build = Schema.Struct({
      head: Schema.String,
      checkGreen: Schema.Boolean,
      checkReceipt: Schema.String, // where the green check is recorded, or why not green
      nonTestLines: Schema.Number,
      pushed: Schema.Boolean,
      summary: Schema.String,
      blocker: Schema.String, // empty when none
    });
    const Review = Schema.Struct({
      blocking: Schema.Array(Schema.Struct({ file: Schema.String, summary: Schema.String })),
      nits: Schema.Number,
      verdict: Schema.String,
    });
    const Published = Schema.Struct({
      pr: Schema.Number,
      prUrl: Schema.String,
      merged: Schema.Boolean,
      mergeSha: Schema.String,
      reviewRounds: Schema.Number,
      checkRuns: Schema.Number,
      rebased: Schema.Boolean,
      blocker: Schema.String,
    });
    
    // Stop condition shared with the #573 probes: a comment on #573 after the start carrying the
    // marker W573-STOP, or one reporting a failed probe, ends this run before the next slice step.
    const probeGate = (name: string, startedAt: string) =>
      step(name, { returns: Schema.String }, Effect.promise(async () => {
        const r = await sh("gh", ["api", "repos/feder-positronics/loop-zero/issues/573/comments?per_page=100",
          "--jq", `[.[] | select(.created_at > "${startedAt}") | .body] | join("\\n=====\\n")`]);
        if (r.code !== 0) return `gate unreadable (${r.out.slice(0, 200)}); continuing`;
        const hit = /W573-STOP|probe[^\n]{0,80}\bFAIL(ED)?\b|\bFAILED\b[^\n]{0,80}probe/.test(r.out);
        return hit ? "STOP" : "clear";
      })).pipe(Effect.flatMap((g) => (g === "STOP" ? stop(`#573 stop marker or failed probe seen at ${name}`) : Effect.succeed(g))));
    
    const fileIssue = (s: typeof Slice.Type, parent: number, dryRun: boolean) =>
      step(`issue/${s.slug}`, { returns: Schema.Number }, Effect.promise(async () => {
        if (dryRun) return 0;
        const marker = `${STATE}/w573-o3-issue-${s.slug}.json`;
        if (await exists(marker)) return JSON.parse(await readFile(marker, "utf8")).number as number;
        const body = `${s.body}\n\nParent: outcome 3 on #${parent}. Delivered by the loop-zero #573 outcome-3 workflow run (Lean line).\n<!-- w573-outcome3:${s.slug} -->`;
        const r = await sh("gh", ["api", `repos/${REPO}/issues`, "-f", `title=${s.title}`, "-f", `body=${body}`, "--jq", ".number"]);
        if (r.code !== 0) throw new Error(`issue create failed: ${r.out.slice(0, 300)}`);
        const number = Number(r.out.trim());
        await writeFile(marker, JSON.stringify({ number, slug: s.slug }));
        await note(`issue ${s.slug} #${number}`);
        return number;
      }));
    
    const comment = (name: string, issue: number, body: string, dryRun: boolean) =>
      step(name, { returns: Schema.String }, Effect.promise(async () => {
        const marker = `${STATE}/w573-o3-comment-${name.replace(/\//g, "_")}.done`;
        if (dryRun || issue === 0) return "skipped (dry run)";
        if (await exists(marker)) return "already posted";
        const r = await sh("gh", ["api", `repos/${REPO}/issues/${issue}/comments`, "-f", `body=${body}`, "--jq", ".html_url"]);
        if (r.code !== 0) throw new Error(`comment failed: ${r.out.slice(0, 300)}`);
        await writeFile(marker, r.out.trim());
        await note(`comment ${name} ${r.out.trim()}`);
        return r.out.trim();
      }));
    
    const startWorktree = (slug: string) =>
      step(`start/${slug}`, { returns: Schema.String }, Effect.promise(async () => {
        const wt = `${WORKERS}/.worktrees/${slug}`;
        if (await exists(`${wt}/.loopzero/task.md`)) return wt;
        const f = await sh("git", ["fetch", "origin"]);
        if (f.code !== 0) throw new Error(`fetch failed: ${f.out.slice(0, 300)}`);
        const r = await sh("loopzero", ["start", slug]);
        if (r.code !== 0 || !(await exists(wt))) throw new Error(`loopzero start failed: ${r.out.slice(0, 500)}`);
        await note(`start ${slug} ${wt}`);
        return wt;
      }));
    
    const remoteHead = (slug: string, head: string, dryRun: boolean) =>
      step(`pushed/${slug}`, { returns: Schema.String }, Effect.promise(async () => {
        if (dryRun) return "dry run: not pushed";
        const r = await sh("git", ["ls-remote", "origin", `refs/heads/lz/${slug}`]);
        const remote = r.out.split(/\s+/)[0] ?? "";
        if (!head || !remote.startsWith(head.slice(0, 12))) throw new Error(`origin lz/${slug} is ${remote || "missing"}, agent reported ${head}`);
        return remote;
      }));
    
    const buildBrief = (s: typeof Slice.Type, issue: number, wt: string, dryRun: boolean) => dryRun
      ? `DRY RUN of a workflow. Do not edit, commit or push. Run only \`pwd\` and \`git -C ${wt} rev-parse HEAD\`. Submit head = that SHA, checkGreen=false, checkReceipt="dry run", nonTestLines=0, pushed=false, summary="dry run", blocker="".`
      : `You implement one IntelFlo slice inside a loop-zero workflow run (loop-zero #573). Read ${POLICY} first and follow it, except that you do NOT open a PR: this run publishes later.
    
    Worktree (already created by \`loopzero start ${s.slug}\`, branch lz/${s.slug}): ${wt}
    Your FIRST command: cd ${wt}. Work only there. Never cd into, read from, run in, fetch or edit /home/marcin/dev/intelflo (live production runner).
    Issue: ${issue ? `https://github.com/${REPO}/issues/${issue}` : "(dry run)"}. Its text:
    ---
    ${s.body}
    ---
    Context: coordinator handoff ${HANDOFF}; mockups ${MOCKUPS} (README line 7 is the production gap). OpenAPI-first: change the contract, regenerate, then implement. Keep the slice <= 400 non-test lines. If it adds a migration, set down_revision to the single alembic head on origin/main and say so in the summary.
    
    Steps: implement with behavior tests; run touched tests; then the full gate through the heavy slot exactly as: \`${SLOT} loopzero check\` (never run it unslotted; do not rerun at a head that already has a green receipt). Commit with a clear message ending in one trailer paragraph: "Co-authored-by: Codex <codex@openai.com>". Push: \`git push -u origin lz/${s.slug}\`. Do not run loopzero pr, review, ready or merge. GitHub via \`gh api\` REST only. Cap shell output you read at 2,000 characters. No rm -f / rm -rf.
    
    Submit: head (pushed SHA), checkGreen, checkReceipt (receipt path or the failing stage), nonTestLines (git diff --numstat origin/main...HEAD excluding tests), pushed, summary (what changed, field names chosen), blocker (empty unless you cannot finish; then the exact reason).`;
    
    const reviewBrief = (s: typeof Slice.Type, issue: number, wt: string, dryRun: boolean) => dryRun
      ? `DRY RUN of a workflow. Do not edit anything. Submit blocking=[], nits=0, verdict="dry run".`
      : `Local pre-publish review (not the formal gate) of IntelFlo branch lz/${s.slug} in ${wt}. Read-only: do not edit, commit or push. Your first command: cd ${wt}. Never touch /home/marcin/dev/intelflo.
    Review \`git diff origin/main...HEAD\` against the issue acceptance below and the repository's AGENTS.md. Report only defects that would fail acceptance, break callers, lose data, or break the OpenAPI contract; count style nits without listing them.
    Issue ${issue ? `#${issue}` : "(dry run)"}:
    ---
    ${s.body}
    ---
    Submit blocking (file + one-sentence defect each; empty if none), nits (count), verdict (one sentence).`;
    
    const publishBrief = (s: typeof Slice.Type, issue: number, wt: string) =>
      `Publish IntelFlo slice lz/${s.slug} (issue #${issue}) through the unchanged loop-zero gates. Your first command: cd ${wt}. Never touch /home/marcin/dev/intelflo. Read ${POLICY}.
    1. git fetch origin. If origin/main has moved, merge or rebase onto it, resolve conflicts, rerun the gate via \`${SLOT} loopzero check\` and push. If an alembic migration is in the diff, compare its down_revision with alembic heads on origin/main and open migration PRs first.
    2. \`loopzero pr\` (link the issue with "Closes #${issue}" in the body if loopzero does not).
    3. \`loopzero review\` on the published head. If it refuses Codex with "instruction channel requires re-verification", rerun as \`PATH=$HOME/.local/lib/codex-reviewer:$PATH loopzero review\` and say so in blocker-free summary. Fix blocking findings, push, review again on the new head (max 3 rounds).
    4. \`loopzero ready --wait\`, then \`loopzero merge --wait\` from ${wt}. Infra/flake failures: one retry, then report.
    GitHub via \`gh api\` REST only (never gh pr view/checks/list). Cap shell output at 2,000 chars. No rm -f / rm -rf. No paid hosted CI routes.
    Submit pr, prUrl, merged, mergeSha (empty if not merged), reviewRounds, checkRuns (loopzero check runs you started), rebased, blocker (empty unless not merged; then the exact reason).`;
    
    export default workflow(
      "outcome3-backend",
      { version: 1, payload: Payload },
      Effect.fn(function* (input) {
        const dry = input.dryRun;
        const model = (m: typeof STANDARD) => (dry ? FAST : m);
        yield* title(`IntelFlo outcome 3 backend${dry ? " (dry run)" : ""}`);
        yield* tags(["w573", "outcome3", dry ? "dry-run" : "live"]);
        yield* probeGate("gate/plan", input.startedAt);
    
        const plan = yield* agent("plan", {
          project: PROJECT,
          model: model(DEEP),
          runtimeMode: "auto",
          title: "outcome3: plan slices",
          timeout: "90 minutes",
          returns: Plan,
          brief: dry
            ? `DRY RUN of a workflow. Do not run commands or edit. Submit slices = three entries with slugs "w573dry-o3-registry", "w573dry-o3-source-read", "w573dry-o3-release-label", title "dry", body "dry", action "build", reason "dry"; ownerQuestion "".`
            : `Plan IntelFlo outcome 3's three backend slices for a workflow run. Read-only: do not edit, commit or push; never cd into or read /home/marcin/dev/intelflo (live runner). Work from ${WORKERS} (read origin/main with git show/grep) and \`gh api\` REST (cap output at 2,000 chars).
    Read in full: ${HANDOFF}; ${MOCKUPS}/01-same-name-entity-rows.README.md, 02-entity-source-feed-journey.README.md, 03-browse-slow-read-and-data-release.README.md; IntelFlo issues #${input.parentIssue} (outcome order), #12376, #11962, #10880, #11343, #11344, #11346; prior merged work #12517 (PR #12520), #13046 (PR #13051), #14029 (PR #14035).
    Order is fixed: (1) species + official symbol in the entity registry, (2) the source-grouped entity read, (3) the release label. For slice 1, first establish from origin/main code what #12520/#13051/#14035 already store and expose; shrink slice 1 to the real remaining gap and make sure it does not contradict #14029 ("link to the cross-species gene group, stop choosing species"). If a slice is already fully delivered, mark it action "skip" with evidence.
    For each slice return: slug (kebab, prefix "o3-"), title (imperative, plain English), body (markdown issue body: Context with origin issues, Acceptance as observable checks, OpenAPI field names you choose, Non-goals, Paths likely touched, Size <= 400 non-test lines), action, reason. ownerQuestion: empty unless a decision is reserved to the owner (auth, public API breakage, destructive migration); then the question.`,
        });
    
        if (plan.value.ownerQuestion.trim() !== "") {
          const a = yield* ask("owner-plan", {
            title: `outcome 3 plan needs an owner decision: ${plan.value.ownerQuestion}`.slice(0, 300),
            choices: ["proceed as planned", { value: "stop", requireReason: true }],
            timeout: "24 hours",
          });
          if (a._tag === "Some" && a.value.choice === "stop") return yield* stop(`owner stopped at plan: ${a.value.reason ?? ""}`);
        }
    
        const done: Array<{ slice: typeof Slice.Type; issue: number; wt: string; head: string; thread: unknown }> = [];
        for (const s of plan.value.slices) {
          if (s.action === "skip") continue;
          yield* probeGate(`gate/${s.slug}`, input.startedAt);
          const issue = yield* fileIssue(s, input.parentIssue, dry);
          const wt = yield* startWorktree(s.slug);
          yield* comment(`claim/${s.slug}`, issue, `Claimed by the loop-zero #573 outcome-3 workflow run (Lean line). Worktree branch \`lz/${s.slug}\`; builds locally, pushes the branch, publishes after all slices are built.`, dry);
    
          let built = yield* agent(`build/${s.slug}`, {
            project: PROJECT,
            workspace: { type: "existing_worktree", worktreePath: wt },
            runtimeMode: "full-access",
            model: model(STANDARD),
            title: `outcome3 build: ${s.slug}`,
            timeout: "6 hours",
            returns: Build,
            brief: buildBrief(s, issue, wt, dry),
          });
          for (let round = 1; round <= 2; round++) {
            if (built.value.blocker.trim() !== "") break;
            const review = yield* agent(`review/${s.slug}/${round}`, {
              project: PROJECT,
              workspace: { type: "existing_worktree", worktreePath: wt },
              runtimeMode: "auto",
              model: dry ? FAST : REVIEWER,
              title: `outcome3 local review ${round}: ${s.slug}`,
              timeout: "90 minutes",
              returns: Review,
              brief: reviewBrief(s, issue, wt, dry),
            });
            if (review.value.blocking.length === 0) break;
            built = yield* agent(`repair/${s.slug}/${round}`, {
              thread: built.thread,
              timeout: "4 hours",
              returns: Build,
              brief: `Local review found blocking defects. Fix each (or explain in summary why it is wrong), rerun touched tests and \`${SLOT} loopzero check\`, commit, push, and submit the same result shape.\n${review.value.blocking.map((b) => `- ${b.file}: ${b.summary}`).join("\n")}`,
            });
          }
          if (built.value.blocker.trim() !== "") {
            yield* comment(`blocked/${s.slug}`, issue, `Workflow builder blocked: ${built.value.blocker}`, dry);
            return yield* stop(`slice ${s.slug} blocked: ${built.value.blocker}`);
          }
          if (!dry && !built.value.checkGreen) return yield* stop(`slice ${s.slug}: loopzero check not green: ${built.value.checkReceipt}`);
          yield* remoteHead(s.slug, built.value.head, dry);
          yield* comment(`built/${s.slug}`, issue, `Milestone: built and pushed \`lz/${s.slug}\` at ${built.value.head} (no PR yet). loopzero check green (${built.value.checkReceipt}); ${built.value.nonTestLines} non-test lines; local cross-family review clean. ${built.value.summary}`, dry);
          done.push({ slice: s, issue, wt, head: built.value.head, thread: built.thread });
        }
    
        if (dry) return { dryRun: true, reachedPublish: true, slices: done.map((d) => ({ slug: d.slice.slug, head: d.head })) };
    
        const published: Array<typeof Published.Type & { slug: string }> = [];
        for (const d of done) {
          yield* probeGate(`gate/publish/${d.slice.slug}`, input.startedAt);
          const p = yield* agent(`publish/${d.slice.slug}`, {
            project: PROJECT,
            workspace: { type: "existing_worktree", worktreePath: d.wt },
            runtimeMode: "full-access",
            model: STANDARD,
            title: `outcome3 publish: ${d.slice.slug}`,
            timeout: "10 hours",
            returns: Published,
            brief: publishBrief(d.slice, d.issue, d.wt),
          });
          if (!p.value.merged) {
            yield* comment(`publish-blocked/${d.slice.slug}`, d.issue, `Publish blocked: ${p.value.blocker} (PR ${p.value.prUrl || "none"})`, false);
            return yield* stop(`publish ${d.slice.slug} not merged: ${p.value.blocker}`);
          }
          yield* comment(`merged/${d.slice.slug}`, d.issue, `Milestone: merged ${p.value.prUrl} as ${p.value.mergeSha} (${p.value.reviewRounds} formal review round(s), ${p.value.checkRuns} check run(s)${p.value.rebased ? ", rebased on main" : ""}).`, false);
          published.push({ ...p.value, slug: d.slice.slug });
        }
        return { dryRun: false, published };
      }),
    );
  6. eowca commented on Nov 26, 2026

    @eowca
    ContributorAuthor

    Step 1 baseline (26 Nov 2026, ~17:25Z, GitHub REST only). Last 10 merged PRs per repository. Raw rows: ~/.cache/lz-logs/lean178/w573-baseline-{lz,if}.json on miki (script w573-baseline.py).

    Measure (median; range; total) loop-zero (#1788–#1974) IntelFlo (#14626–#14676)
    First commit → merge 0.35 h (0.14–5.21 h) 0.85 h (0.37–8.04 h)
    Pushes that ran CI (distinct PR-event head SHAs) 2 (1–3; 20) 1.5 (1–2; 15)
    Workflow runs on the PR branch 13 (9–19; 136) 30.5 (23–47; 319)
    Workflow runs on Mergify queue drafts 9 (0–10; 72) 32 (27–60; 365)
    All CI workflow runs per PR 21.5 (14–28; 208) 61 (50–107; 684)
    Mergify queue entries 1 (1–1; 10) 1 (1–2; 12)
    Changed lines (additions + deletions) 70.5 (2–296; 779) 72.5 (4–676; 1,565)

    Reading (my interpretation): IntelFlo is where the payoff lies. A PR there costs about 61 workflow runs, roughly half on the queue candidate. Two of 10 IntelFlo PRs entered the queue twice (#14654, #14663), and each re-entry adds about 30 runs. On loop-zero, 4 of the 10 PRs are slices of one feature (#575: #1953, #1961, #1963, #1964). Each slice paid its own ~21 runs and queue entry, so publishing that feature as one unit or a stack is what step 5 should compare against.

    Coordinator interventions: only a keyword proxy. I counted non-bot comments on the PR and on its linked issue (from the branch name) that match stop/re-home/handover/resume/adopt/restart/stall. loop-zero: feature #575 9 of 38, #537 4 of 7, #1388 1 of 6, the rest 0. IntelFlo: #12799 6 of 26, #13224 2 of 21, #14661 1 of 5, the rest 0. These are upper bounds: a match is often a status line, not an intervention.

    Could not be measured:

    • Real intervention counts. That needs T3 thread history (statev2.sqlite), which was not mined.
    • Pushes that ran no CI, and force-pushes before the PR opened.
    • Work before the first commit, so time-to-merge understates the real lead time.
    • Rebases reset commit dates.
    • Queue entries that needed no draft (an in-place candidate) are counted from @mergifyio queue commands, not from Mergify events.
    • Blacksmith versus self-hosted cost per run.
    • 6 of 10 IntelFlo PRs have no issue number in the branch, so they have no feature linkage.
  7. eowca commented on Nov 26, 2026

    @eowca
    ContributorAuthor

    Step 2 compatibility probes (26 Nov 2026, 17:23–17:29Z). Version: miki t3code.service runs ~/.t3/runtime/versions/0.1.12/t3, and t3 --version reports v0.1.12. Workflows are on (workflowsEnabled: true). Single host. Disposable definition: ~/.t3/workflows/w573-probe.ts. Each plain step appends one line to ~/.cache/lz-logs/lean178/w573-effects.log, so a repeated external effect would show up as a duplicate line. No probe showed lost state or a repeated effect, so the stop condition did not trigger.

    Probe Expected Observed Result
    Plain step, agent step with typed return, owner question All complete Run f5d500b0: plain done; agent (Codex gpt-6-luna, models.toml fast) returned {answer: 42, word: "ok"} through the output schema; ask listed by t3 workflow questions and answered with t3 workflow signal (recorded answeredBy = the answering thread; answered by this agent, not by Marcin). Then the run paused because my definition returned a non-JSON object. I fixed the file and ran t3 workflow resume; the run completed. PASS
    Restart in the middle of a run, no repeated finished step Resumes; finished steps not rerun Main service not restarted: it hosts every T3 thread on miki, this one included. A safe window is needed. Run instead on a disposable second server (same 0.1.12 binary, own --base-dir, own user unit, port 35997): (a) restart during a 3-minute sleep → 8f5b2d46 completed, before-restart written once; (b) restart during an in-flight agent turn (its sleep 60 was killed) → ee1b2f02 completed on the same thread, attempt 1, 64 s later; before-agent written once. PASS on disposable server; main-service run pending a window
    Failed agent step pauses; how it is noticed Run pauses with reason c708714c: agent exceeded its 90 s timeout → run paused, detail "the agent's turn was stopped: it was not done after 1m 30s". t3 workflow resume after the fix condition → attempt 2 in a new thread, completed; before-fail written once. Noticing: nothing pushes to any agent thread. The engine emits a workflow.run_paused milestone event, available to MCP event subscribers and event webhooks but hidden from threads, and nothing on miki subscribes to it today. An unattended poll of t3 workflow list --json (status paused) found it. Step 4 needs a watcher (poll or event webhook). PASS (needs watcher)
    Same key twice → one run One run Second t3 workflow start --key w573-p1-a with different input returned the same run id f5d500b0; one effect line. PASS
    Agent runs loopzero in a loopzero start worktree, no approval stall Runs unattended Bound with workspace: {type: "existing_worktree"} to loopzero start w573-probe-scratch. full-access: pwd, branch and loopzero status ran with output identical to a direct run; exit 1 = GitHub REST core quota at 0 at that moment, same as the direct run. auto: Codex's sandbox made loopzero status die with a Python traceback. Neither mode stalled for approval. Intended mode for loopzero steps: full-access. PASS (full-access)
    Typed results: delegate_task children or launched threads only? — In 0.1.12, delegate_task has no output-schema parameter. t3_thread_launch, t3_thread_send and workflow agent() steps take one; the agent answers with t3_submit_output. Typed results are therefore available to launched threads and workflow steps, not to delegate_task children. Observed

    Other findings for step 4:

    • Definitions are .ts files that Node imports directly, with no sandbox, so a step can do any I/O.
    • The value ask returns to the script did not carry .choice in my test (the field came back undefined), although the stored step result has it.
    • A resumed agent step starts a new thread.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions