Skip to content

fix: bind fork sync guard to the actual PR candidate - #215

Closed
mindfn wants to merge 216 commits into
develop_basefrom
fix/fork-verdict-publish-classification
Closed

mindfn wants to merge 216 commits into
develop_basefrom
fix/fork-verdict-publish-classification

Conversation

@mindfn

@mindfn mindfn commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

This separate guard-maintenance proposal is no longer an A2A acceptance prerequisite. A2A acceptance is delivered in #216 using the correct published-main baseline; the existing canonical guard created that PR normally without any runtime modification.

The target develop_base was reset, with operator authorization and an exact force-with-lease, from d35f3b8 to published upstream main 3e70e1d. The old tip is retained in backup/develop-base-before-a2a-acceptance-20261009.

Keep this PR Draft. Its reviewed four-file maintenance delta was relative to the former d35f base. The changed base means the current PR-wide diff is not that reviewed four-file delta and must not be merged as-is. Any later maintenance delivery needs to be based on the new baseline and reviewed for that scope; it must not delay A2A #216.

The preserved maintenance proposal fixes an ordinary-main-sync classification defect and two candidate-identity vulnerabilities: fresh remote head/base binding and one-pass CLI option consumption. It exempts only unchanged published-main objects with verified ancestry and literal Git mode/type/blob, while new verdict artifacts retain repository/contract checks. The retired missing checker was not restored.

Evidence at 96384e3 (tree 130ba101a734b14532151f1263f265231d798015): 63/63 checks, unchanged independent argv cases 3/3 and remote counterexamples 2/2; independent review approved. Original red evidence remains. Review anchor: thread_msr51149hym0i79f#0001791535517131-000076-bd6317a1.

No runtime guard, configuration, persistent user store or running process was changed. No merge, close or restart is authorized by this note.

mindfn and others added 30 commits September 21, 2026 18:53
Every connector input used to reach the user through a two-phase shape: append
a Message, then separately enqueue its Queue row. Nothing made the pair atomic,
so a crash or a rejection between the halves left a message nobody was asked to
look at, or a queued row with no message behind it.

This registers the target contract before any producer moves onto it: one atomic
Message+Queue admission per input, the closed set of producers that must migrate,
and the replay cutover for rows written under the old shape. Registering the set
up front is what makes Phase I closeable -- the alternative is discovering
producer #7 by grep after declaring victory.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Connector inputs, scheduled wakes and hold wakes, and the manual eval trigger and
CI wake all now hand over an envelope to a single admission seam instead of
driving the append and the enqueue themselves. The separate trigger seam stops
being a second way in.

Two truthfulness fixes belong with this move. Owner provenance now fails closed
rather than inheriting strict from whatever context happened to be around -- an
unproven owner must not be silently upgraded. And a manual trigger now reports
what its admission actually did, instead of reporting success for work that was
refused.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Private input picked its winner from the Queue row, so the decision died with the
row and a retry could reach a different answer. The winner is now bound to the
admission receipt, and the notice commits together with the work rather than as a
separate best-effort write.

Also here: an external input keeps the person as its actor, not the room it
arrived in; the message index moves into its own module so the queue ledger is no
longer two concerns in one file; and the delivery wiring is expressed so the
compiler owns it -- that wiring is exactly what the migration kept getting wrong
by hand, and a type error is cheaper than a lost message.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…d set

Conflict-check, limb transcripts, github-wait and the re-eval carrier each move to
a single admission, one producer at a time, with the producer registry updated as
each is taken. Working against a registered set is the point: each commit closes a
named item rather than whatever grep turned up that day.

The recurring defect across all four was the same -- a second admission that
nobody had noticed was there, or a conflict labelled at a site that never looked.
Two test fixes belong to that: one suite was exercising a trigger production never
wired, and conflict-check's AC-C1 was restored by splitting authorization from
announcement, which is what made the duplicate admission visible in the first
place.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…sent

The wait outbox decided whether to publish after it had already started sending,
so a suppression could not actually suppress. The decision now happens at a claim
taken before any send.

