Skip to content

refactor(gateway): simplify cron and session resource owners - #174111

Merged
steipete merged 4 commits into
mainfrom
deslop/z02-7-resource-owners-20261015
Oct 16, 2026
Merged

steipete merged 4 commits into
mainfrom
deslop/z02-7-resource-owners-20261015

Conversation

@steipete

@steipete steipete commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Gateway resource owners repeat private lifecycle, generation and observation
protocols around cron work, session reads and run admission.

User Impact

No feature or public configuration, protocol, SDK or persisted-data migration.
FIFO, current security/effect authority, committed transcript durability, resource
bounds and ordinary-shutdown settlement remain required. The UI change only
imports the existing canonical avatar-path parser; there is no visual change.

Why This Change Was Made

Put cron start/pause/stop and persisted EXIT/STREAM startup sweeps in the existing
canonical owner rather than replaying them through the lazy adapter. Retain the
existing pre-write callback transfer needed to avoid a closed-fence restart wait cycle. Stream
output uses its existing FIFO, actual run and abort signal rather than per-hop
generations, redundant epochs, diagnostic seed caches and custody maps.

Keep session async reads with their existing worker owner and the final live
installation/disclosure checks; remove the second read-custody and descriptive
ownership retry layer. Retire the unknown-event observation registry while
retaining captured identity/revision checks and per-session FIFO. Remove the
special generation-only admission ACK protocol, not real reset/Stop/error replay
or any of the four successful preparation revalidators.

Phase E standalone session memory, its factory, registry, expiry, federation
machinery and tests are untouched. No SQLite schema, retention, permissions,
dependency, suppression, timeout, retry, skip or public-contract change.

Best-effort tradeoffs accepted

Quiet-window execution cadence is NOT best effort: independent review found that
a callback already queued behind async matching could flush a newer batch early.
The final change retains the existing scheduled-job identity and one comparison
at the queued flush effect, plus the complete original execution-cost regression.

Evidence

Production: 25 files, 446 added / 1,017 removed = 571 net lines removed
(24 Gateway files plus the canonical parser import in one UI file).
Tests, fixtures/support, generated and declaration outputs are excluded.

Fresh complete 53-file independent P0-P2 review finished in four passes. Its one
actionable quiet-window finding was fixed as described above; the complete two
stream files then received a fresh scoped-clean P0-P2 review. Complete source and
context hashes were independently verified after the signed commit.

Formatting passed for all 52 changed TypeScript files and the normal commit hook.
The mandatory lint-suppression gate passed all three assertions (424.86 seconds).
The final focused quiet-window invocation reached the runner's unchanged
900,000ms no-output limit without assertions (1,337.15 seconds total); it is
missing runtime proof, not a pass or an attributed product failure. Actual
check-changed attempt passed line-cap for all52 sources, then reported max-lines
suppressions in three unchanged main UI files; remaining stages were interrupted.
Earlier broader focused/type/lint/cycle attempts were deliberately stopped
before the quiet correction and have no complete verdict; they are not passes.
No interrupted command or host-load timeout is called passing or inherited CI.
Exact-head PR CI is the broad proof and required landing gate.

The first exact-head CI run38887793326 found PR-caused defects. They are not
attributed as inherited or waived: the cron handoff cut created a real wait cycle
behind the closed restart fence, so both original transfer hunks and the original
pending-callback regression are restored. The canonical startup/lazy-owner cut
remains. Worker-read fixtures migrate from it.each to it.for for the actual
Vitest TestContext, and from the removed outer custody chain to the real awaited
worker boundary. Event privacy tests inspect actual JSON wire shape while keeping
their current-row and private-field assertions. Required timestamps are supplied
in the lifecycle fixture; the extracted marker-queue proof uses canonical
operation-bound gate waits rather than adding a timeout-race allowance.

First-head failed job Diagnosis and repair
check-test-types-core-4 Worker-read table incorrectly requested TestContext from it.each; use it.for.
check-test-types-core-5 Lifecycle fixture omitted required updatedAt; supply original/replacement timestamps.
check-lint-core-1 Flatten the touched admission successor check without weakening either authority predicate; other annotated files require separate baseline attribution.
checks-node-changed-compact-large-9 Same TestContext fixture failure; preserve actual alias/shared-source refusal and recovery assertions.
checks-node-changed-compact-small-22 Accepted-facts fixture still expected the removed private native/continuation chain; observe real worker completion and forward its lane.
checks-node-changed-compact-small-1-1 Restore real cron handoff; inspect topology event privacy on serialized wire payload.
checks-node-changed-compact-small-1-2 Inspect lifecycle event privacy on serialized wire payload.
checks-fast-baseline-ratchets Remove the six introduced wall-clock timeout races using canonical operation/abort-bound helpers; no allowance increase. Other annotated baseline/suppression files need separate attribution.

