Repository navigation
refactor(crypto): share SHA-256 identifier helpers - #140887
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
801a9ef to
d31dc01
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 10:43 AM ET / 14:43 UTC. ClawSweeper reviewWhat this changesThe PR consolidates SHA-256 digests and diagnostic identifier labels into a shared Node-only helper while preserving existing public exports and output formatting. Merge readiness✅ Ready for maintainer review The consolidation remains useful and is absent from current main. No actionable introduced defect was found. The earlier validation concern has an evidence-backed disposition; the reported UI CI failure remains a normal landing gate. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw hashes identifiers for transport diagnostics, agent logs, and credential fingerprints in status output. The shared helper converts strings or bytes into stable hexadecimal digests while existing callers retain their presentation and authorization decisions. flowchart LR
A[Transport diagnostics] --> D[Shared Node hashing helper]
B[Agent logging] --> D
C[Status credential summaries] --> D
D --> E[Hexadecimal digests]
D --> F[Trimmed identifier labels]
E --> G[Logs and status output]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -21, Tests 0, Config +8. Total -13 across 19 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one Node-only hashing owner, preserve the established SDK exports and diagnostic formats, and keep browser imports independent of Node crypto. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR removes duplicate implementations rather than repairing a reported runtime defect; the duplication is directly visible on current main. Is this the best way to solve the issue? Yes. A shared Node-only leaf removes the duplication while retaining existing public entrypoints, raw-prefix semantics, and logging presentation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dcc68718f57e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
9e11b7e to
65b859f
Compare
Preserve raw digest slicing and logging label normalization in a Node-only normalization-core subpath. Keep browser exports and public logging contracts unchanged. Proof: 453 old/new comparisons and browser-root compilation passed; independent review clean. Consumer and package gates continue in the PR.
NodeNext requires the exact TypeScript source mapping before package artifacts exist. A resolver probe fails without this mapping and resolves the canonical owner with it; independent review is clean.
65b859f to
e3d6215
Compare
|
Merged via squash.
|
* refactor(crypto): share SHA-256 identifier helpers Preserve raw digest slicing and logging label normalization in a Node-only normalization-core subpath. Keep browser exports and public logging contracts unchanged. Proof: 453 old/new comparisons and browser-root compilation passed; independent review clean. Consumer and package gates continue in the PR. * fix(build): resolve shared crypto source during type checks NodeNext requires the exact TypeScript source mapping before package artifacts exist. A resolver probe fails without this mapping and resolves the canonical owner with it; independent review is clean.
What Problem This Solves
Transport diagnostics and core identifier labels independently implement SHA-256 hashing and prefix formatting. Their matching logic can drift across package boundaries.
Why This Change Was Made
A dedicated
@openclaw/normalization-core/node-cryptosubpath owns hexadecimal digests, raw prefixes, and identifier labels. The private logging implementation is removed and its callers migrate together. Existing core, AI utility, and publiclogging-coreexports remain available; no public export is removed or renamed.The Node-only leaf stays outside the browser root barrel. Raw prefixes retain native
slicesemantics; labels retain trimming, missing-value output, length clamping, and the public logging function's single read ofopts.len. Status still hashes its existing trimmed value with an eight-character prefix. File hashing, base64 variants, Retry-After, readers, and CJK budgeting remain with their owners. Explicit source mapping lets NodeNext resolve the new subpath before artifacts exist.User Impact
None intended. Hashes, diagnostic labels, status output, and public logging signatures remain unchanged. No dependency, configuration, schema, persistence, or protocol change.
Evidence
Candidate
e3d62154b051e203eb488399baa788c3515c0fe3is rebased onto main00f795a62bda4699ecf41252c037635bfa76b54d, including #141238 (5a9ad4d4939996e8e78dd0da608fce03736d3fcc). That main-side change fixes stale rotation fixtures against #139465's documented retry budget; this PR makes no failover-policy or rotation-assertion changes.node scripts/run-vitest.mjs packages/ai/src/transports/openai-responses-continuation.test.ts packages/ai/src/transports/openai-responses-debug.test.ts src/infra/crypto-digest.test.ts src/agents/auth-profiles/state-observation.test.ts src/agents/embedded-agent-error-observation.test.ts src/agents/embedded-agent-runner/run/failover-observation.test.ts src/agents/workspace-run.test.ts src/commands/status-all/channels.mattermost-token-summary.test.ts src/agents/embedded-agent-runner.run-embedded-agent.auth-profile-rotation.e2e.test.ts src/agents/sessions/session-manager.test.ts src/config/sessions/session-accessor.test.ts.node scripts/check-changed.mjs: ratchets, formatting, SDK exports/surface budgets, core/test/UI/extension types, unused-export scans and core lint passed. Extension lint preparation then hit the documented nested-worktree limitation:Declaration input escapes checkoutthrough the ancestornode_modules/punycode/package.json. No suppression, baseline or ancestor-install change was made; the required isolated CI/Testbox gates cover that boundary.pnpm build: passed in 5m 27s, including package/SDK declarations, plugins and Dashboard budgets. Startup JavaScript: 349,599 / 350,953 B gzip, 8 / 18 requests.The earlier four rotation failures were fixture assumptions on main, not SHA-256 output differences. The blocker is resolved by #141238. No dependency, configuration, persistent-state, or protocol behavior was changed to clear it.
CI retry evidence
UI shard 4/7 passed 302 tests and failed one:
chat-stream-runtime-budgets.e2e.test.ts→commits a streamed delta burst in frame-bound transcript batches. At line 517 the measured frame-scheduled share was 8/9 = 0.8888888888888888, below the required 0.9. This PR does not change chat rendering or the budget assertion.One isolated reproduction on the same source passed with 3/3 frame-scheduled host updates:
CI=1 OPENCLAW_UI_E2E_SKIP_REAL_GATEWAY=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-stream-runtime-budgets.e2e.test.ts -t 'commits a streamed delta burst in frame-bound transcript batches'(Node 24.20.0, macOS; one passed, four filtered). That pass does not replace failing Linux CI. No UI code, assertions or budget was changed. The single authorized test rerun passed UI shard 4/7, and the complete CI run is green on this exact head. The earlier Dependency Guard HTTP 429 retry was an infrastructure retry, separate from this test rerun.