Skip to content

Sync chat routing, evaluation, and personal storage updates - #242

Merged
Luhaozhu merged 1 commit into
mainfrom
sync/ce-20261128-chat-routing
Nov 28, 2026
Merged

Luhaozhu merged 1 commit into
mainfrom
sync/ce-20261128-chat-routing

Conversation

@Luhaozhu

@Luhaozhu Luhaozhu commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Purpose and behavior

  • Before: Community Edition offered manual chat-mode selection, displayed the standard task evaluation prompt, and let users schedule an existing plan. Files pinned from cloud conversations were recorded as conversation artifacts.
  • After: This sync adds the optional intent routing and evaluation decisions, shows the agent checklist inside its answer, and saves eligible cloud deliverables into personal or linked project space. The schedule dialog accepts prompt tasks. Saved plan schedules become disabled and their history remains visible. My Space gains bulk selection and storage-usage updates.

Change walkthrough

  • Flow: Chat mode selection passes through src/backend/api/routes/v1/chat_modes.py and src/backend/core/chat/mode_router.py into the existing run pipeline. Turn completion queues the evaluation decision and exposes it through src/backend/api/routes/v1/chats/evaluations.py. Delivery writes through src/backend/core/files/artifacts/service.py, and src/backend/alembic/versions/ce_0049_retire_plan_automations.py retires old schedules.
  • Decisions: Derive the source through the Community Edition pipeline, reconcile against public main, and retain the existing Community upload ceiling at both ingress and the file endpoint. Community tests omit cases that require Enterprise team fixtures and its task monitor.

Risk and compatibility

  • Risk: high
  • Boundaries: The sync changes chat behavior, personal-space writes, and schedule configuration. Intent routing requires its feature and permission checks. Evaluation gating is optional. Interactive chat plans still work. The Community migration preserves execution history and leaves old schedules disabled.
  • Human review: Review the migration with existing schedule history, the chat-mode and evaluation states, and files delivered to personal or project space.

Verification

  • Evidence: The derived tree passed Community runtime and forbidden-file checks, binary asset checks, brand checks, and the license check. The final public candidate passed the isolated import/OpenAPI/ORM gates, the frontend production build, 83 focused backend tests, and the whitespace check. An isolated SQLite check confirmed that the migration disables a plan schedule, clears its triggers, and preserves an active prompt schedule.
  • Limits: Installed Community desktop upgrades and migration against an existing Community PostgreSQL deployment were outside these checks.

Recovery

  • Steps: Close or revert the PR. Preserve the database before rolling back an applied migration. Recreate any required retired workflow as a prompt schedule using its saved history.

Review follow-up

  • Disposition: Initial maintainer review pending.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T16:30:17.395372Z c324d57 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: c324d57188

ℹ️ 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".

Comment on lines +362 to +365
name = next(
candidate for candidate in numbered_names(art["filename"])
if not files.occupied(space, f"{directory}/{candidate}" if directory else candidate)
)

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 Reserve deliverable filenames atomically with the space write

When two conversations for the same user concurrently pin different files named, for example, report.txt, both calls can pass files.occupied() before either copy starts. SpaceFiles.copy_from() and write() lock only their individual writes and allow overwriting existing files, so the second copy silently replaces the first while both deliveries report success. A deterministic concurrent exercise of this function reproduced two successful results with only one working-space file remaining. Hold the space lock across filename selection and creation, or use create-if-absent semantics with collision retries; add a concurrent same-name delivery test that verifies both files survive.

Useful? React with 👍 / 👎.

Comment on lines +14 to +18
def upgrade() -> None:
op.execute(
sa.text(
"UPDATE scheduled_tasks SET status = 'disabled', next_run_at = NULL, "
"manual_trigger_at = NULL, last_error = :message WHERE task_type = 'plan'"

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 Apply plan-schedule retirement to SQLite upgrades too

On an existing desktop SQLite installation with active plan schedules, this retirement never runs: core/db/engine.py explicitly skips Alembic and instead uses startup schema reconciliation/data repairs, and neither those paths nor features/automation/schema.py performs this update. The schedules therefore remain active after upgrade, but automation_dispatch.execute_task() no longer handles plan, so their next executions fail with Unknown task type: plan rather than appearing as intentionally retired schedules. Add an equivalent SQLite startup repair that disables these rows and clears both triggers, and test upgrading an existing active plan schedule.

AGENTS.md reference: AGENTS.md:L18-L19

Useful? React with 👍 / 👎.

@Luhaozhu
Luhaozhu merged commit 12c3f6e into main Nov 28, 2026
6 of 7 checks passed
@Luhaozhu
Luhaozhu deleted the sync/ce-20261128-chat-routing branch November 30, 2026 06:24
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