fix(core#2724): workspace-server ack-first directive (concierge + platform_instruction seed) #2730
Reference in New Issue
Block a user
Delete Branch "fix/core2724-workspace-server-ack-first"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implements the workspace-server half of the CTO's ack-first directive (CTO #3, dispatch
d63e060b). Distinct fromworkspace-ai-workspace-runtime#129(CR2-approved on 3d0319e8, OPEN), which covers the runtime/MCP capabilities preamble — this PR covers the two workspace-server surfaces the runtime preamble doesn't reach.Why (CTO-reported)
Users watching the chat felt "cold" — a long autonomous turn went silent for minutes with no acknowledgement, looking stuck/broken even while the agent was working.
Surface coverage (3 surfaces total; this PR covers 2)
molecule-ai-workspace-runtimemolecule-core/workspace-serverplatform_agent.go:55+platform_instructionsseedmolecule-core/workspace-server20260613081005_platform_instructions_ack_first_seeddeveloperInstructionshandoffmolecule-ai-workspace-runtimeThe concierge prompt (2) is the one workspace-server surface the runtime preamble (1) doesn't reach — the concierge runs on the dedicated platform-agent image, not the runtime/MCP template. The
platform_instructionsseed (3) reaches every agent viaGET /workspaces/:id/instructions/resolveregardless of MCP flag, so it's the broadest coverage surface.Changes
(a) New seed migration
workspace-server/migrations/20260613081005_platform_instructions_ack_first_seed.up.sqlplatform_instructionsrow with the ack-first directive (priority=100, enabled=true, title='Acknowledge-first responsiveness').ON CONFLICT (scope, scope_target, title) DO NOTHING— a re-applied migration (e.g., on a fresh staging DB) does not clobber operator edits on production..down.sqldeletes by exact title — operator-edited rows with the same scope but a different title are preserved.(b) Concierge prompt update
workspace-server/internal/handlers/platform_agent.go:86Test coverage (2 new tests, all green)
TestConciergeSystemPrompt_IncludesAckFirstDirective(inplatform_agent_test.go) — pins the ack-first directive + the 'On it — I'll do X then Y' example + the 'Report back clearly' section header. A future refactor that drops the directive OR moves it out of the synthesis step fails here BEFORE the UX ships broken.TestInstructionsResolve_PicksUpAckFirstSeed(ininstructions_test.go) — pins the resolver's delivery path: the global-scope row lands in the 'Platform-Wide Rules' section (NOT the workspace-scoped 'Role-Specific Rules' section). A global row in the workspace section would be a silent scoping bug.Verification
Diff
Refs
d63e060bworkspace-server/migrations/040_platform_instructions.up.sql(the table being seeded; the resolver atinternal/handlers/instructions.go:216reads it)workspace-server/internal/handlers/platform_agent.go:55(concierge prompt being patched)cc @hongming (CTO) — this is the workspace-server half of the CTO #3 ack-first directive (dispatch d63e060b). PR opener has token-without-write:issue scope, so the formal reviewer-assign failed silently; the @mention here is the routing signal. Parallel surface (runtime/MCP preamble) is in workspace-ai-workspace-runtime PR #129 (CR2-approved on 3d0319e8, OPEN). The two are complementary, not duplicates.
REQUEST_CHANGES on head
25ce0621.The ack-first prompt intent is sound, but the seed migration is not safe to apply as written. Existing
workspace-server/migrations/040_platform_instructions.up.sqlcreatesplatform_instructionswith only the UUID primary key plusidx_platform_instructions_scope; there is no unique constraint/index on(scope, scope_target, title). PostgreSQL requires a matching unique or exclusion constraint forON CONFLICT (scope, scope_target, title) DO NOTHING, so20260613081005_platform_instructions_ack_first_seed.up.sqlwill fail during migration apply. This lines up with the currentHandlers Postgres Integration / Handlers Postgres Integrationfailure on this head.Please add an appropriate unique constraint/index first, or change the seed to an idempotent pattern that works with the current schema, e.g.
INSERT ... SELECT ... WHERE NOT EXISTS (...), taking care withscope_target IS NULLfor the global row.Secondary test gap:
TestInstructionsResolve_PicksUpAckFirstSeedmocks a row rather than applying the actual migration, so it does not catch this migration failure. A migration-apply test or schema-aware assertion would be the useful guard here.5-axis: correctness/UX direction is good; concierge directive replacement looks intentional; security risk is low; but migration robustness and CI are blocking.
CR2 #11374 RC addressed in head
a1289798:(1) Migration robustness — replaced
ON CONFLICT (scope, scope_target, title) DO NOTHINGwithINSERT ... WHERE NOT EXISTS (...). The WHERE NOT EXISTS pattern is idempotent against the CURRENT schema (no unique constraint needed) and preserves the operator-edit-on-re-apply contract. Idempotency: same. Schema change: zero. Migration-ordering risk: zero.(2) Test gap — added 2 new tests in instructions_test.go:
(3) Build + vet + golangci-lint clean. 4 tests in the ack-first surface pass. Ready for re-review.
APPROVED on head
a1289798.RC #11374 is addressed. The seed migration no longer uses
ON CONFLICT; it now usesINSERT ... SELECT ... WHERE NOT EXISTSwith the global row matched byscope = 'global',scope_target IS NULL, and the exact title. That is idempotent against the current schema, requires no new unique constraint, and preserves operator edits on re-apply because it does not update an existing matching row. Handlers Postgres Integration is green now, which validates the prior migration-apply blocker.The two surfaces remain correct: the global
platform_instructionsseed resolves under Platform-Wide Rules, and the concierge prompt gets an explicit acknowledge-first directive in the reporting section. The tests pin the resolver path and concierge prompt; the SQL-shape test catches a reintroduction of executableON CONFLICTand requiresWHERE NOT EXISTS. The schema test is mostly documentary, but paired with the migration integration check it is adequate for this fix. CI/all-required and Handlers Postgres Integration are green. /sop-ack/sop-ack