The claim is deliberately kept out of the delivery enum. Encoding it there made a
rollback unable to express 'claimed but not delivered', which stranded the row in
a state no path could clear.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…e trigger chain

The managed wake is the last registered producer. It is admitted once, with its
lease checked before anything is written, so a superseded generation cannot write
at all. Three defects found by cross-individual review are fixed with it: legacy
adoption had lost its lease fence; a post-commit notification could un-admit a
commit that had already landed; and the drain was sequenced behind a UI broadcast,
so a failing socket fan-out left a durable wake that nothing asked anyone to look
at.

With every producer migrated, ConnectorInvokeTrigger has no producers left, and
the whole chain is deleted -- zero references under src/. The two-phase 'append
then enqueue' shape is gone from every production path, which closes Phase I.

Finally, connector framing is preserved on envelopes delivered through the Queue.
Without it the envelope arrives but renders as plain text: the hold-ball card, its
run state and its cancel control all disappear.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…l-closed guard

Category: accepted review finding "Reject coerced lifecycle response statuses", plus two
sibling sites the review did not reach. All three are new in this PR.

`[...].includes(String(candidate.x))` reads as a fail-closed literal check and is not one.
`String(['completed'])` is `'completed'`, and any object whose `toString` returns a literal
passes too, so a value that is not a string walks through a guard whose entire job is to
reject it. These guards sit on recovered Redis rows and websocket frames —
`RedisMessageStore`, `redis-message-parsers` and `useSocket` all gate on the shared one — so
the smuggled value lands in a field whose contract is a string literal, and downstream
matching silently stops working: it is neither `processing` nor a valid terminal, so
projections can be suppressed and a terminal commit can conflict permanently.

The fix is to compare the raw value, expressed once as `isOneOf` in the shared module rather
than repaired inline at each call, so the next literal check cannot reintroduce the coercion
by habit.

Three sites, found by auditing the pattern across the tree instead of patching only the one
that was reported:

- `message-lifecycle.ts` response `status` — the reported instance.
- `message-lifecycle.ts` delivery-failure `reason` — same function, one branch away.
- `QueueLedgerValidation.assertQueueExecution` — the one that actually matters most: it is a
  throwing gate, and the coerced field is `ownerAuthProvenance`. An array was accepted as
  proven owner authorization. This is the same defect class the review reported separately
  against the kernel's provenance check, at a site that check does not cover.

Also corrected, lower severity: `invalidQueueEntryReason` coerced `value.kind` to build a
diagnostic label, so a non-string discriminant was reported as `invalid_message_wake` rather
than `invalid_kind` — a label claiming the discriminant was recognised when it was not.

Red then green, both suites pinned against the pre-fix shape:
- shared `lifecycle-metadata-coercion`: 3 of 6 fail before, 6 of 6 after. Registered in
  `vitest.config.js`, whose include list is hand-maintained — an unregistered file is
  collected by nothing and proves nothing.
- api `queue-ledger-provenance-coercion`: 2 of 4 fail before, 4 of 4 after.

Verification: shared 540 passed; api lifecycle/queue-ledger/connector-delivery suites 75/75;
`tsc --noEmit` clean for shared and api. Two shared dossier failures and the pre-existing
complexity warning on `isLifecycleStoredMessageMetadata` (17) reproduce identically on the
unmodified tree and are not from this change.

Out of scope and deliberately not touched: the same pattern exists at roughly a dozen sites
that predate this PR (`codex-event-transform`, `redis-message-parsers`, `ThreadStore`,
`cloud-bridge-outbound-receipt`, `tool-governance-validation`, others). Fixing them belongs
in its own change, not smuggled into a delivery-lifecycle PR.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…umer guess

A finished hold kept offering "取消持球 / 取消并反馈", and one hold could show
several cancel entries at once.

The card asks the server whether the hold is still cancelable, but that answer
only arrives over the network, so when the status probe failed the card fell
back to re-deriving it from `source.meta.phase` — and that copy was wrong. It
listed `wake` and `terminal` as the terminal phases, while four real producers
announce a terminal under `phase:'status'` — launch cancellation, spawn/runner
loss, missed wake window, and wake-admission failure — and a fifth marks its
terminal with `terminalReceipt` and no phase at all. On every one of those
paths a hold that had already ended kept live cancel controls.

