Skip to content

fix: harden setup, operations, and readiness - #20

Merged
joungminsung merged 4 commits into
mainfrom
agent/harden-lifecycle-readiness
Jul 26, 2026
Merged

joungminsung merged 4 commits into
mainfrom
agent/harden-lifecycle-readiness

Conversation

@joungminsung

@joungminsung joungminsung commented Jul 26, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • gate chat on model and corpus readiness and surface actionable recovery steps
  • harden instance startup, PID handling, backups, restore, upgrades, and embedding reindex resets
  • protect browser sessions and connector credentials, and make connector failures visible
  • complete connector setup UI, responsive readiness UX, Docker/CI paths, and deployment documentation
  • preserve legacy parser identifiers, project-scoped workspace state, and Node 20 web builds

Why

Installation and day-two operations could previously report healthy states while models or corpora were unusable, retain reusable browser credentials, or leave restore and process-management edge cases unsafe.

Impact

Operators now get explicit readiness gates, recoverable maintenance workflows, safer session and connector handling, and deployment instructions that match actual runtime behavior.

Validation

  • npm ci (0 vulnerabilities)
  • npm run build (26/26 tasks)
  • npm run typecheck (50/50 tasks)
  • npm test (51/51 tasks, 648 tests)
  • Node 20 focused tokenization regression tests
  • npm run build --prefix docs-site
  • cloud and Ollama docker compose config
  • missing Compose model variables rejected
  • git diff --check

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c956864c8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (disabledPlugins.has(name)) continue
if (registry.get(name)) continue
try {
const mod = await importPackage(name, projectDir)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Normalize legacy plugin identifiers before importing

Existing configurations generated by the pre-change init command contain identifiers such as @opendocuments/parser-pdf, while the installable package is named opendocuments-parser-pdf. Since bootstrap now imports config.plugins directly instead of unconditionally loading the installed parser packages, upgraded developer/enterprise/all projects log module-not-found errors and lose PDF, DOCX, XLSX, or code parsing. Normalize the legacy identifiers or retain a compatibility alias before calling importPackage.

AGENTS.md reference: AGENTS.md:L165-L167

Useful? React with 👍 / 👎.

Comment on lines +14 to +18
const configuredWorkspace = existsSync(currentWorkspacePath)
? readFileSync(currentWorkspacePath, 'utf-8').trim()
: undefined
cachedCtx = await bootstrap({
...(configuredWorkspace ? { configOverrides: { workspace: configuredWorkspace } } : {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Scope workspace selection to the current project

When a user switches workspace in project A and then runs any CLI command in project B, this process-wide ~/.opendocuments/current-workspace value overrides project B's configured workspace. Bootstrap then calls ensure() for that unrelated name, silently creates it in B's database, and indexes or searches data in the wrong workspace. Store the selection per instance/data directory, or only apply it after confirming it belongs to the current project.

AGENTS.md reference: AGENTS.md:L302-L302

Useful? React with 👍 / 👎.

Comment thread packages/cli/src/commands/backup.ts Outdated
Comment on lines +137 to +139
const record = readServerPid(pidFile)
if (!record || !isRecordedServerProcess(record)) return
throw new Error('OpenDocuments server is running. Run "opendocuments stop" before backup or restore.')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fail closed on an unreadable PID record

If server.pid exists but is malformed—particularly the plain numeric PID written by the previous CLI—this treats the instance as stopped and proceeds to copy or replace SQLite, WAL, and LanceDB files while that older server may still be running. That can produce an inconsistent backup or corrupt an active restore; unlike a genuinely absent or verified-stale PID, an unverifiable record must abort with the same actionable stop instruction.

AGENTS.md reference: AGENTS.md:L89-L93

Useful? React with 👍 / 👎.

Comment thread docker-compose.yml Outdated
Comment on lines +16 to +17
OPENDOCUMENTS_MODEL_LLM: ${OPENDOCUMENTS_MODEL_LLM:-qwen2.5:14b}
OPENDOCUMENTS_MODEL_EMBEDDING: ${OPENDOCUMENTS_MODEL_EMBEDDING:-mxbai-embed-large}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid Ollama defaults for cloud Compose providers

When users run the newly documented OpenAI Compose command, they override only provider, base URL, and key, so these defaults still send qwen2.5:14b and mxbai-embed-large to OpenAI. The startup embedding probe then fails and the server enters degraded mode. Require provider-appropriate model variables for cloud deployments or make these defaults conditional instead of applying Ollama model names to every provider.

Useful? React with 👍 / 👎.

Comment on lines +14 to +16
const rawKey = (
opts.ipOnly ? undefined : c.req.header('x-api-key')
) || getClientIp(c, opts.trustedProxy) || 'anonymous'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Rate-limit cookie sessions by their authenticated key

For the new browser and OAuth sessions, requests carry opendocuments_session rather than X-API-Key, so this post-auth limiter falls back to the client IP even though c.get('auth') identifies a unique key. All Web UI users behind the same reverse proxy or corporate NAT therefore share the 60-request bucket, and one user's configured per-key limit is applied against the shared count. Use the validated record ID or session key for the non-ipOnly limiter.

Useful? React with 👍 / 👎.

Comment thread packages/web/package.json Outdated
Comment on lines +23 to +28
"@vitejs/plugin-react": "^6.0.4",
"autoprefixer": "^10.4.0",
"postcss": "^8.4.0",
"tailwindcss": "^3.4.0",
"typescript": "^5.5.0",
"vite": "^6.0.0"
"vite": "^8.1.5"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the web toolchain compatible with Node 20.0

The repository advertises Node.js >=20.0.0, but the lockfile resolves this dependency to Vite 8.1.5, whose engine is ^20.19.0 || >=22.12.0; @vitejs/plugin-react 6 has the same restriction. Consequently supported Node 20.0–20.18 environments fail installation under engine-strict or cannot reliably build the CLI's now-required bundled Web UI. Retain a compatible Vite version or raise the repository engine floor and CI coverage.

AGENTS.md reference: AGENTS.md:L9-L12

Useful? React with 👍 / 👎.

@joungminsung
joungminsung merged commit f3aba15 into main Jul 26, 2026
2 checks passed
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.

1 participant