Repository navigation
refactor(integrations): generate the flush acknowledgement helpers from one source - #2645
Merged
Merged
Conversation
…om one source OpenClaw's src/lifecycle.ts and Pi's src/flush.ts each defined nonNegativeInteger, the flush response check, and scopeCorrelation. The checks and the correlation hash were the same; only the error each plugin throws for an invalid flush response differed. integrations/lifecycle/flush-progress.ts is now the source, and scripts/generate_integration_lifecycle.py writes it to src/flush-progress.ts in both plugins, so `make check` rejects a copy that drifts. readFlushProgress returns undefined for a response that is not a flush result. Each plugin's flushProgress keeps throwing its own error: OpenClaw a plain Error with the same message, Pi InvalidResponseError for /v1/memory/flush. Both plugins' tests still read tests/integration_conformance/cases.json. Behavior does not change.
Fengzdadi
requested review from
AlexStocks,
PsiACE,
Zxf-xufeng and
yihong0618
as code owners
November 14, 2026 02:24
16 of 17 tasks
hidb4ai
approved these changes
Nov 15, 2026
hidb4ai
left a comment
Contributor
There was a problem hiding this comment.
Reviewed d411ab4. No blocking findings. The shared helpers preserve flush acknowledgement validation, host-specific errors, and Scope correlation; the generated copies are included in both plugin packages. No database schema or public API changes.
hireview001
approved these changes
Nov 16, 2026
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue or RFC does this PR close?
Part of #2250. Follows #2623, which made
integrations/lifecycle/the source of the TypeScript helpers that host plugins ship, and #2180, which aligned the OpenClaw and Pi flush acknowledgement.Rationale for this change
#2180 gave OpenClaw and Pi the same flush acknowledgement, checked by the shared cases in
tests/integration_conformance/cases.json. Each plugin still keeps its own copy of the three helpers behind it:nonNegativeInteger;flushProgress);scopeCorrelation, the hashed Scope label in diagnostics.Nothing keeps the copies in step. This PR generates them from one source, as #2623 did for the transport.
Before the move the copies were compared:
Error("PowerContext returned an invalid flush payload"). Pi throws its ownInvalidResponseError('/v1/memory/flush'). This PR keeps both.What changes are included in this PR?
Source and copies
integrations/lifecycle/flush-progress.tsexportsFlushProgress,nonNegativeInteger,readFlushProgress, andscopeCorrelation.readFlushProgressapplies the same checks as before.undefinedfor a response that is not a flush result, so the module needs nothing beyond Node.js built-ins and no plugin's error type.scripts/generate_integration_lifecycle.pywrites it tosrc/flush-progress.tsin the OpenClaw and Pi plugins.make checkandtests/test_integration_lifecycle.pyreject a copy that drifts. The name avoids Pi's existingsrc/flush.ts, which the generator's check would otherwise reject.Plugins
src/lifecycle.ts:flushProgresscallsreadFlushProgressand throws the sameErroras before;sourcePositionuses the sharednonNegativeInteger;FlushProgresstype,nonNegativeInteger,scopeCorrelation, and thenode:cryptoimport are removed;src/flush.ts:flushProgresscallsreadFlushProgressand throws the sameInvalidResponseErroras before. The localFlushProgress,nonNegativeInteger,scopeCorrelation, and thenode:cryptoimport are removed.src/capture.tskeeps importingflushProgressfromsrc/flush.ts.tests/integration_conformance/cases.jsonand are unchanged.Are there any user-facing changes?
No. Flush acknowledgement, error handling, and diagnostics are unchanged.
How was this change tested?
make openclaw-plugin-test: tests, type check, and build.make pi-test: tests and type check.make check, includingscripts/generate_integration_lifecycle.py --check, andgit diff --check.uv run pytest tests/test_integration_lifecycle.py tests/test_integration_shared_files.py tests/test_ci_changes.py tests/test_integration_manifest.py.No real host was run; the change does not alter behavior.
Self-review against
REVIEW.md, plus an independent review pass. Fixed:scopeCorrelationis covered by each plugin's diagnostics tests.Confirmed:
readFlushProgressisthrowbecomingreturn undefined, and each plugin mapsundefinedback to its old error;FlushProgressfrom Pi'ssrc/flush.ts;Left as notes:
flushProgressthat turnsundefinedinto its own error. Passing an error into the shared module would make it depend on plugin error types.integrations/lifecycle/also runs the DSH, Cindy, and OpenCode suites, which do not ship this module. Splitting the path rule per file is not worth it yet.TYPESCRIPT_COPIESentry abovetransport.ts. Whichever merges second keeps both entries in name order and rerunsmake integration-lifecycle.AI usage statement
Claude Code (Claude Opus 5.5) wrote the change and this description, and ran the checks above.