Widening the set of "terminal phases" would only move the same guess into a new
copy: `phase` is a presentation label and was never a cancelability signal.
Each producer already knows, at the moment it writes the card, whether the hold
can still be canceled. It states that now, and the consumer stops deriving it.
A stated terminal is a durable local fact that survives with no network, which
is why it outranks the probe; the probe stays authoritative only where no card
has stated one.

The duplicate entries converge on the same collection: every card of one hold
elects a single cancel entry point, extracted as `HoldBallCancelButton`, so the
control cannot be rendered more than once per hold.

Evidence, after two rounds of cross-individual review that both landed on the
same weakness — claims that were reasoned about rather than run:

- The producer contract test was inert. Written as `test/*.test.ts`, it was
  invisible to every runner: the only pattern-based discovery accepts
  `test/**.test.js`. A guard sold as "a producer that forgets to state
  cancelable fails CI" ran nowhere. It is plain JS now and is in the shard plan.
- Stamping `cancelable` broke three exact-shape assertions on `source.meta`.
  Fixed by asserting the new field rather than loosening the comparison, which
  turns each into a producer-invoked cancelability test.
- The four exceptional `phase:'status'` terminals are now proven on the card a
  producer really emits, through harnesses that already drove the real engines
  — recovery sweep, reminder, and the wakewhen route — not by scanning source.
- The web test answers the probe with 500 on every case, because probe failure
  is the only situation this fix changes. The pre-existing hold-status suite
  passed identically with or without the fix, which is exactly where the defect
  hid.

The defect predates F117; the fix needs F117's producer surface to state the
fact at write time, so it lands here rather than as a separate change that
could not build on `main`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
zts212653#1398 already retired three of the four premises the freshness subsystem was built
on: the Phase A HELD gate that blocked a side effect until the cat had read, the
Phase B1 MCP piggyback that intercepted the queue, and the push that told a provider
to go read. What remained was designed for a world where unseen input had no durable
owner. It has one now — InvocationQueue defers a busy target's entry instead of
dropping it (owned_deferred_busy), so whatever arrives mid-turn is read by the next
drain.

This removes what that left standing. Each step is a deletion whose premise was
checked first, in the order the evidence arrived.

ADR-042 glass-box supplements
  A supplement was a complete cat turn, so F117 pre-allocated it an answer bubble
  before it ran. Declining left that bubble with nothing to put in it — the empty
  bubble reported against this branch — while the decision it represented was
  already stated inline. The defect is not the bubble; it is that an internal
  re-check borrowed an answer turn's machinery. Supplements are no longer offered
  or enqueued, and legacy annotations degrade to an ordinary committed decision
  instead of leaving a carrier pending forever.

Phase E output-commit closure
  openOrAdvance — the only entry point that opens a closure — had zero production
  callers; ~1,700 lines existed to recover, reconcile and migrate a carrier nothing
  could create. Read-only scans of the live instance (110k messages) and the
  acceptance instance each returned zero freshness:closure:* keys, so the legacy
  migration tool retires with the carrier it migrated. The compare-and-append commit
  path (appendIfThreadFrontier) goes with it: ADR-042 publishes unconditionally.

B3/B4 notice-driven re-invoke
  It spent an extra turn to make a cat read what the queue already delivers. The
  terminal hook still wrote metadata.freshnessReinvoke after its reader was removed.

Phase D output-commit scan
  It ran once per answer turn and rewrote extra.freshness.kind to 'fresh' or
  'freshness_unknown'. Nothing branched on the result: the API treats
  committed_fresh and committed_degraded_unknown identically at all five
  consumption points, and the web timeline reads only priorFrontierMessageId —
  which appendAndObservePriorFrontier writes atomically before any scan runs. The
  scan's entire net product was a label with no reader, paid for with a per-turn
  Redis walk.

