fix: 修复任务生命周期与调度就绪,优化执行和构建开销 - #3069
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🟡 Changes recommended
Lifecycle races, incomplete scheduler reconciliation, and build provenance gaps can still produce incorrect state or artifacts.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Improves task lifecycle correctness, scheduler readiness, runtime overhead, and reproducible container builds.
Changes:
- Unifies process/log cleanup and adds scheduler recovery safeguards.
- Adds schema migration and shell/runtime optimizations.
- Strengthens CI, build provenance, and regression coverage.
File summaries
| File | Description |
|---|---|
test/back/worker-apm.test.cjs |
Tests worker APM policy. |
test/back/task-time.test.cjs |
Tests timestamp optimization. |
test/back/subscription-cleanup.test.cjs |
Tests subscription cleanup failures. |
test/back/stop-race.test.cjs |
Tests stop/completion races. |
test/back/shell-api-parsing.test.cjs |
Tests shell API parsing. |
test/back/schema-migrations.test.cjs |
Tests migration safety. |
test/back/scheduler-readiness.test.cjs |
Tests readiness recovery. |
test/back/primary-apm.test.cjs |
Tests primary APM defaults. |
test/back/node-path-lock.test.cjs |
Tests cache locking. |
test/back/node-path-cache.test.cjs |
Tests Node path caching. |
test/back/manual-execution.test.cjs |
Tests manual task lifecycle. |
test/back/http-exclusive-listen.test.cjs |
Tests HTTP listener policy. |
test/back/execution-lifecycle.test.cjs |
Tests process and log lifecycle. |
test/back/env-name-parsing.test.cjs |
Tests environment parsing. |
test/back/build-provenance.test.cjs |
Tests build provenance. |
shell/task.sh |
Reduces timestamp subprocesses. |
shell/share.sh |
Optimizes parsing and timing. |
shell/otask.sh |
Uses cached Node path discovery. |
shell/node_path_cache.sh |
Implements locked path cache. |
shell/api.sh |
Consolidates token/response parsing. |
scripts/write-build-info.cjs |
Generates build metadata. |
scripts/benchmark-execution.cjs |
Adds execution benchmark. |
package.json |
Adds test/build scripts. |
ecosystem.config.js |
Configures container APM defaults. |
docker/verify-build.cjs |
Verifies image build inputs. |
docker/Dockerfile.debian310 |
Uses pinned Debian build inputs. |
docker/Dockerfile.debian |
Uses pinned Debian build inputs. |
docker/Dockerfile.310 |
Uses pinned Alpine build inputs. |
docker/Dockerfile |
Uses pinned Alpine build inputs. |
back/shared/schemaMigrations.ts |
Adds explicit schema migrations. |
back/shared/schedulerReadiness.ts |
Implements scheduler readiness state. |
back/shared/runCron.ts |
Uses unified process observation. |
back/shared/logStreamManager.ts |
Serializes writes and closure. |
back/shared/childProcess.ts |
Centralizes child lifecycle handling. |
back/services/subscription.ts |
Hardens subscription cleanup. |
back/services/schedule.ts |
Unifies scheduled process lifecycle. |
back/services/http.ts |
Adds exclusive listener mode. |
back/services/health.ts |
Checks scheduler readiness. |
back/services/cron.ts |
Revises stop/manual execution handling. |
back/schedule/health.ts |
Adds scheduler-local probe. |
back/schedule/client.ts |
Adds probes and RPC deadlines. |
back/loaders/initData.ts |
Configures scheduler recovery. |
back/loaders/db.ts |
Runs explicit migrations. |
back/app.ts |
Coordinates worker recovery and APM. |
back/api/system.ts |
Ensures response cleanup. |
back/api/health.ts |
Returns readiness-aware status codes. |
back/api/cron.ts |
Gates scheduler-dependent mutations. |
.github/workflows/validate.yml |
Adds validation workflow. |
.github/workflows/build-docker-image.yml |
Builds images from same-run artifacts. |
.dockerignore |
Reduces Docker build context. |
Review details
Suppressed comments (1)
back/schedule/client.ts:69
- The delete path has the same pre-RPC gap: a
waitForReadytimeout bypasses the callback that invalidates readiness, leaving health stale and returning 500 rather than 503. Invalidate and classify this rejection before propagating it.
await this.waitForReady(2000);
- Files reviewed: 50/50 changed files
- Comments generated: 6
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
7 tasks
This branch was successfully deployed
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.
任务停止与退出回调竞争时,旧执行可能覆盖新执行的状态;HTTP 健康检查成功也可能早于调度定义恢复。本 PR 修复这些生命周期与就绪问题,并改进执行开销、日志处理、数据库初始化和镜像构建一致性。
PR Type
What is the current behavior?
Issue Number: N/A
What is the new behavior?
queued_token区分每次排队;旧执行在等待并发名额、启动认领和最终清理时均不能接管新一代执行。配置更新及回滚不重写排队标识。upload-artifact升级到 v6、download-artifact升级到 v7,均原生使用 Node.js 24;项目测试运行时仍为 Node.js 20。Validation
Does this PR introduce a breaking change?
自定义 Docker 构建需要先生成
static/与构建信息,并提供匹配的源码提交和锁文件;不再从独立静态仓库拉取浮动产物。调度未就绪或配置锁等待超时时,健康接口/相关任务变更可能返回 503。高级 APM 可通过
QL_PRIMARY_APM=true、QL_WORKER_APM=true恢复;自定义多 HTTP worker 部署使用QL_HTTP_SHARED_LISTEN=true恢复共享监听。