Skip to content

Factory autonomy thin slice (AM1): an owner-approved feature map compiled to tickets, each feature built by a Build Thread the runner drives, inside an envelope; nothing merges - #163

Merged
sykosyber merged 4 commits into
syberlabs/factory-goal-gatefrom
syberlabs/autonomy-thin-slice
Nov 4, 2026
Merged

sykosyber merged 4 commits into
syberlabs/factory-goal-gatefrom
syberlabs/autonomy-thin-slice

Conversation

@sykosyber

Copy link
Copy Markdown
Member

Packet C4 autonomy-thin-slice (AM1) of the consolidation plan (reports/2026-11-01-syberfactory-consolidation.md §5), stacked on #154 (claude/factory-spacetime-v0, head 6dbd2f4). It realises the first slice of the autonomous typed mode on top of #154's ledger, spec and tickets rather than beside them. $0, offline, no network, no model call: every "model" is a stand-in command.

What is added (new files only; factory/cli.py takes one hook hunk at its very end)

File What it does
syberlabs/factory/featuremap.py feature-map.v1: the typed task DAG over #154's spec object (D2; spec_from_markdown turns a sectioned-Markdown spec into that object). mapcheck: schema, spec digest, coverage of every requirement, acyclic DAG, scope conflicts (an intersection must be declared with an order that agrees with the DAG), act class, size ceilings, hidden-check names (names only), owner-approval digest. taskgraph: critical path, total work, work/critical ratio, Dilworth width + maximum antichain, conflict graph. risk_plan: seven code-computed risk inputs, standardized scores, v_i = V·softmax(z_i/τ) as integer units above a floor (host checks, hidden checks, critic, gate) that is listed beside every allocation and never moves. compile_ticket: one feature → one ticket in ticket_from_spec's shape (D5), human_owner mandatory, rubric_digest over hidden-check names, map_ref for the why walk. degenerate_map: the map ticket_from_spec implies.
syberlabs/factory/policy.py FeaturePolicy seam: the five typed questions (next_feature, proposer_arm, budget_tier, after_failure, worth_continuing) over closed option sets code builds; validate refuses any answer outside them. OfflinePolicy (default: critical path first, cheapest arm/tier that fits, retry → stronger arm → owner, park when the cap is spent, stop on the envelope). ShadowPolicy: acts on one policy, records what an injected second one would have answered and whether it agrees; never acts on it. No jev_api import, no socket.
syberlabs/factory/loop.py The driver. compile refuses a map without a current human approval (map_unapproved), a spec not promoted, or any mapcheck finding; writes one contract per feature (scope = feature scope; checks = visible checks + the hidden checks the host holds under the ticket's names); logs map_frozen + ticket_opened{source: map}. run: kill switch → eligibility → three policy proposals recorded on the ledger → envelope reservation → one unattended Build Thread → one CommandProvider call → syberlabs run's Runner drives check/accept/recover (D17) → envelope settles from the journal → outcome recorded. EnvelopeLedger is the eval spend ledger's shape generalised to attempts (D13). why walks ticket → feature → map (approval) → spec. event_digests excludes volatile refs, so one fixture gives one digest list.
syberlabs/factory/autonomy_cli.py syberlabs factory autonomy check | approve | envelope | run | why, registered by extend() from the hook at the end of cli.py.
tests/test_factory_autonomy.py + tests/fixtures/autonomy/ 17 tests on a three-feature fixture over factory_app (F1 → F2 chain, F3 independent) with standin_proposer.py as the process boundary and hidden_checks.json as the host's catalogue.
docs/FACTORY_AUTONOMY.md What AM1 does and does not do, the glossary per the consolidation report, next packets C5/C6/C9/C10, limits.

Ledger events of the end-to-end test (in order)

map_frozen ticket_opened ticket_opened ticket_opened
policy_proposal(next_feature=F1) policy_proposal(proposer_arm) policy_proposal(budget_tier) envelope_reserved attempt_started thread_step(check→acceptable) thread_step(accept→succeeded) envelope_settled feature_ready
policy_proposal(next_feature=F3) … feature_ready
policy_proposal(next_feature=F2) … feature_ready
loop_stopped(nothing_eligible)

Order is critical-path-first (F1 has a dependent; F3 is size M; F2 last). Under integration: stack, F2's thread starts from F1's accepted commit; under await_merge F2 is recorded feature_waiting because only the owner's merge releases it. main never moves; the terminal state is an accepted candidate on syberlabs/<thread> plus feature_ready{refs: thread, commit, target_ref}.

Tests cover

map validates and the graph measures; cycle refused; undeclared scope conflict flagged (declared with an order is not a finding; an order contradicting the DAG is); coverage and unknown requirement; stale spec digest; stale approval after an edit; a model actor cannot approve; risk plan keeps the floor and sums to V, uniform at zero spread, τ below the minimum refused; ticket shape ⊇ ticket_from_spec's; offline rules; closed option sets; shadow disagreement recorded and an out-of-options shadow answer recorded not acted on; the end-to-end run; same fixture → same event digests; unapproved map refused with nothing logged; envelope (calls_total=2) stops the loop with F2 left open; await_merge leaves the dependent waiting; a failing candidate is refused by the kernel (candidate_check_failed:*) and parked; an out-of-scope candidate never reaches accept; kill switch stops before the first decision; the modules hold no merge or network call.

Verified

  • python -m unittest tests.test_factory_autonomy: 17 OK (Windows, Python 3.12.6).
  • python -m unittest tests.test_factory: 35 OK, including test_repository_layering_has_no_drift (the new modules import only primitives and build-thread, the edges docs/architecture.declared.json already declares for factory).
  • python -m conformance.run: 23 golden traces matched. python benchmarks/run_scenarios.py: 11 replayed, exit 0.
  • CLI smoke on a scratch copy: index → autonomy check → approve → envelope → run → why → status: 3 features ready, 33 ledger events, chain verified, main at the base commit.
  • Full suite on Actions scratch branch syberlabs/autonomy-thin-slice-ci (same commit); result in the thread.

Deliberately not in this slice

No publish, no draft PR, no merge (C9). No live Jev and no adapter: the shadow is an injected callable (AM4 later). No replay grade (replay arm, with the eval runner; C9/C10). No new ledger event kind: ledger.KINDS is owned by ledger.py and by the goal-gate packet editing it, so autonomy events are note{body.note ∈ loop.EVENTS} and tickets use the existing ticket_opened with source: map. No edit to spec.py, ledger.py, harness.py, static/factory.html or GAPS. Concurrency stays 1; the width and conflict graph are computed and logged for the c > 1 question. Risk weights and τ are priors; risk_plan logs the propensities calibration needs (E8, C10).

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T08:50:22.265582Z 61870d3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61870d32be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread syberlabs/factory/loop.py
Comment on lines +337 to +340
if item["depends_on"] and self.map["integration"] == "await_merge":
row["state"] = "waiting_owner_merge"
record(self.ledger, "feature_waiting", self.map_digest, {"feature": fid, "waits_for": list(item["depends_on"])})
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Make waiting features resumable after owner merge

With integration: await_merge (the default), a dependent feature is marked waiting_owner_merge as soon as its dependencies are only ready_for_owner_merge. Nothing checks for a later owner merge or makes that feature eligible again; a new run resets the in-memory state and rebuilds the dependencies instead. Thus maps with dependencies cannot progress past this state.

Useful? React with 👍 / 👎.

Comment thread syberlabs/factory/loop.py Outdated
reserved: dict[tuple, dict] = {}
settled: dict[tuple, dict] = {}
stopped = None
for line in self.lines():

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Scope spend totals to the current envelope

After a run writes a stop line, issuing a replacement envelope under the same --home cannot resume it: totals() reads every historical line without checking its envelope_digest, so the old stop reason remains set and Loop.run exits before making a decision. Previous spend is also charged against the new grant. Filter lines by the current envelope digest or give each grant its own ledger.

Useful? React with 👍 / 👎.

Comment thread syberlabs/factory/loop.py
def room(self, tier: str, calls: int = 1) -> bool:
totals = self.totals()
return (totals["stopped"] is None and totals["dollars_left"] >= self.envelope["dollars"]["tiers"][tier]
and totals["calls_left"] >= calls and totals["seconds_left"] > 0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enforce the remaining seconds as an attempt limit

If seconds_total is positive but less than the next provider call or check takes, this condition still permits the attempt; the reservation records zero seconds, and the provider and checks use their own timeouts. The loop can therefore exceed the granted seconds before it checks the envelope again. Bound the attempt by the remaining time or refuse it when it cannot fit.

Useful? React with 👍 / 👎.

Comment thread syberlabs/factory/loop.py
line = {"schema": ENVELOPE_LINE_SCHEMA, "envelope_digest": envelope_digest(self.envelope), **line}
with self.path.open("a", encoding="utf-8", newline="\n") as handle:
handle.write(canonical(line) + "\n")
handle.flush()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Sync the reservation before external work

If the machine or kernel fails after the provider call starts, flush() alone does not make this reservation durable. The external call may have happened while its hold is lost, allowing a restart to spend beyond the envelope. Sync the reservation before _attempt performs external I/O.

AGENTS.md reference: AGENTS.md:L202-L204

Useful? React with 👍 / 👎.

@sykosyber

Copy link
Copy Markdown
Member Author

Independent verification of #163 at 61870d3 (base 6dbd2f4, #154): pass with findings

Read-only claim check on a fresh anonymous clone, Windows 11, C:/Python312/python.exe (3.12). No merge, push, model or GitHits call. Everything the PR body claims was reproduced; the findings below are what the body does not say.

Reproduced

  • tests.test_factory_autonomy 17 OK (run twice; the printed ledger-event sequence is identical both times), tests.test_factory 35 OK incl. test_repository_layering_has_no_drift, conformance.run 23 matched, benchmarks/run_scenarios.py 11 replayed exit 0. gh pr checks 163: all 25 checks pass (3.11/3.12/3.13, windows, strict 3.12, admit, compose, policy, G2-G8).
  • Owner decisions by code: no merge/push/publish/urllib/http/requests/socket call in the four new modules (jev_api appears once, in a docstring, policy.py:143); OfflinePolicy is the default (autonomy_cli.py:141); ShadowPolicy.decide returns the acting answer unchanged (policy.py:152-166); approve() refuses a non-human actor (featuremap.py:153); compile() refuses map_unapproved before any ledger write, and an edit to any map field (base, integration, uncovered, id, a feature's scope or hidden checks) stales the approval; main stayed at the base commit in the e2e test and in my CLI smoke; the kernel's accept docstring says "Never pushes or merges" and the e2e target refs are refs/heads/syberlabs/<thread>.
  • Theory: risk_plan recomputed by hand on the fixture: r = {F1 .13, F2 .01, F3 .06}, z = {+1.287, -1.151, -0.136}, shares {.753, .066, .182}, budget 4 -> units {3, 0, 1} (largest remainder); τ < 0.05 refused; zero spread -> uniform units; FLOOR is a module tuple with no parameter that can shrink it. taskgraph by hand: critical path F1->F2 length 2, total work 4, ratio 2.0, width 2 (antichain {F2,F3} or {F1,F3}), bottom levels {F1 2, F2 1, F3 2} — all match. Note: the code applies softmax to standardized z, not raw r/τ as the theory report §5 writes; the report's own measurement (raw spread ≈ 0.14 makes unstandardized softmax uniform) motivates it and the docstring says so.
  • D17: _drive is Runner(kit, thread=id).once() in a loop (loop.py:476-490), no check/accept/recover logic re-implemented. D5: set(ticket_from_spec(...)) - set(compile_ticket(...)) == set() (test asserts it; confirmed). D2: spec_from_markdown calls specmod.new_spec; mapcheck binds spec_ref.spec_digest to specmod.spec_digest.
  • Layering: imports are syberlabs.{canonical,errors} (primitives), syberlabs.{build,providers} (build-thread, both in that declared node) and the factory package — the edges architecture.declared.json already declares.
  • Determinism: event_digests identical across two in-process runs (the test) and two fresh projects; the refs exclusion covers thread id, commit, base, target_ref and seconds.
  • CLI smoke on a scratch copy of the fixture: check (exit 0, prints graph and plan) -> run before approve refused -> approve -> envelope -> run -> 3 features ready_for_owner_merge, 3 calls, $0, 33 ledger events, status verified True, why walks ticket -> F1 -> map (approved_by mateo) -> spec digest, main unchanged.
  • "Deliberately not in this slice" is accurate for what it lists: note and ticket_opened are existing ledger.KINDS; envelope.concurrency is a constant 1 (loop.py:82); no replay arm; stacking uses the last dependency's commit only (loop.py:434).

Findings

Blocking for the planned merge order (not a defect of this PR alone)

  1. C1 interplay: textual merge clean, semantic break. origin/syberlabs/factory-goal-gate (3c3a3ee) and this head both merge onto 6dbd2f4 with zero conflicts (the cli.py end-of-file hook survives C1's 192-line cli.py rewrite). On the merged tree tests.test_factory passes (45) but tests.test_factory_autonomy fails 12 of 17 with spec_approval: promote needs the owner's verified approval (see factory approve); none given from spec.py:204 (C1) via tests/test_factory_autonomy.py:37 (promoted_spec calls transition(..., "promote", verdict_ids=[...]) with no approval envelope). The consolidation order is C1 -> C2 -> C4; this PR is built on Add the factory: Space-Time Parsing of a repository on one ledger (v0 slice) #154 directly. Whichever lands second must rebase: the fixture helper needs C1's signed owner approval, and Loop.compile (loop.py:283) should check the ledger's promotion record rather than the spec file's state string once C1 provides it (see 7).

Medium
2. retry_escalate_arm is recorded but never acted on. _after_failure sets the feature back to open (loop.py:504-506) and the next step asks proposer_arm over all arms (loop.py:401-402); OfflinePolicy always answers the cheapest (policy.py:108-111). Probe with two arms (cheap, strong) and a breaking proposer: decisions retry_same -> retry_escalate_arm -> park, but attempt_started.arm was cheap, cheap, cheap. The ledger therefore records a decision that did not happen. Untested because the fixture has one arm.
3. One envelope.jsonl per ledger home, read without regard to envelope_digest. ENVELOPE_FILE is fixed (loop.py:52,266) and totals() never filters by the line's envelope_digest (loop.py:136-147), while run() stops on any stop line (loop.py:389-391). Reproduced twice: a second map with its own envelope in the same home, and the CLI run twice in the same --home, both stop immediately with the previous run's reason (nothing_eligible) and inherit its spend (3 calls), building nothing (CLI exit 1). Fail-closed, but the recorded loop_stopped.reason is wrong and a factory home can only ever host one autonomy run.
4. Stacking leaves the working repository on syberfactory/<map>/<feature>. loop.py:435 runs git checkout -q -B ... <commit> in repo_root so Kit.start (which starts from HEAD, build.py:704) picks up the dependency's commit; nothing restores the previous branch. After the e2e run and the CLI smoke HEAD is syberfactory/order-markers.m1/F2. main is untouched, but the owner's checkout is moved, a dirty tree would be carried into the thread base or make the checkout fail (a Rejected/CalledProcessError here escapes run() — see 13), and the docs call this only a "limit".
5. EnvelopeLedger strictness is JSON-level only. Torn line, NaN/Infinity and repeated keys are refused (confirmed), but: settle() validates dollars only, so negative calls/seconds are appended and increase calls_left (loop.py:171-175; probe: calls_left 8 of a 3-call envelope); negative dollars in a file line are summed (dollars_left 6.0 of a $1 envelope); a line without kind raises KeyError instead of Rejected (loop.py:142); a duplicate reserve for the same (feature, attempt) silently overwrites (loop.py:143); a settle without a reserve is ignored. The loop itself never writes such lines, so this is a hand-edited or corrupted file case, but D13 cites #151's "refuses an unpriced ledger line" as the standard.

Low
6. A kill-switch path enters a digest. new_envelope stores kill_switch (loop.py:84) and map_frozen.body.envelope_digest digests the envelope (loop.py:307), so with a kill switch set, event_digests differ between two runs at index 0 (probed). The determinism test runs without a kill switch; the doc's "no path enters a digest" holds only then.
7. Approval and promotion are trusted records, not credentials. approval.digest covers the map, not the actor: swapping approval.actor.id leaves approved() True (featuremap.py:155,159-163). compile() trusts spec["state"] == "promoted" from the file (loop.py:283); a spec with its history wiped compiles (spec digest excludes history, spec.py:62-64). Same posture as #154; C1's signed approval_payload/gate is the seam, which is another reason for finding 1.
8. Scope-conflict detection does not normalise paths. path_intersects strips ./ but not case (featuremap.py:168-174); FXAPP/rules.py vs fxapp/rules.py is no finding on a case-insensitive filesystem, and scope.paths validation accepts ./x (featuremap.py:258). The kernel's own scope check at accept time is the backstop.
9. risk_plan(weights=...) is unvalidated: weights need not sum to 1 (probe: r up to 0.667, outside the documented [0,1]); unknown keys raise KeyError. Not reachable from the CLI.
10. The floor is listed, not enforced, by this slice. critic and safety_gate appear in every buys list, but only host and hidden checks are required in the compiled contract (loop.py:247); nothing runs a critic or gate. Consistent with "AM1 thin slice", but the doc's "every feature, never loosened" should say which two of the four are live.
11. Windows CLI quoting. split_command is non-POSIX on Windows and keeps quote characters in tokens (providers.py:83-85, pre-existing in #154): --check "tests=python -c \"import x\"" yields argv ['python','-c','"import x"']. The docs' --hidden "hidden.f1.marker=python -c ..." example and the fixture's hidden_checks.json cannot be passed from the Windows CLI; my smoke needed script files. Unix is unaffected.
12. argparse._SubParsersAction / parser._actions (autonomy_cli.py:33): private but unchanged since 3.2 and green on 3.11-3.13; the hook also merges cleanly with C1's cli.py. Fragile only under an argparse refactor; a public populate(..., extra=...) seam would be one line in cli.py when C1 lands.
13. A Rejected inside run() leaves no terminal event. policy_invalid (probed with a rogue policy), envelope_exhausted from reserve, or a Kit.start/checkout failure propagate out of run() through the finally (loop.py:384-411) without loop_stopped or an envelope stop; the hold stays unsettled (so it is counted — fail-closed), but the ledger ends mid-run.

Scope against C4 in the consolidation report (§5)

Beyond the four acknowledged omissions, the packet row asked for: envelope.py built on #150's spend-ledger code (D13 "build it once") — here the shape is re-implemented in loop.py; RecordedJevPolicy reusing jev_api's validator (D11) — recorded_answers + a new validate; decisions as observed{policy_decision} on the kernel journal followed by propose(origin="model") — here note events on the factory ledger and an untagged propose; factory why <pr|thread|ticket> — ticket only; fixture factory/fixtures/spec-slugify-pricing/ — tests/fixtures/autonomy/; OfflinePolicy "risk per unit of work first" — implemented as bottom level, then risk. Each is defensible for a thin slice; none is listed under "Deliberately not in this slice".

Verdict: the slice does what it says and nothing it must not; merge after rebasing onto C1 (finding 1) and, ideally, fixing 2-4.

sykosyber added a commit that referenced this pull request Nov 2, 2026
…motion record through C1's seam (the promote event, the approval it cites, the stored envelope, re-verified under --owner-public), retry_escalate_arm offers only the stronger arms so the recorded decision is the one that runs, one envelope ledger file per envelope digest so two maps or two grants in one home never share spend or a stop, stacking restores the owner's HEAD and refuses a dirty tree, the envelope ledger refuses negative or non-finite amounts, a kindless line, a second reserve and an orphan settle, a Rejected inside run() still writes the stop line and loop_stopped, the kill-switch path leaves the digest, scope paths compare case-folded without ./, risk_plan validates its weights, and the docs list the known limits and the deviations from C4 (#163 verification findings 1-10, 13)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sykosyber
sykosyber changed the base branch from claude/factory-spacetime-v0 to syberlabs/factory-goal-gate November 2, 2026 09:35
@sykosyber
sykosyber force-pushed the syberlabs/autonomy-thin-slice branch from 61870d3 to a08169c Compare November 2, 2026 09:36
sykosyber added a commit that referenced this pull request Nov 2, 2026
…motion record through C1's seam (the promote event, the approval it cites, the stored envelope, re-verified under --owner-public), retry_escalate_arm offers only the stronger arms so the recorded decision is the one that runs, one envelope ledger file per envelope digest so two maps or two grants in one home never share spend or a stop, stacking restores the owner's HEAD and refuses a dirty tree, the envelope ledger refuses negative or non-finite amounts, a kindless line, a second reserve and an orphan settle, a Rejected inside run() still writes the stop line and loop_stopped, the kill-switch path leaves the digest, scope paths compare case-folded without ./, risk_plan validates its weights, and the docs list the known limits and the deviations from C4 (#163 verification findings 1-10, 13)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sykosyber
sykosyber force-pushed the syberlabs/autonomy-thin-slice branch from a08169c to f9eaf2a Compare November 2, 2026 10:07
sykosyber and others added 3 commits November 2, 2026 02:59
…iled to tickets on the ledger, each feature built by a Build Thread the runner drives, inside an envelope; nothing merges

featuremap.py: feature-map.v1 over #154's spec object (sectioned Markdown -> spec; D2), mapcheck (schema, spec digest,
coverage, acyclic DAG, declared scope conflicts, act class, size, hidden-check names, approval digest), the task graph
(critical path, total work, work/critical ratio, Dilworth width, conflict graph), the risk plan (seven code-computed
inputs, standardized scores, v_i = V * softmax(z_i / tau) above a floor that never moves) and one feature -> one ticket
in ticket_from_spec's shape (D5). policy.py: FeaturePolicy with the five typed questions over closed option sets,
OfflinePolicy (critical path first, cheapest tier that fits, retry then stronger arm then owner, park when spent, stop
on the envelope) and ShadowPolicy (records what an injected second policy would answer; never acts on it). loop.py:
refuses an unapproved or stale map and an unpromoted spec, writes one contract per feature, drives each attempt with
`syberlabs run`'s Runner (D17), reserves and settles an envelope ledger shaped like the eval spend ledger (D13), and
records every proposal, step and outcome as ledger events whose digests exclude thread ids, commits and times.
autonomy_cli.py: `syberlabs factory autonomy check|approve|envelope|run|why`, hooked from one line at the end of
cli.py. 17 tests on a three-feature fixture over factory_app with a stand-in proposer command: tickets on the
ledger, F1 -> F3 -> F2 order, shadow disagreement recorded, envelope and kill switch stop the loop, await_merge
leaves a dependent waiting, a failing or out-of-scope candidate is refused by the kernel and parked, same fixture
gives the same event digests, no merge or network call in the modules. docs/FACTORY_AUTONOMY.md says what the slice
does and does not do, the glossary, and the next packets (C5, C6, C9, C10).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…motion record through C1's seam (the promote event, the approval it cites, the stored envelope, re-verified under --owner-public), retry_escalate_arm offers only the stronger arms so the recorded decision is the one that runs, one envelope ledger file per envelope digest so two maps or two grants in one home never share spend or a stop, stacking restores the owner's HEAD and refuses a dirty tree, the envelope ledger refuses negative or non-finite amounts, a kindless line, a second reserve and an orphan settle, a Rejected inside run() still writes the stop line and loop_stopped, the kill-switch path leaves the digest, scope paths compare case-folded without ./, risk_plan validates its weights, and the docs list the known limits and the deviations from C4 (#163 verification findings 1-10, 13)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…d re-verifies the promotion's approval under the owner key the ledger pinned before the approval event (owner_key_unset and owner_key_mismatch refuse), autonomy run takes no --owner-public, the fixture bootstraps the key with set_owner_key and promotes through gate() as the CLI does, and the docs pin the key with factory owner

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…: promotion_record reads the pinned key through the ledger's verified lineage with its stored rotations, a lineage that does not verify refuses owner_key_lineage, the fixture gates with the ledger's loader, and the docs say map compilation honours the lineage

Rebased onto syberlabs/factory-goal-gate at 9ff7573 (M3 of the #164 delta verification). The two
branches touch disjoint files except the end-of-file hook in factory/cli.py; no conflicts.

The adaptation #164's summary asked for: `loop.promotion_record` now calls
`specmod.pinned_owner_key(prefix, ledger.load_rotation)` so a rotated ledger's envelopes can be checked,
and `owner_key_lineage` propagates as the refusal instead of collapsing into `owner_key_unset`. The
historical-prefix read (events with seq below the approval event's) still picks the key pinned at the
time of the approval, so a later honest rotation does not unmake an earlier promotion. Because that
prefix cannot see a pin appended after the approval, the whole ledger's lineage is verified first
(`specmod.pinned_owner_key(events, ledger.load_rotation)`): a bare second `owner_key_set` appended with
the hash chain intact leaves the ledger pinning nothing, and `Loop.compile` refuses `owner_key_lineage`
rather than reading the earlier key.

Tests (26, was 25): `EndToEnd::test_compile_reads_the_owner_key_through_the_ledgers_lineage` promotes
a spec after an honest bootstrap -> rotation (approval signed by the second key) and compiles under the
second key, shows the same lineage is unreadable without the loader, then appends the M3 repro (a bare
`owner_key_set`) after an honest promotion on a second ledger: `compile` refuses `owner_key_lineage`,
appends nothing, writes no contract. The fixture's `promoted_spec` passes `load_rotation=home.load_rotation`
to `gate`, as the CLI does.

Docs: FACTORY_AUTONOMY.md states that map compilation honours the ledger's owner-key lineage.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sykosyber
sykosyber force-pushed the syberlabs/autonomy-thin-slice branch from f9eaf2a to ced0397 Compare November 2, 2026 11:10
@sykosyber

Copy link
Copy Markdown
Member Author

Final stack verification, B: #163 ced0397 on the final #164 head (afccabc, M4)

Verdict: pass. #163 works unchanged on top of M4; the trial merge #154 + #164 + #163 is conflict-free and its suites, conformance and benchmarks pass.

Fresh anonymous clone; heads confirmed with git ls-remote: #154 6dbd2f43db, #164 afccabc7e6, #163 ced03971ce. #163's merge base with #164 is 9ff7573 (M3) and afccabc is not an ancestor of ced0397, so #163's own CI never saw M4. Windows 11, CPython 3.12, throwaway keypairs only, no paid model or GitHits calls. Read-only: nothing merged, pushed or edited.

CI

  • gh pr checks 163 at ced0397: 25/25 pass, windows included. Both ci runs (41434705491, 41434723337) are attempt 1 with conclusion=success on head ced0397: no test_githits_pace flake, no re-run.
  • gh pr checks 164 at afccabc: 25/25 pass.

Trial merge

Worktree at 6dbd2f4 -> merge afccabc (clean) -> merge ced0397 (clean). No conflicts, not even at factory/cli.py's end-of-file hook (syberlabs/factory/cli.py:1034). On the merged tree:

  • tests.test_factory 51 OK (includes test_repository_layering_has_no_drift); tests.test_factory_autonomy 26 OK; test_critic test_journal test_package test_gaps test_checks 61 OK; python -m conformance.run 23 matched; python benchmarks/run_scenarios.py 11 replayed, exit 0.
  • The v1 rotation payload is transparent to Factory autonomy thin slice (AM1): an owner-approved feature map compiled to tickets, each feature built by a Build Thread the runner drives, inside an envelope; nothing merges #163: no file outside spec.py/ledger.py/test_factory.py calls rotation_payload or verify_rotation; loop.promotion_record uses spec.pinned_owner_key(events, ledger.load_rotation) (syberlabs/factory/loop.py:325-326), whose signature did not change, and its strict-prefix walk (seq < approval seq) keeps every rotation's head as the hash of the event right before it. The fixture rotates through set_owner_key, which signs the position itself.

#163's refusals, re-run on the merged tree (probe, own keypairs)

  • Unapproved map: map_unapproved, autonomy_events empty.
  • A bare owner_key_set appended after the approval (chain intact): compile refuses owner_key_lineage ("a bare pin does not re-root the ledger"); nothing appended, no contract written.
  • The M4 replay on the autonomy ledger (A -> B = S1, B -> A, promotion under A, append citing S1): promotion_record and compile both refuse owner_key_lineage ("rotation replayed; was already cited at seq 2"); nothing written.
  • Honest rotated ledgers compile: bootstrap -> rotation with the promotion under the second key (promotion["keyid"] is the second key), and A -> B -> A with the promotion under A (keyid is A).
  • Determinism: the e2e fixture run twice gives identical event_digests (32 events).

Pilot freeze

The whole stack (dc69499..ced0397) touches none of githits.py, query_guard.py, metrics.py, run_shards.py, session.py, settle.py. It does touch syberlabs/cli.py (:45 module-level from syberlabs.factory import cli as factory_cli; :329 factory_cli.add_parser; :336-337 dispatch). syberlabs/githits_cli_entry.py does not import syberlabs.cli, so the launcher path is unchanged; the syberlabs console entry now imports the factory package (stdlib and syberlabs modules only) at start-up.

GAPS renumber

On the merged tree test_gaps passes: 65 entries, 1..65 contiguous, the new 65. being #164's goal-gate entry (numbered against #154's base of 64). origin/main 8a5e21f already has 65 = #162 and #165 takes 66, so when #154 lands #164's entry becomes 67, and the three references in docs/FACTORY.md:127, :385, :387 (spec/GAPS.md 65) must move with it; nothing else in the stack cites the number (docs/FACTORY_AUTONOMY.md cites no GAPS entry). test_gaps only checks 1 <= n <= count, so a stale 65 would pass while pointing at #162's entry. git merge-tree origin/main <merged stack> (main at 9746980, #166) conflicts in spec/GAPS.md only.

Findings

None at medium or above.

Read-only verification; nothing merged or pushed, the PR body was not edited.

@sykosyber
sykosyber merged commit 7df2371 into syberlabs/factory-goal-gate Nov 4, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant