sync: background job runtime, agent/plugin manager plugins, slimmer prompts - #113
Merged
Conversation
added 2 commits
August 17, 2026 11:22
…rompts Sync the community edition with the current upstream tree. Background job runtime (workflow mode) - Add the job subsystem: `orchestration/job_runtime.py`, `job_wakeup.py`, `core/services/job_service.py`, the `run_job` tool, the `/v1/jobs` and `/v1/internal/jobs` routes, and the `Job` model. - Wire it up on the CE side, which was the missing half: register the routers in `CE_ROUTERS`, export the model from `core/db/models/__init__.py`, and create the tables in a new migration `ce_0006_job_runtime.py`. Without these three, the tool was registered but the first callback answered 404 and the job died on the spot. - Run jobs in the background by default, resolve the callback base URL instead of hard-coding the host, reap orphaned jobs, and keep timestamps timezone-aware. - Carry `workflow_chat` through the wake-up round. The wake-up message tells the model it can `run_job(action='resume')`, but the wake-up path built its context from scratch and dropped workflow mode, so `run_job` was not on the tool surface and the model pulled every work item back into the main loop. The chat metadata is the source of truth here, so non-workflow chats are not switched on by accident. - Job progress strip above the composer, with abnormal terminal states re-fetched on mount so a job that died while the page was closed is still reported. Agent manager and plugin manager plugins - Two new marketplace plugins that move sub-agent and plugin CRUD into the chat: `agent_manager_mcp` / `plugin_manager_mcp` servers plus the `agent-manager` and `plugin-manager` bundles. - Route descriptions are written as prompt text, not marketplace copy — they ship on every turn. Prompt and tool-schema slimming - Default system prompts 5.3k to 4.0k characters, `code_exec` 5.3k to 4.4k, with all rules preserved. - 14 MCP tool descriptions compressed: tool schemas 13.8k to 10.8k tokens (-21.5%), about 3k tokens of static prefill saved per request. Reliability and UI - Revert the process-level search rate limit; it throttled the whole search MCP down to one call per minute. - Fix the sandbox session lock across event loops, so keep-alive no longer fails silently and leaves jobs stuck in `running`. - Sidebar chat list supports drag-to-reorder, with the manual order taking precedence over `updatedAt` and following the account. - Mobile pass: safe areas, iOS zoom, touch targets, dark top bar.
Two follow-ups to the sync commit.
ce_0006 broke every fresh install
- `ce_0001` builds the baseline with `ce_create_all`, straight from the SQLAlchemy
models, and the job tables are now part of the CE metadata. So by the time the
chain reaches `ce_0006` on a **new** database, `jobs` / `job_items` / `job_calls`
already exist and the unconditional `op.create_table` dies with
`table jobs already exists`. Fresh installs failed; only upgrades of older
databases worked.
- `ce_0005` already documents this invariant ("an unconditional add_column would
fail on every new deployment"). `ce_0006` is the first migration in the CE chain
to use an explicit `create_table`, so it was the first to trip over it.
- Each table is now created only when the inspector says it is absent, and
`downgrade()` is guarded the same way — on a fresh database this migration creates
nothing, so it must not drop anything either.
- Verified on SQLite, both directions: `alembic upgrade head` on a fresh database
now completes at `ce_0006` with the three tables present; and a simulated legacy
database (upgraded to `ce_0005`, job tables dropped) has `ce_0006` create the
tables and their indexes.
Workflow-mode hint
- The workflow prompt section still told the model to pass `wait=true`, which
cancelled out the switch to running jobs in the background by default. Covered by
`test_workflow_hint_consistency.py`.
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.
Syncs the community edition with the current upstream tree. 97 files, no binaries.
This supersedes #111 and #112 — it carries everything they had plus the workflow-mode
fix on the job wake-up path, so those two are being closed in favour of this one.
Background job runtime (workflow mode)
orchestration/job_runtime.py,job_wakeup.py,core/services/job_service.py, therun_jobtool, the/v1/jobsand/v1/internal/jobsroutes, and theJobmodel.registered and the prompts already mentioned it, but the routers were absent from
CE_ROUTERS, the model was not exported fromcore/db/models/__init__.py, and nomigration created the tables — so submitting a job answered 404 on the first
callback and died on the spot. Adds
ce_0006_job_runtime.py; the migration chainstill has a single head.
hard-coding the host, reaps orphaned jobs, and keeps timestamps timezone-aware.
workflow_chatthrough the wake-up round. The wake-up message tells themodel it can
run_job(action='resume'), but the wake-up path built its context fromscratch and dropped workflow mode, so
run_jobwas not on the tool surface and themodel pulled every work item back into the main loop. Chat metadata is the source of
truth, so non-workflow chats are not switched on by accident. Covered by
tests/orchestration/test_job_wake_mode.py(terminal wake inherits the mode,progress wake inherits the mode, non-workflow chats stay off).
mount so a job that died while the page was closed is still reported instead of
looking like it never ran.
Agent manager and plugin manager plugins
agent_manager_mcp/plugin_manager_mcpservers plus theagent-managerandplugin-managerbundles.since they ship on every turn.
Prompt and tool-schema slimming
code_exec5.3k → 4.4k, with allrules preserved.
roughly 3k tokens of static prefill saved per request.
Reliability and UI
down to one call per minute.
silently and leaves jobs stuck in
running.updatedAtand follows the account.Verification
scripts/build_ce.py; brand gate, requiredruntime files gate, forbidden artefacts gate and binary allowlist all pass.
CE_ROUTERS— all 43 module names resolve to a file underapi/routes/v1/.core/db/models/__init__.py— all 15 submodule imports resolve.ce_0006, job tables created.