You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes false failures in the MemOS local-plugin npm release workflow when the npm Registry has not propagated a newly published version to npm view yet.
The publish logic is extracted into .github/scripts/publish-local-plugin.sh so it can be tested independently. The helper now:
keeps the immediate pre-publish lookup for duplicate detection;
waits for post-publish visibility with bounded, capped backoff;
continues Tag, GitHub Release, and release PR creation when npm publish succeeded but registry visibility is still delayed;
still fails after three publish failures when the requested version remains absent.
The temporary directory created by mkdtempSync is cleaned up unconditionally at the end of runScenario, but there is no try/finally guard around the body. If any code between mkdtempSync and rmSync throws an uncaught exception (e.g., a future addition that can throw, or an unexpected spawnSync failure surface), the temp directory will be leaked on disk for the lifetime of the CI runner.
Suggested fix: wrap the body in a try/finally block so cleanup is guaranteed regardless of exceptions.
The "Test npm publish helper" step uses working-directory: . (workspace root) which overrides the global defaults: run: working-directory: apps/memos-local-plugin. This is intentional and correct for the path node --test .github/scripts/publish-local-plugin.test.mjs. However, the step does not declare a shell: key. On GitHub-hosted Linux runners this defaults to bash -e {0}, which works fine, but it is inconsistent with all other run: steps in the build-prebuilds job that explicitly set shell: bash. For robustness across runner environments and consistency within the file, add shell: bash.
All output from git ls-remote is discarded (>/dev/null 2>&1). If the command fails with a non-zero, non-2 status (e.g., authentication error, network timeout), the script retries silently and eventually calls exit "${status}" with no diagnostic information in the CI log.
By contrast, npm_version_exists captures output to ${npm_view_log} and prints it via sed before exiting. remote_tag_exists should do the same — either redirect to a log file and print it before exiting, or at minimum redirect stderr to stdout so GitHub Actions captures it.
Suggested fix:
local git_log
git_log="${RUNNER_TEMP}/memos-local-plugin-git-ls-remote.log"
git ls-remote --exit-code --tags origin "refs/tags/${release_tag}">"${git_log}"2>&1
status=$?
npm_version_exists can call exit (not return) when npm view fails with a non-404 error after 3 inner retries. When this happens inside wait_for_npm_version, the exit escapes the function and terminates the entire script — including the call at line 162 (wait_for_npm_version "${npm_visibility_attempts}") which runs afterpublish_accepted=true has already been set.
This means a transient npm registry error during post-publish visibility polling can abort the script with a non-zero exit code even when npm publish itself succeeded, potentially preventing tag and release creation for a package that was actually published.
Consider catching the exit from within wait_for_npm_version, or restructuring npm_version_exists so that a "cannot determine" case returns a distinct exit code (e.g., return 2) instead of calling exit, allowing callers to handle the ambiguous case.
5. .github/scripts/publish-local-plugin.sh (L98)
The test harness shims npm via a mock binary in binDirectory, but never shims git. This means the idempotent-rerun path — where npm_version_exists returns true and remote_tag_exists is called — is not exercised by any test. The real git ls-remote against origin would run (or fail) in the test environment, so the scenario where a version already exists on npm is effectively untested.
A mock git binary (or at least a git-ls-remote stub) should be added to binDirectory to enable testing of the idempotent-rerun, recovery-mode, and conflict-detection branches (lines 116–123 of the script).
🧹 Filtered 2 low-confidence OCR finding(s) before posting/fix-loop (existing_code_mismatch: 2).
Generated by cloud-assistant via Open Code Review.
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
area:coreMOS 编排层 / 框架底座 / 跨模块问题status:readyReady for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发
3 participants
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.
Description
Fixes false failures in the MemOS local-plugin npm release workflow when the npm Registry has not propagated a newly published version to
npm viewyet.The publish logic is extracted into
.github/scripts/publish-local-plugin.shso it can be tested independently. The helper now:npm publishsucceeded but registry visibility is still delayed;No new dependencies are required.
Related Issue (Required): N/A - follow-up to failed Action #35
Type of change
How Has This Been Tested?
Commands run:
The Node test suite passed 21/21 tests, including these regression scenarios:
404responses followed by successful visibility;make formatcould not run locally because Poetry is not installed in this checkout; this PR does not change Python files.Checklist
Reviewer Checklist