The seven-file CI repair received a fresh complete three-pass scoped-clean P0-P2
review (112 complete source/context files); the two final fixture repairs then
received their own fresh scoped-clean P0-P2 review. Runtime/lint/type proof on
the repaired source remains in progress; interrupted attempts are not passes.
The targeted Gateway-server typecheck passed (445.25 seconds), and the fresh
mandatory suppression gate passed all three assertions (245.82 seconds).
Lint identified an unnecessary JSON round-trip in the fixture repair. The final
two-file change keeps raw-payload assertions and checks the wire-only private key
directly in JSON bytes, with no copy or suppression. Its fresh P0-P2 review is
scoped-clean and two-file lint passed (343.56 seconds). Final runtime proof is
still in progress; the previous frozen attempt was stopped to apply this repair.

These CI repairs are pushed as signed commit
8123365. Complete reviewed source hashes
remain unchanged after the normal commit hook. Exact-head CI, not a load-only
local timeout or prior-head result, is the broad landing proof.

Second exact-head run38893296858 at8123365d4fc found two attributable cleanup
misses: lint rejected reassignment of the lifecycle-event parameter, and the
timeout-race ratchet required deleting the now-unused five-site allowance for
the extracted server-session-events test. The broadcaster now selects the
identical normalized event into a const; delete/routing, captured identity,
recipient authorization and disclosure behavior are unchanged. The unrelated
media-facts assertion baseline also shrinks16 to the actual14 reported by CI;
no allowance increases. Other line-cap/env-budget annotations were warnings,
not additional failed owners. Every observed runtime/type leaf passed.

These three-file repairs are signed commit73ae768a8535930fe8483b72617e036284fdcd2f.
Fresh complete scoped-clean P0-P2 review and independent hash verification cover
the exact sources after the normal hook. Format passed (6.44s), lint passed
(321.55s), mandatory suppression passed all three assertions (176.62s), runtime
cycles passed with zero value cycles (399.48s), and timeout-race ratchet passed
(78.39s). The previous focused attempt was stopped after cron assertions to apply
this actual lint fix; it has no full passing verdict. Madge passed with zero
cycles (943.48s), and assertion-ratchet passed (425.27s; 2,632 files and 6,068
sites). Focused event/lifecycle runtime proof passed: two files and 61 tests
(1,389.33s wrapper wall time on the loaded host). These retain FIFO, captured
identity, current-row authorization, lifecycle fields and private wire-shape
assertions. Exact-head CI38896745763 is the broad landing gate.

The completed exact-head run38896745763 passes all attributable runtime, build,
type, lint, ratchet and architecture leaves. Its only failed leaf is
checks-ui-e2e (6/9) (job116959546190): five Models-page layout cases at
390/640/768/1100/1440px expect a control list that omits Utility Fallback Model.
The same five cases, exact extra-control diff and stack fail on scheduled main
run38894297213, job116951151556, main1dbc6fb1f327fb861889c8abf8174fbf73052f24
(verified ancestor of origin/main). This is inherited evidence, not a green CI
claim or a Gateway cleanup regression. Aggregate116964674071 is downstream of
that sole leaf. Native inherited-failure admission still must verify exact-head
security, policy, review and source evidence; no CI rerun is requested.

Current conflict-repaired candidate

The current signed head is990f3f3fc5fb725d66fe603bc7da2bce5ad87eba on base
d0d1f4c: 571 net production lines removed,
25 files,446added/1017removed. The actual conflict was main's test-only lazy-cron
fixture consolidation. Its shared fixture/typed mocks and unrelated tests remain;
the complete pending-callback cron-exit handoff suite is byte-identical to main.
Production patches are unchanged. Fresh P0-P2 review was scoped-clean, complete
source/context hashes were externally verified after the signed formatting commit,
and two-fixture type-aware lint passed (73.38s). Post-rebase focused runtime passed
both files and all45tests, including pending-callback handoff (1488.23s wrapper).
Gateway-root graph types, runtime cycles0, Madge cycles0 and all3 mandatory
suppression assertions passed (1635.26s combined). These long local times reflect
the loaded proof host, not a product performance measurement.

