Skip to content

refactor(core): consolidate runtime discriminant facts - #176012

Merged
steipete merged 1 commit into
mainfrom
deslop/z32-6-core-runtime-facts-20261015
Oct 18, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z32-6-core-runtime-facts-20261015

Conversation

@steipete

@steipete steipete commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Core runtime discriminants have independent inventories for labels, startup phases, diagnostic delivery policy, HTTP errors, secret-resolution explanations, worker terminal states, and Gateway profile dependency. The duplicate mappings can drift even though each responsibility already has an owner.

What Changed

Execution phases declare their label and startup bucket together. Diagnostic event rows own priority and public-exclusion facts. HTTP and secret error descriptors replace parallel mappings. Worker RPC clients use the connection owner's existing terminal predicate. The existing Gateway method descriptors now carry the 26 exact profile-dependent method flags; session-target and prefix policies remain distinct and unchanged. The narrower family helper is renamed, with its only caller migrated and its old export removed.

This is the core-runtime area of a wider mapping-owner cut, split by area to keep attribution bounded. No new registry, state store, SDK surface, wire shape, permission, or dependency is introduced. Supported behavior and user-visible text remain unchanged. Security/effect checks, lifecycle settlement, and ordinary crash/restart durability are retained.

Best-effort tradeoffs accepted

  • An invalid internal execution phase outside the closed typed union no longer falls through an exhaustive switch to an undefined startup bucket. The mapper introduced in fix: recognize verified team admins as channel owners #153508 already handles every producer-owned phase; no external-input validation is removed. An impossible internal value now fails at its owner rather than silently omitting the bucket.
  • Public diagnostic exclusion is still membership-only. Its internal derived array follows descriptor order; all actual listener decisions remain identical, and no serialized or user-facing ordering contract changes.

Evidence

The isolated actual-module Gateway probe compares against pinned main 33b5bee: all 545 registered descriptors match across every field, all 26 moved flags retain authenticated-profile admission, and 52 custom/unknown/prototype/prefix controls retain classification and rejection behavior. The real registry consumes the resulting descriptors with unchanged scope/profile outcomes. This is descriptor/registry boundary proof, not live authorization or provider proof.

Existing source-parity evidence also covers all 14 phase labels/startup buckets, diagnostic membership and 1,008 listener decisions, HTTP error messages/statuses/text, secret error explanations and recovery, and worker terminal/client scenarios. All 184 focused tests passed across eleven suites/five serial shards with one worker and isolated HOME/OpenClaw/XDG state. Removing the proposal's redundant always-true async filter is covered by a subsequent 31-test diagnostics replay. The first scoped lint caught the method table exceeding its 700-line limit; reusing one startup/profile policy for three methods resolves it without a suppression or allowance change. The actual-module 545-descriptor comparison and 12 Gateway tests pass again after that simplification. Final touched-graph types, scoped lint/format, cycle checks, and independent review pass.

Final format checks, official scoped syntax lint, and touched-production-graph typecheck pass. Both official cycle checks report zero cycles. The final isolated lint-suppressions suite passes all14tests (143.54s including a65.02s Git inventory case; wrapper199.21s). Independent complete-candidate review is scoped-clean with no accepted/actionable P0-P2 findings (correctness confidence0.96). Broad tests/builds remain exact-head hosted CI gates; no full local suite or build was run.

Production delta: 160 added, 257 removed, 97 net lines removed across 14 production files. One existing worker-client fixture is migrated to the real owner predicate; its assertions are unchanged.

Conflict repair

GitHub reported CONFLICTING at reviewed head 77ccfaf80b16eff8bca18c8b23221a20909dfec7. The branch is rebased onto main 7c0b2ae as signed head 8ad7cd8. The only conflict was the execution module's import block: preserve main's direct failover/classify import and add the phase-owner import. All other 14 changed-file blobs are identical to the independently reviewed candidate. Dependency inputs are unchanged.

Post-conflict formatting and official scoped syntax lint pass. The complete touched-production graph typecheck passes; runtime and static cycle checks both report zero. The fresh isolated suppression suite passes all 14 tests (133.44s, wrapper181.18s). Two execution suites were also attempted, but stopped after 13.5 minutes of cold preparation with no completed test cases; their worker cleanup fully drained and the invocation exited143. That runtime attempt is incomplete evidence, not a passing test or product failure. The original 184 focused tests and subsequent 31 diagnostics/12 Gateway replays remain valid prior-head evidence; exact repaired-head hosted CI is the broad gate.

Exact repaired-head hosted CI 39093004530 completed successfully at 8ad7cd8658d06fef9eef75caf7506d26ffa3c01e. Complete exact-head check-run enumeration confirms successful openclaw/ci-gate, production/test types, lint, selected runtime/UI suites, and security-fast. No CI reruns or inherited-failure exception were needed.

