Skip to content

Refactor prompt handling, agent workflow, and image builds#3302

Merged
WMC001 merged 19 commits into
developfrom
dev/deploy
Jun 26, 2026
Merged

Refactor prompt handling, agent workflow, and image builds#3302
WMC001 merged 19 commits into
developfrom
dev/deploy

Conversation

@hhhhsc701

Copy link
Copy Markdown
Contributor

No description provided.

hhhhsc and others added 18 commits June 22, 2026 15:37
# Conflicts:
#	deploy/offline/build_offline_package.sh
#	deploy/sql/migrations/v2.2.0_0601_add_preserve_source_file_to_knowledge_record_t.sql
#	deploy/sql/migrations/v2.2.0_0603_add_greeting_fields_to_ag_tenant_agent_t.sql
#	deploy/sql/migrations/v2.2.1_0601_add_agent_verification_config.sql
#	deploy/sql/migrations/v2.2.1_0601_add_preserve_source_file_to_knowledge_record_t.sql
#	deploy/sql/migrations/v2.2.1_0603_add_greeting_fields_to_ag_tenant_agent_t.sql
#	deploy/sql/migrations/v2.2.1_0605_add_ag_agent_repository_t.sql
#	deploy/sql/migrations/v2.2.1_0609_add_selected_agent_version_no_to_agent_relation_t.sql
#	docker/deploy.sh
#	docker/sql/v2.2.0_0601_add_preserve_source_file_to_knowledge_record_t.sql
#	docker/sql/v2.2.0_0603_add_greeting_fields_to_ag_tenant_agent_t.sql
#	k8s/helm/deploy.sh
#	k8s/helm/nexent/charts/nexent-common/files/init.sql
# Conflicts:
#	deploy/sql/migrations/v2.2.2_0622_update_left_nav_menu.sql
#	docker/init.sql
#	k8s/helm/nexent/charts/nexent-common/files/init.sql
# Conflicts:
#	deploy/sql/migrations/v2.2.0_0615_context_management_capacity_schema.sql
#	deploy/sql/migrations/v2.2.0_0617_context_management_capacity_data_fix.sql
#	deploy/sql/migrations/v2.2.2_0622_update_left_nav_menu.sql
#	docker/init.sql
#	k8s/helm/nexent/charts/nexent-common/files/init.sql
#	make/web/Dockerfile
Comment thread deploy/images/dockerfiles/web/Dockerfile
Comment thread deploy/images/dockerfiles/main/Dockerfile
Comment thread deploy/common/run-sql-migrations.sh
Comment thread deploy/docker/compose/docker-compose.yml
@wuyuanfr

Copy link
Copy Markdown
Collaborator

整体检视意见

1. sdk/nexent/core/agents/agent_context.py (+1382/-1382) 无实质变更

git diff -w 后 diff 为空,全部是空白/行尾格式变更,无逻辑改动。建议在 PR description 中说明这是格式化变更,避免 reviewer 浪费时间逐行查看。

2. 旧目录清理

docker/k8s/make/ 目录下的文件被删除/移动到 deploy/,但仓库根目录可能仍残留部分旧文件。建议确认这些残留文件是否应该一并清理,避免两套配置并存造成混淆。

3. deploy/common/common.sh 体量

作为 source-only 的 shell 库,1451 行偏大。后续建议按职责拆分(如 password.shconfig.shenv-utils.sh),降低维护成本。当前不影响功能。

4. 自动 SQL migration runner 设计合理

run-sql-migrations.sh 解决了之前手动跑迁移的痛点:

  • nexent-configmigrate 模式执行迁移,其他 backend 容器用 wait 模式等待——避免竞争
  • 使用 pg_advisory_lock 做分布式锁,多副本安全
  • 基于文件 checksum 判断是否需要重跑,支持幂等

@WMC001 WMC001 merged commit 9d4405a into develop Jun 26, 2026
17 of 18 checks passed
@hhhhsc701 hhhhsc701 deleted the dev/deploy branch June 26, 2026 06:43
Comment thread deploy/docker/deploy.sh
PORT_SOURCES=()

# Always include the main .env if present, plus any .env.* files
# Always include the root .env if present, plus image-source env variants.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker和k8s用到的.env还是放到deploy的env目录下,根目录下的.env需要给本地启动使用

@Dallas98 Dallas98 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追加事后审查 1/3:单条独立 review submission。

COPY --from=builder /opt/frontend-dist .

ENV NODE_ENV=production
ENV HOSTNAME=localhost

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追加事后审查:ENV HOSTNAME=localhost 会让 Node.js 只绑定 loopback 地址,导致宿主机无法通过 Docker 端口映射访问 3000 端口(容器内 curl localhost:3000 正常,但宿主机 curl 127.0.0.1:3000 会 connection refused)。

建议改为:

ENV HOSTNAME=0.0.0.0

影响:该点合入后可能在真实使用、部署、权限或测试场景中形成回归风险,问题暴露时定位成本会偏高。
建议:后续围绕这个风险点补齐输入校验、权限/租户边界、配置来源收敛或针对性回归测试。

@Dallas98 Dallas98 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追加事后审查 2/3:单条独立 review submission。

COPY backend/pyproject.toml /opt/backend/pyproject.toml
RUN --mount=type=cache,id=nexent-main-uv-${TARGETARCH},target=/root/.cache/uv,sharing=locked \
uv sync --link-mode copy $(test -n "$MIRROR" && echo "-i $MIRROR")
# Layer 1: install sdk in link mode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追加事后审查:注释写的是 "install sdk in link mode",但 --link-mode copy 是 uv 的文件链接策略,不是 editable install(-e)。SDK 源码改了仍然需要重 build image 才能生效。

建议将注释改为更准确的描述,例如 # Layer 1: install sdk (copy mode),避免与 editable install 混淆。

影响:该点合入后可能在真实使用、部署、权限或测试场景中形成回归风险,问题暴露时定位成本会偏高。
建议:后续围绕这个风险点补齐输入校验、权限/租户边界、配置来源收敛或针对性回归测试。

@Dallas98 Dallas98 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追加事后审查 3/3:单条独立 review submission。

"$@"
}

escape_sql_literal() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追加事后审查:escape_sql_literal 用于构造 SQL,虽然当前调用来源基本可控,但作为 defense-in-depth 建议对输入做白名单校验(例如只允许 [a-zA-Z0-9_.-]),防止意外传入特殊字符导致 SQL 注入。

影响:该点合入后可能在真实使用、部署、权限或测试场景中形成回归风险,问题暴露时定位成本会偏高。
建议:后续围绕这个风险点补齐输入校验、权限/租户边界、配置来源收敛或针对性回归测试。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants