feat(platform): Fix pg-boss queue conflict and add safety standards

Summary:
- Fix pg-boss queue conflict (duplicate key violation on queue_pkey)
- Add global error listener to prevent process crash
- Reduce connection pool from 10 to 4
- Add graceful shutdown handling (SIGTERM/SIGINT)
- Fix researchWorker recursive call bug in catch block
- Make screeningWorker idempotent using upsert

Security Standards (v1.1):
- Prohibit recursive retry in Worker catch blocks
- Prohibit payload bloat (only store fileKey/ID in job.data)
- Require Worker idempotency (upsert + unique constraint)
- Recommend task-specific expireInSeconds settings
- Document graceful shutdown pattern

New Features:
- PKB signed URL endpoint for document preview/download
- pg_bigm installation guide for Docker
- Dockerfile.postgres-with-extensions for pgvector + pg_bigm

Documentation:
- Update Postgres-Only async task processing guide (v1.1)
- Add troubleshooting SQL queries
- Update safety checklist

Tested: Local verification passed
This commit is contained in:
2026-01-23 22:07:26 +08:00
parent 9c96f75c52
commit 61cdc97eeb
297 changed files with 1147 additions and 21 deletions

View File

@@ -107,5 +107,6 @@ vite.config.*.timestamp-*

View File

@@ -74,5 +74,6 @@ exec nginx -g 'daemon off;'

View File

@@ -230,5 +230,6 @@ http {

View File

@@ -59,3 +59,4 @@ export default apiClient;

View File

@@ -258,3 +258,4 @@ export async function logout(): Promise<void> {

View File

@@ -24,3 +24,4 @@ export * from './api';

View File

@@ -48,3 +48,4 @@ export async function fetchUserModules(): Promise<string[]> {

View File

@@ -128,3 +128,4 @@ export default ModulePermissionModal;

View File

@@ -39,3 +39,4 @@ export default AdminModule;

View File

@@ -204,3 +204,4 @@ export const TENANT_TYPE_NAMES: Record<TenantType, string> = {

View File

@@ -88,3 +88,4 @@ export default AgentCard;

View File

@@ -18,3 +18,4 @@ export { ChatWorkspace } from './ChatWorkspace';

View File

@@ -182,3 +182,4 @@ export const BRAND_COLORS = {

View File

@@ -220,3 +220,4 @@

View File

@@ -577,5 +577,6 @@ export default FulltextDetailDrawer;

View File

@@ -170,5 +170,6 @@ export const useAssets = (activeTab: AssetTabType) => {

View File

@@ -160,5 +160,6 @@ export const useRecentTasks = () => {

View File

@@ -130,5 +130,6 @@ export function useSessionStatus({

View File

@@ -122,5 +122,6 @@ export interface DataStats {

View File

@@ -118,5 +118,6 @@ export type AssetTabType = 'all' | 'processed' | 'raw';

View File

@@ -305,5 +305,6 @@ export default KnowledgePage;

View File

@@ -60,5 +60,6 @@ export interface BatchTemplate {

View File

@@ -139,4 +139,5 @@ export default function AgentModal({ visible, taskCount, onClose, onConfirm }: A

View File

@@ -59,4 +59,5 @@ export default function BatchToolbar({ selectedCount, onRunBatch, onClearSelecti

View File

@@ -82,4 +82,5 @@ export default function FilterChips({ filters, counts, onFilterChange }: FilterC

View File

@@ -72,4 +72,5 @@ export default function Header({ onUpload }: HeaderProps) {

View File

@@ -126,4 +126,5 @@ export default function ReportDetail({ report, onBack }: ReportDetailProps) {

View File

@@ -54,4 +54,5 @@ export default function ScoreRing({ score, size = 'medium', showLabel = true }:

View File

@@ -89,4 +89,5 @@ export default function Sidebar({ currentView, onViewChange, onSettingsClick }:

View File

@@ -31,4 +31,5 @@ export { default as TaskDetail } from './TaskDetail';

View File

@@ -300,4 +300,5 @@ export default function Dashboard() {

View File

@@ -249,4 +249,5 @@

View File

@@ -351,3 +351,4 @@ export default TenantListPage;

View File

@@ -260,3 +260,4 @@ export async function fetchModuleList(): Promise<ModuleInfo[]> {

View File

@@ -479,3 +479,4 @@ export default AIStreamChat;

View File

@@ -179,3 +179,4 @@ export default ConversationList;

View File

@@ -31,3 +31,4 @@ export type {

View File

@@ -323,3 +323,4 @@ export default useAIStream;

View File

@@ -252,3 +252,4 @@ export default useConversations;

View File

@@ -73,5 +73,6 @@ export { default as Placeholder } from './Placeholder';

View File

@@ -53,5 +53,6 @@ interface ImportMeta {