@clawsweeper

clawsweeper Bot commented Oct 18, 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 gateway Gateway runtime agents Agent runtime and tooling size: M labels Oct 18, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR consolidates execution phases, diagnostic policies, error descriptions, worker terminal checks, and Gateway profile requirements into their existing owners.

Example: An HTTP request exceeds its configured body limit.

  • Before: Separate mappings produce HTTP 413 and “Payload too large.”
  • After: One descriptor produces the same HTTP 413 and response text.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is coherent and source-reviewed without actionable findings; the supplied validation remains primarily module-parity and test evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate and does not materially change authority; reported module-parity and focused-test evidence supports classification equivalence, while the inspected screenshots cover an unrelated UI scenario.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Duplicated internal classification facts can drift and make status, recovery, delivery, or admission behavior inconsistent.
Reason: The maintainer-authored direction reduces duplicate ownership while retaining supported output, defaults, and security checks.

Merge readiness

✅ Ready for maintainer review

This PR removes duplicate runtime mappings through existing owners without an identified correctness regression; the earlier conflict and draft blockers are resolved.

Priority: P3
Reviewed head: 8ad7cd8658d06fef9eef75caf7506d26ffa3c01e

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The reported module-parity probe and focused suites do not demonstrate a shipped Gateway or worker execution of this refactor.
Agent review details

How this fits together

Internal runtime owners classify execution phases, diagnostics, errors, connection states, and Gateway methods; their consumers use those facts for status, delivery, recovery, and request admission.

flowchart TD
  A[Runtime events and requests] --> B[Existing owner descriptors]
  B --> C[Agent startup status]
  B --> D[Diagnostic delivery]
  B --> E[HTTP and secret errors]
  B --> F[Gateway profile admission]
  G[Worker connection owner] --> H[Worker RPC clients]
Loading

Technical review

Best possible solution:

Retain the consolidation in the existing owners and let the current head complete its required CI gates.

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

This refactor does not claim a reproducible user bug; source inspection verifies the moved mappings without executing target code.

Is this the best way to solve the issue?

The change follows the smallest complete consolidation: existing owners hold each fact, callers migrate together, and replaced mappings disappear without new runtime machinery.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Execution phase labels and startup buckets keeps the original intent (de18f77: Centralize watchdog phase state; the later startup mapper in c69b8b9 classifies those producer-owned phases.)
  • Gateway exact-name profile requirements keeps the original intent (4c0588d: Prepare authenticated personal-profile facts before profile-dependent work; subsequent account and identity features extended the inventory.)
  • Diagnostic queue-policy leaf keeps the original intent (8073d55: Keep event inventories acyclic while retaining trusted asynchronous delivery and public exclusions.)
  • HTTP body-limit errors keeps the original intent (3cbcba1: Enforce bounded webhook body handling with typed failures and corresponding HTTP responses.)
  • Secret-resolution explanations keeps the original intent (17c2ce0: Distinguish provider and reference failures so optional owners can be isolated while required and unknown ownership stays fail-closed.)
  • Worker terminal classification keeps the original intent (6cd1133: Bound worker connection and RPC lifecycles; the later terminal-subscription refactor retained emitted-state classification.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 1d85663 adds src/gateway/methods/core-descriptors.ts:114 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1d856637dc0d; files: src/gateway/methods/core-descriptors.ts)
  • scoootscooob: Raw commit e4e2305 adds src/gateway/methods/core-descriptors.ts:129 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: e4e230510c15; files: src/gateway/methods/core-descriptors.ts)

PR surface

Source -97, Tests +1. Total -96 across 15 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 14 160 257 -97
Tests 1 2 1 +1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 162 258 -96

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is internal cleanup preserving supported behavior, with no established current user-facing failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-18T02:53:12.882Z sha 77ccfaf80b16eff8bca18c8b23221a20909dfec7 :: needs changes before merge. :: none

Reviewed October 17, 2026, 11:21 PM ET / October 18, 2026, 03:21 UTC (Revision 2).

@steipete
steipete force-pushed the deslop/z32-6-core-runtime-facts-20261015 branch from 77ccfaf to 8ad7cd8 Compare October 18, 2026 03:15
@steipete
steipete marked this pull request as ready for review October 18, 2026 03:15
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 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-18T03:19:04.827385Z 8ad7cd8 Draft marked ready
ℹ️ 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.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 8ad7cd8658d06fef9eef75caf7506d26ffa3c01e
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/methods/core-descriptor-types.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/methods/core-descriptors.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/methods/core-method-policy.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/methods/core-profile-access.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/secrets/resolve-errors.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@steipete
steipete merged commit 1dedf41 into main Oct 18, 2026
242 of 244 checks passed
@steipete
steipete deleted the deslop/z32-6-core-runtime-facts-20261015 branch October 18, 2026 20:33
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: M 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