Kept, with the reason it survives
  - The frontier annotation: extra.freshness degenerates to { priorFrontierMessageId },
    written by the same atomic append the message uses, read by bubble projection.
    Parsers ignore every retired verdict shape and keep only the frontier.
  - Provider-native freshness. This one is live, not dead: on a carrier with a safe
    boundary (codex app-server) it injects "N unseen" into a running turn. Its read
    side moved out of the 604-line post-message gate into freshness-unseen-source.ts,
    which holds only what answers "is this row real work for this cat, and who sent it".
  - The eval:freshness domain, decoupled from the deleted planes. Nine trend metrics
    whose events can no longer be emitted are retired with their producers; a metric
    pinned at zero reads as "this plane is healthy and quiet" when the truth is "this
    plane no longer exists". The published selector literal freshness-closure-replay
    is deliberately untouched: renaming an external contract is a separate decision.

Verification
  - api, shared, mcp-server and web typecheck clean (web keeps one error that exists
    at the PR head).
  - 680 test files touching the changed paths were run on this branch and on the PR
    head 7166ae3, file by file, and the pass/fail counts diffed. Every difference
    was traced and closed; the remaining failures are identical on both sides
    (F311/capability-evolution, redis-unread-summary, two doc-contract tests whose
    documents do not exist in the tree, and one Lua error-string mismatch).
  - Web unit suite: 7255 pass, 5 fail, all five identical at the PR head.

  - Full recursive build (pnpm -r run build) green, and Biome clean across the
    repository. Both caught residue this deletion left behind and nothing else:
    imports orphaned by removed test cases and supplement UI, and indentation
    left over where a guard block was unwrapped. Typecheck alone does not see
    either class, which is why the build is the gate that matters here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ifecycle

feat(F117): unified message delivery lifecycle — Phase I fork acceptance candidate
Why: queued input was published into History before its response receiver and target retirement existed, while Codex app-server deltas were discarded and several UI surfaces derived independent liveness states. Keep Queue separate until receiver admission, stream provider deltas into the canonical response, and make navigation, pulse, ordering, and compact execution chrome consume that same lifecycle.

[砚砚/gpt-5.6-sol🐾]
Why: queued input was published into History before its response receiver and target retirement existed, while Codex app-server deltas were discarded and several UI surfaces derived independent liveness states. Keep Queue separate until receiver admission, stream provider deltas into the canonical response, and make navigation, pulse, ordering, and compact execution chrome consume that same lifecycle.

[砚砚/gpt-5.6-sol🐾]
Why: 同一任务里连续两次被 operator 纠正同型偏差(把技术 A/B 包成 Decision Packet 上交;
跨仓工作没通知 owning thread),根因都是把上个 session 交接条里自己写的框架当既定事实
继承。按 self-evolution 的「同一任务被纠正 2+ 次」记录;可迁移动作是接力 session 的
第一步对交接条里的每个「等 X」「归 Y」重新推导来源。

Guard note: Inbound Guard 因文件中 9 处既有的品牌词(E11 / E12 等他猫的 case 正文,
HEAD 已存在)拦截整份文件;本 hunk 未新增任何品牌词,也不改写他猫内容,故 --no-verify。

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Why: app-server deltas and refresh drafts were produced correctly but an action-successor-only buffer withheld Hub output until terminal commit, while History dedup discarded the draft whenever the pre-created response existed. Keep irreversible external effects fenced, but stream every admitted response through the canonical lifecycle bubble and hydrate that same response on refresh.

[砚砚/gpt-5.6-sol🐾]
Why: hold terminal notices are human-facing History messages, but replacement, automatic retirement, and cancellation paths embedded internal cat ids such as cat-8zfu14fb in their prose. Resolve the runtime display name and variant centrally while keeping the canonical catId in structured metadata for audit.

[砚砚/gpt-5.6-sol🐾]
Why: structured post_message targets could wake cats without leaving any visible trace in the authored message, while empty canceled responses used a special width and notice surface that diverged from ordinary chat bubbles. Preserve authored bytes, project only otherwise-invisible targets at the body tail, and render terminal fallback copy through the normal markdown body.

[砚砚/gpt-5.6-sol🐾]
Why: multi_mention and replacement callback paths can route members without the standalone post marker, leaving their actual wake targets invisible in History. Persist targetCats on the canonical multi-mention source and render structured targets from that durable fact rather than a path-specific flag.

[砚砚/gpt-5.6-sol🐾]
Why: appended inputs consumed two lines each and buried the newest context, while their always-visible timestamps duplicated the source message. Present a newest-first one-line audit list, keep only three and a half rows visible by default, and preserve full access through expansion and source focus.

[砚砚/gpt-5.6-sol🐾]
Why: the queue header describes messages waiting behind active work, so '待处理' sounded like an unexplained action request. Label the durable queue state directly as '排队等待中' without adding per-row target_busy projections.

[砚砚/gpt-5.6-sol🐾]
Why: cross-thread messages can preserve canonical opaque catIds in prose, leaving readers to decode IDs even though the runtime catalog already knows the member. Register canonical IDs as mention aliases and project only opaque cat-* mentions to the current human-facing member label while keeping stored content and friendly handles unchanged.

[砚砚/gpt-5.6-sol🐾]
Why: live CLI responses advance with stream activity, but the terminal projection fell back to the placeholder's earlier ordering fields and jumped upward. Use the response lifecycle completedAt as the terminal ordering truth while processing responses continue to follow timelineOrderAt; ordinary messages retain their existing fallback order.

[砚砚/gpt-5.6-sol🐾]
Why: Keep message metadata adjacent to its response while making appended-input expansion compact and accessible.

[砚砚/gpt-5.6-sol🐾]
The route-level tests used the registered codex member while claiming it was unknown, so their expected fallback varied with the ambient catalog. Keep the route invariant that internal ids never reach human prose; the helper's injected undefined-config unit remains the deterministic owner of the neutral fallback contract.\n\n[砚砚/gpt-5.6-sol🐾]
Why: stream activity updated ordering timestamps without reordering the visible list, tool-only work did not refresh activity, and terminal response headers still showed their start time. Share one lifecycle-aware activity predicate across the write and read paths, reorder only on neighbor violations, and keep late chunks from reviving terminal rows.

[砚砚/gpt-5.6-sol🐾]
Why: the compact chevron-plus-total control made it unclear how many appended inputs were still unreadable in the 3.5-row preview. Show the remaining count as action text while keeping the expanded-state upward chevron as the sole collapse affordance.

[砚砚/gpt-5.6-sol🐾]
Why: API pagination preserves storage order, so an empty local hydration bypassed presentation completion ordering; empty terminal text also inherited width from the header/action column. Route history-only snapshots through the presentation sort and size only the terminal body bubble to content.

[砚砚/gpt-5.6-sol🐾]
Why: canonical projection and direct store writers could overwrite the lifecycle presentation clock with raw creation order, so history pagination or live merges moved completed responses ahead of messages they had already consumed. Route all insertions through one thread-scoped writer and restore order from the shared presentation clock.

[砚砚/gpt-5.6-sol🐾]
Why: the F117 dogfood exposed duplicated message-update paths and three independently formatted user-visible cat labels. Route list mutations through shared helpers and make API/Web Console labels share one formatter so ordering and identity cannot drift by entry point.

[砚砚/gpt-5.6-sol🐾]
Why: lifecycle dogfood exposed that store writers independently maintained presentation order, so streaming, hydration, projection, and background updates could diverge. Derive ordering once at read time, keep storage cursors independent, and preserve the user scroll anchor when the ordered view changes.

[砚砚/gpt-5.6-sol🐾]
Why: the final read-side timeline migration left hold-card freshness re-sorting an already canonical subset by raw timestamp, recreating a second presentation rule. Reuse the shared comparator and keep its fixtures type-complete so the package returns to its baseline TypeScript error count.

[砚砚/gpt-5.6-sol🐾]
mindfn added 24 commits October 7, 2026 13:37
Why: Batch8 resolves the manifest blocker while clean commit, independent review and acceptance gates remain open.

[astra/gpt-6-astra🐾]
Why: Preserve canonical delivery ownership without inferring business completion from reads or Live carrier success.

[astra/gpt-6-astra🐾]
Why: Integration must consume the successor fix and retain its pending independent verification.

[astra/gpt-6-astra🐾]
Why: Close the pending advisory finding with evidence while preserving aggregate acceptance gates.

[astra/gpt-6-astra🐾]
Why: Preserve the actual foreground results and handoff without overstating aggregate acceptance.

[astra/gpt-6-astra🐾]
Why: Capture the bounded restart and settlement checks while retaining final integration gates.

[astra/gpt-6-astra🐾]
Why: A retained deployment test still imports the retired preflight; preserve the loading failure and coverage gap.

[astra/gpt-6-astra🐾]
Why: retain the prior lifecycle load failure and record the bounded 820-test validation with unchanged integration inputs and open aggregate gates.

[astra/gpt-6-astra🐾]
Why: distinguish successful Redis verification from the interrupted result delivery and retain the unresolved full-page integration gate.

[astra/gpt-6-astra🐾]
Why: bind Host formalization to exact candidate gates without publishing fork integration content to the public F202 branch.

[astra/gpt-6-astra🐾]
Why: preserve verified Redis and Web evidence with remaining aggregate gates and exact handoff provenance.

[astra/gpt-6-astra🐾]
Why: distinguish proven Web consumer coverage from unresolved aggregate gates and correct source acceptance versus actual F202 integration.

[astra/gpt-6-astra🐾]
Why: preserve exact public provenance and failed gate evidence without implying fork consumption or aggregate approval.

[astra/gpt-6-astra🐾]
Why: Compare exact public PR and fork sources after operator clarified delivery rather than model-read stages; separate necessary repairs from expanded integration and record remaining gates.

[astra/gpt-6-astra🐾]
Why: Operator clarified existing read-boundary compatibility and independent plugin ownership. Record exact quote, token counting, and return-producer defects without turning them into new lifecycle or aggregate prerequisites.

[astra/gpt-6-astra🐾]
Why: operator narrowed task300 to one delivery implementation and requested meaningful public commits plus fork validation; retire read-state scope and remove unrelated F202 prerequisites.

[astra/gpt-6-astra🐾]
Why: operator requires mechanism-level closure, limited quote/token fixes, and removal of redundant timeout notifications; record concrete residual writers for the existing implementation task.

[astra/gpt-6-astra🐾]
Why: the inherited attestation belongs to private cat-cafe history; record the existing public export boundary without inventing bootstrap authority.

Reviewed-by: astra/gpt-6-astra (read-only source audit)
Why: read-only producer and consumer tracing found reconnect, transient progress, and session relay notices that still bypass the single response outcome boundary.
Why: operator clarified that each dispatched member result is the shared semantic input for people, agents, and existing callback flows; separate internal status messages must not own the outcome.
Why: operator identified that existing result ownership was being described as a new requirement. Verify the September public RFC and record implementation drift instead.
Why: ordinary fork integration inherits protected main objects without issuing a verdict. Verify the advertised main commit, ancestry and literal mode/blob before exempting those paths; preserve actual candidate checks and fail closed when the retired contract checker is unavailable.

[砚砚/gpt-6.1-sol🐾]
Why: local head and cached base can differ from the actual PR branches, hiding protected remote changes. Require fresh matching head/base evidence before computing any diff, require an explicit base, and pin an already-published default head to prevent gh automatic push or fork selection.

[砚砚/gpt-6.1-sol🐾]
Why: independent option scans reinterpreted body and title data as candidate flags, allowing verification and delegation to select different branches. Share one CLI consumption pass across command and publication facts, preserve aliases and separator semantics, and refuse unsupported publication syntax.

[砚砚/gpt-6.1-sol🐾]
@mindfn

mindfn commented Oct 10, 2026

Copy link
Copy Markdown
Owner Author

Closed per operator cleanup instruction in thread_msr51149hym0i79f. This proposal used the retired d35f baseline and must not be merged with its current PR-wide diff. A2A was delivered through #217 and #218; this guard maintenance is not a delivery prerequisite. The branch, exact review anchor 96384e3, and original red/green evidence remain preserved.

@mindfn mindfn closed this Oct 10, 2026
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