All earlier CI failure/repair records above are historical evidence for their
named heads. In particular, the old73ae UI-layout baseline comparison does not
qualify this new head. Exact-head run38925722087 at990f completed successfully:
all selected executable runtime/build/type/lint/ratchet/architecture leaves,
all nine selected UI browser shards, PostgreSQL conformance, security-fast and
aggregate openclaw/ci-gate117065729097 passed. All check-run pages were enumerated;
no failed or cancelled check remains. Applicable security boundary checks passed;
CodeQL concluded neutral. No rerun or inherited-failure exception is needed for
this head. Native review/preparation and verified merge are still required.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime agents Agent runtime and tooling size: XL labels Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 10:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T15:44:15.771445Z 990f3f3 New commits
ℹ️ 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
Contributor

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: 3c00e6aa49

ℹ️ 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 src/gateway/server-session-events.ts Outdated
Comment on lines +639 to +643
event = {
sessionKey: event.sessionKey,
agentId: event.agentId,
reason: "updated",
...(event.catalogChanged ? { catalogChanged: true } : {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Drop queued events after their generation is replaced

When a lifecycle event arrives before its row is resident and that key is reset or replaced while withPreparedEventRow awaits, this rewrite discards the event's original incarnation and later publishes sessions.changed from the successor row as updated. Clients can therefore update or admit the successor because of predecessor activity; queued events must capture their generation before awaits and reject replacement, so retain the generation observation and suppress publication on mismatch.

AGENTS.md reference: src/gateway/AGENTS.md:L56-L56

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR consolidates Gateway cron and session lifecycle ownership and removes redundant generation, observation, and retry bookkeeping.

Example: Native ownership changes while listing agent:main:planning.

  • Before: The Gateway retries native metadata and retries degraded metadata on the next list request.
  • After: The row uses configured metadata until its next invalidation.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The owner-directed design is useful, but this candidate is not ready for merge.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 4 actionable review findings remain.

Product

Kind: Refactor · Worth it: Yes
Reason: The established area owner explicitly chooses simpler lifecycle ownership while retaining security, durability, FIFO, and resource-bound contracts.

Merge readiness

⛔ Needs changes before merge - 4 items remain

Keep open: this maintainer-directed simplification has clear value, but the candidate introduces concrete test failures that need repair.

Priority: P2
Reviewed head: 3c00e6aa4993324c3287bcf4d8b8a03477cef53b

Before merge

  • Use it.for when requesting the test context (P2) - The scalar it.each table supplies only change, so the second argument is undefined and destructuring signal throws before either storage scenario starts. Exact-head CI reports this failure for both cases. Use it.for, which supplies the context separately, or obtain cancellation through the supported test-context API.
  • Migrate the accepted-facts fixture off removed custody layers (P2) - withSessionRowDatabaseFacts no longer acquires the extra native hold or canonical continuation, but this shared fixture still requires their release callbacks and continuation receipt. Every consumer now fails at the release-order assertion with only worker recorded. Remove the retired-layer instrumentation and assertions while retaining the accepted-suffix, invalidation, and replacement checks.
  • Assert absent predecessor values rather than absent object keys (P2) - buildGatewaySessionSnapshot always creates swarmGroupId, including when its value is undefined. The new assertion therefore fails for the intended safe publication; the same mistake appears in session-row-projection.topology.test.ts:507. Assert an undefined value or inspect serialized output so the tests still reject predecessor swarm data without contradicting the canonical snapshot shape.
  • Reopen admission before joining the retained handoff callback (P2) - The handoff variant keeps restart-signal admission closed until finally, yet awaits adopt before reaching finally. With the accepted new ownership behavior, adopt joins the captured fireOnExit callback, which is waiting for that admission to reopen, so the fixture times out at line 777. Update this variant to assert that handoff remains pending, roll back its fence, and then join settlement; preserve the disable-case coverage.

Findings

  • [P2] Use it.for when requesting the test context — src/gateway/session-row-projection.worker-read.test.ts:302-304
  • [P2] Migrate the accepted-facts fixture off removed custody layers — src/gateway/session-row-projection.accepted-facts.test-support.ts:224-226
  • [P2] Assert absent predecessor values rather than absent object keys — src/gateway/server-session-lifecycle-events.test.ts:165

Tests

  • Missing end-to-end proof: Fresh startup and an upgrade from v2026.10.4 must exercise persisted EXIT/STREAM jobs and session state through the changed lifecycle owner.
Agent review details

How this fits together

Gateway resource owners consume persisted cron jobs, session requests, and lifecycle events, then coordinate supervised processes, worker reads, and authorized client publications.

flowchart TD
  A[Cron schedules and session requests] --> B[Gateway]
  B --> C[Cron lifecycle owner]
  B --> D[Session projection owner]
  C --> E[Process supervisor]
  D --> F[History workers]
  D --> G[Authorized client events]
Loading

Technical review

Best possible solution:

Retain the single-owner design and accepted tradeoffs, repair the affected fixtures, and verify lifecycle upgrade behavior.

Do we have a high-confidence way to reproduce the issue?

This refactor claims no current-main user defect; exact-head CI failures and their causes were verified against source without running target code.

Is this the best way to solve the issue?

Consolidating lifecycle decisions in existing owners follows repository guidance, and the recorded tradeoffs do not require another product decision.

Full review comments:

  • [P2] Use it.for when requesting the test context — src/gateway/session-row-projection.worker-read.test.ts:302-304
    The scalar it.each table supplies only change, so the second argument is undefined and destructuring signal throws before either storage scenario starts. Exact-head CI reports this failure for both cases. Use it.for, which supplies the context separately, or obtain cancellation through the supported test-context API.
    Confidence: 1
  • [P2] Migrate the accepted-facts fixture off removed custody layers — src/gateway/session-row-projection.accepted-facts.test-support.ts:224-226
    withSessionRowDatabaseFacts no longer acquires the extra native hold or canonical continuation, but this shared fixture still requires their release callbacks and continuation receipt. Every consumer now fails at the release-order assertion with only worker recorded. Remove the retired-layer instrumentation and assertions while retaining the accepted-suffix, invalidation, and replacement checks.
    Confidence: 1
  • [P2] Assert absent predecessor values rather than absent object keys — src/gateway/server-session-lifecycle-events.test.ts:165
    buildGatewaySessionSnapshot always creates swarmGroupId, including when its value is undefined. The new assertion therefore fails for the intended safe publication; the same mistake appears in session-row-projection.topology.test.ts:507. Assert an undefined value or inspect serialized output so the tests still reject predecessor swarm data without contradicting the canonical snapshot shape.
    Confidence: 1
  • [P2] Reopen admission before joining the retained handoff callback — src/gateway/server-cron.test.ts:772-777
    The handoff variant keeps restart-signal admission closed until finally, yet awaits adopt before reaching finally. With the accepted new ownership behavior, adopt joins the captured fireOnExit callback, which is waiting for that admission to reopen, so the fixture times out at line 777. Update this variant to assert that handoff remains pending, roll back its fence, and then join settlement; preserve the disable-case coverage.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 72629e1fdff9.

Provenance checked

  • Cron startup and suspension changes intended behavior with a stated reason (1bcc4c5: Cooperative suspension pauses scheduling and tracks startup until the process can safely report idle.)
  • Exit callback handoff changes intended behavior with a stated reason (c82292b: Pending admission waits were cancelled and rebound during handoff while admitted writes retained settlement ownership.)
  • Stream source generations changes intended behavior with a stated reason (98742bc: Separate process generations from durable source identity so stale callbacks cannot execute retired work.)
  • Unknown event observations changes intended behavior with a stated reason (e0d8000: Preserve event source and incarnation across asynchronous preparation and identity replacement.)
  • Descriptive native metadata retries changes intended behavior with a stated reason (ce495a3: Keep session lists available during ownership churn and recover native metadata on subsequent list requests.)
  • Avatar route canonicalization keeps the original intent (refactor(ui): share Control UI resource route contract #126386: Share browser-safe resource grammar while preserving malformed-route handling and authentication ownership; the local historical object was unavailable, so the PR rationale supplied this context.)
  • Generation-only admission acknowledgments changes intended behavior with a stated reason (unknown: History carries this protocol through the agent phase extraction; its original introduction was not established, and the separate durable restart-recovery marker repair remains outside the removed protocol.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/gateway/session-row-projection.worker-read.test.ts src/gateway/session-row-projection.accepted-facts.test.ts --maxWorkers=1
  • pnpm test src/gateway/server-session-lifecycle-events.test.ts src/gateway/session-row-projection.topology.test.ts src/gateway/server-cron.test.ts --maxWorkers=1
  • pnpm check:changed
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2d7b1c1 adds src/gateway/session-row-database-facts.ts:37 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2d7b1c177c3e; files: src/gateway/session-row-database-facts.ts)
  • Cameron Beeley: Raw commit 68bfa42 adds src/gateway/cron-exit-watchers.ts:39 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 68bfa42b9bfc; files: src/gateway/cron-exit-watchers.ts)

PR surface

Source -584, Tests -183, Docs 0. Total -767 across 53 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 26 476 1060 -584
Tests 26 614 797 -183
Docs 1 4 4 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 53 1094 1861 -767

Labels

Label changes:

  • add P2: This is a useful internal refactor with concrete test repairs and no demonstrated urgent user regression.
  • add merge-risk: 🚨 availability: Handler handoff now waits for captured callbacks, which can delay reload; the maintainer explicitly accepts this tradeoff in the PR body.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a useful internal refactor with concrete test repairs and no demonstrated urgent user regression.
  • merge-risk: 🚨 availability: Handler handoff now waits for captured callbacks, which can delay reload; the maintainer explicitly accepts this tradeoff in the PR body.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 6:52 AM ET / 10:52 UTC.

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

Copy link
Copy Markdown
Contributor

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: 8123365d4f

ℹ️ 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".

!this.desiredRunning ||
this.state !== "starting"
) {
if (!ownsPersistedJob || !this.desiredRunning) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Retain a per-request fence for each stream start

When start A is awaiting persistState, an intervening stop sets desiredRunning false, but a later queued start C sets this shared flag true again before A resumes. A then passes this check and can spawn A's stale command before the queued stop executes; preserve a request-specific generation/token so a newer start cannot reauthorize an older command effect.

AGENTS.md reference: AGENTS.md:L71-L71

Useful? React with 👍 / 👎.

Comment thread src/gateway/server-session-events.ts Outdated
Comment on lines +639 to +643
event = {
sessionKey: event.sessionKey,
agentId: event.agentId,
reason: "updated",
...(event.catalogChanged ? { catalogChanged: true } : {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Preserve swarm notes for nonresident rows

When a swarm-note arrives for a valid session whose row is not resident, this rewrite discards swarmGroupId, kind, and text even if the session identity never changes. These notes are transient Control UI state and are not recoverable from the later row snapshot, so the generic updated event silently loses the active swarm phase or log; retain the note for its original incarnation and suppress it only if that incarnation is replaced.

AGENTS.md reference: src/gateway/AGENTS.md:L59-L61

Useful? React with 👍 / 👎.

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

Copy link
Copy Markdown
Contributor

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: 73ae768a85

ℹ️ 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".

) {
return undefined;
}
if (params.restoredCronContinuationIdentity && !params.restoredCronContinuation) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Revalidate lifecycle before registering the run owner

When an internal/one-shot request crosses an in-process Gateway restart during an earlier delivery or admission await, this removed guard allows prepareAgentRunDispatch to register a controller and claim a run context using the stale lifecycle generation. Because the restart sweep has already completed, a same-ID retry can then be reported as in_flight until later user-turn preparation detects and cleans up the stale owner; revalidate the generation synchronously after work-admission acquisition and immediately before publishing the controller.

AGENTS.md reference: src/gateway/AGENTS.md:L29-L30

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

PR 174111 exact-head inherited failure evidence

PR head: 73ae768.
Completed CI run 38896745763, attempt 1.
Failed leaf: 116959546190, checks-ui-e2e (6/9).
Downstream failed aggregate: 116964674071, openclaw/ci-gate.

Actual failed-job checkout log, fetched through gh run view:

2026-10-16T11:55:38.4407884Z HEAD is now at 4cce0821 Merge 73ae768a8535930fe8483b72617e036284fdcd2f into 5442051b9f7606eb84decdf2271264001404d956

GitHub commit API and retained Git object independently resolve that checkout to
4cce0821fe08b78f5b32456be1d8c829f91ea5ae, tree
ceed6ec20ae741422af0e6e25fee25f8eeb7a429. Its two ordered parents are
5442051 and the exact PR head above.

Baseline: completed scheduled main run 38894297213 at
1dbc6fb; failed leaf 116951151556,
checks-ui-e2e (6/9). The baseline is an ancestor of observed origin/main.

Both exact check-run annotation inventories report these same five failures in
ui/src/e2e/model-providers-layout.e2e.test.ts:114:

  • Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 390px
  • Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 640px
  • Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 768px
  • Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 1100px
  • Models settings layout and discovery > Models page keeps controls separate and publishes discovery into a passive picker at 1440px

Every case has the identical assertion diff: expected roles Model, Utility Model,
Decision Model, Fallback Model, Thinking, Fast Mode; received additionally
Utility Fallback Model immediately after Utility Model. Both stacks name
control-ui-e2e-suite.test-support.ts:661 and :653/:479 plus the shared QA Gateway
cleanup owner. This is a stale Models-page expected-control list, not an avatar
parser behavior or a Gateway lifecycle assertion.

The classifier labels the job pre-existing by JOB NAME ONLY, explicitly without
signature comparison. Attribution here instead uses the independently inspected
five identical annotation signatures from both jobs. The failure was not fixed,
skipped, retried, or relabeled passing.

Read-only git diff --quiet passed for both named failing test/helper paths from
baseline 1dbc6fb to actual merge base 5442051, and from that base to tested merge
4cce0821. No fixture or failing expectation changes belong to this PR.

All exact-head check runs were enumerated through gh api --paginate. There are
no other failed CI leaves; build, production/test types, runtime leaves, lint,
ratchets, architecture, UI unit/eight other browser shards, PostgreSQL and
security-fast passed. The early cancelled PR-context run is superseded by two
successful exact-head PR-context checks (116959052493 and 116961524945), not a
cancelled executable test suite. Aggregate 116964674071 is solely downstream of
116959546190. Native admission must still verify live policy, reviews, security,
current exact-head checks and all retained source/artifact hashes.

Evidence URLs:
https://github.com/openclaw/openclaw/actions/runs/38896745763/job/116959546190
https://github.com/openclaw/openclaw/actions/runs/38894297213/job/116951151556

@steipete
steipete force-pushed the deslop/z02-7-resource-owners-20261015 branch from 73ae768 to 990f3f3 Compare October 16, 2026 15:39
@steipete
steipete merged commit 14c1305 into main Oct 16, 2026
157 checks passed
@steipete
steipete deleted the deslop/z02-7-resource-owners-20261015 branch October 16, 2026 17:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…w#174111)

* refactor(gateway): simplify lifecycle resource owners

* fix(gateway): preserve cron handoff and current owner fixtures

* fix(gateway): select lifecycle event without parameter mutation

* test(gateway): format rebased lazy cron fixture
steipete added a commit that referenced this pull request Oct 17, 2026
#175461)

Fix forward from #175307. The native admission helper recognized a committed
registration notice, but its outer callback still checked the retired caller.
Refusing that bookkeeping notice left an opened worker without its installed
identity and replaced the expected lifecycle refusal with unknown settlement.

End authorization for this already-observed COMMIT at the outer callback.
Receipt observation still validates and records the exact registration owner;
subsequent validation, preparation and command admission keep live authority.
Generic failed-report retirement and first-use creation checks are unchanged.

Also align the queued-collector fixture with #174111's documented contract:
uncaptured lifecycle events publish current updated facts. Select create or
updated session publications while retaining every payload, runtime, Stop and
authority assertion. A forced initial capture miss reproduced the exact hourly
failure with a correctly published Collector B row, and passes after this fix.

Current main with #175307 reverted passed both full files (48 tests). Restoring
it reproduced both cold-registration failures. The repair passes 148 tests
across the execution, restart, reclamation, reply and collector files; one
existing Linux-only killed-owner test remains skipped on macOS. Targeted state
and Gateway test type graphs, type-aware lint, formatting and P0-P2 review pass.
No timeouts, retries, schemas or permission contracts changed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
openclaw#175461)

Fix forward from openclaw#175307. The native admission helper recognized a committed
registration notice, but its outer callback still checked the retired caller.
Refusing that bookkeeping notice left an opened worker without its installed
identity and replaced the expected lifecycle refusal with unknown settlement.

End authorization for this already-observed COMMIT at the outer callback.
Receipt observation still validates and records the exact registration owner;
subsequent validation, preparation and command admission keep live authority.
Generic failed-report retirement and first-use creation checks are unchanged.

Also align the queued-collector fixture with openclaw#174111's documented contract:
uncaptured lifecycle events publish current updated facts. Select create or
updated session publications while retaining every payload, runtime, Stop and
authority assertion. A forced initial capture miss reproduced the exact hourly
failure with a correctly published Collector B row, and passes after this fix.

Current main with openclaw#175307 reverted passed both full files (48 tests). Restoring
it reproduced both cold-registration failures. The repair passes 148 tests
across the execution, restart, reclamation, reply and collector files; one
existing Linux-only killed-owner test remains skipped on macOS. Targeted state
and Gateway test type graphs, type-aware lint, formatting and P0-P2 review pass.
No timeouts, retries, schemas or permission contracts changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant