Skip to content

feat: planner overseer session advisor (OMP advisor parity)#2082

Merged
gsxdsm merged 14 commits into
mainfrom
feature/improve-overseer
Jul 15, 2026
Merged

feat: planner overseer session advisor (OMP advisor parity)#2082
gsxdsm merged 14 commits into
mainfrom
feature/improve-overseer

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a session advisor to the planner overseer so Fusion can review live executor transcripts the way oh-my-pi’s advisor does — without replacing the existing lifecycle supervisor (stage watch, retry, merge confirmation, human-control withhold).

What ships

  • Emission guard (OverseerEmissionGuard) — content-free phrase filter, session dedupe with severity-rank escalation, one accept per advisor update
  • Session delta runtime — queues agent-log deltas, drains through an advisor agent, drops backlog after 3 failures
  • Session advisor service — model gate, level matrix (observe / steer / autonomous), human-control re-check at inject, [session-advisor] steering comments
  • OVERSEER.md / WATCHDOG.md discovery for project review priorities
  • AgentLogger onEntriesFlushed + poll-backed agent-log cursor for durable deltas
  • Workflow settings: plannerOverseerAdvisorProvider + plannerOverseerAdvisorModelId (both required; empty = soft-disabled for cost safety)
  • Docs + changeset

What does not ship (deferred)

  • Multi-advisor YAML roster, mutating advisor tools, reviewer/merger shadowing, true tool-abort interrupt

Plan

docs/plans/2026-07-13-001-feat-overseer-advisor-parity-plan.md

Enablement

  1. Set workflow Session advisor model provider + Session advisor model id
  2. Oversight level observe (log only), steer, or autonomous (inject)
  3. Optional: add OVERSEER.md or WATCHDOG.md in the project

Test plan

  • pnpm --filter @fusion/core exec vitest run src/__tests__/overseer-emission-guard.test.ts
  • pnpm --filter @fusion/engine exec vitest run overseer-* unit tests (21 tests)
  • Related planner-overseer / intervention regression tests
  • @fusion/engine + @fusion/core typecheck
  • Manual: configure advisor model, run an executor task, confirm [session-advisor] inject + timeline metadata when concern is raised

Residual Review Findings

None from autofix pass (log-cursor ordering fix already committed).

Summary by CodeRabbit

  • New Features
    • Added an off-by-default “session advisor” that can review live execution activity and provide severity-based guidance.
    • Added project and per-task controls to enable it, including a default enable switch and Quick Add / Task Detail toggles.
    • Enhanced advisor prompting by discovering and incorporating OVERSEER.md/WATCHDOG.md review files.
  • Documentation
    • Added architecture and settings documentation for the new session-advisor parity behavior.
  • Bug Fixes
    • Improved fail-soft handling so advisor behavior won’t disrupt execution.
    • Fixed concurrent PostgreSQL migration startup failures.
  • Tests
    • Added coverage for advice parsing, emission guarding, runtime behavior, and watchdog discovery.

gsxdsm added 2 commits July 13, 2026 22:50
Add a live transcript-aware session advisor beside the lifecycle
supervisor: emission guard, severity-routed steering inject, agent-log
delta runtime, OVERSEER.md/WATCHDOG.md discovery, and workflow model
gate settings. Soft-disabled until advisor provider+model are configured.
getAgentLogs returns chronological trailing windows; seed the poll cursor
on first sight without replaying history, then feed only net-new rows.
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c38b2eb-8c6d-4994-9f9a-2ea7b13f3cb3

📥 Commits

Reviewing files that changed from the base of the PR and between 55c4e43 and 7e05c14.

📒 Files selected for processing (5)
  • .changeset/session-advisor-project-task-controls.md
  • packages/dashboard/app/components/QuickEntryBox.tsx
  • packages/dashboard/app/components/__tests__/QuickEntryBox.test.tsx
  • packages/engine/src/__tests__/overseer-advisor-service.test.ts
  • packages/engine/src/overseer-advisor-service.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • .changeset/session-advisor-project-task-controls.md
  • packages/dashboard/app/components/QuickEntryBox.tsx
  • packages/engine/src/tests/overseer-advisor-service.test.ts
  • packages/engine/src/overseer-advisor-service.ts

📝 Walkthrough

Walkthrough

Adds a planner overseer session advisor that consumes executor transcript deltas, parses severity-routed advice, applies emission guards, injects steering comments when permitted, exposes runtime snapshots, and adds workflow, project, and task controls with persistence and dashboard support. It also documents concurrent migration handling.

Changes

Planner overseer session advisor

Layer / File(s) Summary
Advice contracts and emission guard
packages/core/src/overseer-advice.ts, packages/core/src/overseer-emission-guard.ts, packages/core/src/planner-intervention.ts, packages/core/src/planner-overseer-events.ts, packages/core/src/planner-overseer-state.ts, packages/core/src/types.ts, packages/core/src/builtin-workflow-settings.ts
Adds severity/source vocabularies, normalization, ranked deduplication, bounded emission history, intervention metadata, runtime snapshot fields, advisor settings, and exports.
Advisor runtime primitives
packages/engine/src/overseer-advise-tool.ts, packages/engine/src/overseer-advisor-runtime.ts, packages/engine/src/overseer-session-delta.ts, packages/engine/src/overseer-watchdog.ts, packages/engine/src/agent-logger.ts, packages/engine/src/executor.ts, packages/engine/src/__tests__/*
Adds reply parsing, session-delta formatting, watchdog discovery, queued prompting with retries, fail-soft log-flush callbacks, and tests.
Service and engine integration
packages/engine/src/overseer-advisor-service.ts, packages/engine/src/project-engine.ts, packages/engine/src/runtimes/in-process-runtime.ts, packages/engine/src/index.ts, packages/engine/src/__tests__/overseer-advisor-service.test.ts
Creates task-scoped advisor runtimes, gates and injects advice, feeds executor logs, updates snapshots, and clears state during task and poll cleanup.
Configuration and documentation
docs/architecture.md, docs/settings-reference.md, docs/plans/..., .changeset/overseer-session-advisor.md
Documents advisor settings, architecture, implementation planning, and the minor release entry.

Session advisor task controls

Layer / File(s) Summary
Enablement contract and persistence
packages/core/src/session-advisor.ts, packages/core/src/types.ts, packages/core/src/task-store/*, packages/core/src/postgres/*, packages/core/src/settings-schema.ts, packages/core/src/__tests__/session-advisor.test.ts, packages/core/src/__tests__/postgres/schema-applier.test.ts
Adds task/project enablement precedence, nullable task persistence, schema migration 0008, PostgreSQL health expectations, and migration tests.
Task control API and dashboard
packages/dashboard/app/api/legacy.ts, packages/dashboard/app/components/QuickEntryBox.tsx, packages/dashboard/app/components/TaskDetailModal.tsx, packages/dashboard/app/components/settings/*, packages/dashboard/src/routes/register-task-workflow-routes.ts
Adds project defaults, Quick Add inheritance and override toggles, task-detail controls, and validated create/update API handling.

Concurrent migration handling

Layer / File(s) Summary
Concurrent role creation
packages/core/src/postgres/migrations/0006_project_ownership.sql, .changeset/fix-concurrent-project-ownership-migration.md
Documents tolerance for duplicate-object and unique-violation conflicts during concurrent runtime-role creation and records the patch release.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Executor
  participant ProjectEngine
  participant AdvisorService
  participant AdvisorRuntime
  participant AdvisorModel
  participant TaskStore
  Executor->>ProjectEngine: flush executor log entries
  ProjectEngine->>AdvisorService: forward new task log delta
  AdvisorService->>AdvisorRuntime: enqueue rendered session update
  AdvisorRuntime->>AdvisorModel: prompt isolated advisor session
  AdvisorModel-->>AdvisorRuntime: return parsed advice and severity
  AdvisorRuntime->>AdvisorService: deliver guarded advice
  AdvisorService->>TaskStore: inject steering comment and audit event
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a planner overseer session advisor with OMP advisor parity.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/improve-overseer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a planner overseer session advisor for live executor transcript review. The main changes are:

  • Optional session advisor settings and project/task enablement controls.
  • Advisor runtime, emission guard, advice parsing, and watchdog file discovery.
  • Executor log hooks and poll-backed transcript delta feeding.
  • Steering comment delivery with live oversight and human-control checks.
  • Dashboard controls, docs, tests, and changesets for the new feature.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
packages/engine/src/overseer-advisor-service.ts Adds session-advisor delivery logic with live task, settings, enablement, oversight-level, and human-control checks before steering comments are injected.
packages/engine/src/project-engine.ts Wires the advisor into engine startup, executor log flushes, overseer polling, model/session creation, and agent-log cursor feeding.
packages/engine/src/overseer-advisor-runtime.ts Adds the per-task transcript delta runtime with backlog draining, retry handling, reset, and disposal behavior.
packages/engine/src/overseer-advise-tool.ts Adds advisor reply parsing, advise recording, and assistant text extraction for advisor sessions.

Reviews (10): Last reviewed commit: "fix(review): inject-time enable re-check..." | Re-trigger Greptile

Comment thread packages/engine/src/overseer-advisor-service.ts
Comment thread packages/engine/src/project-engine.ts
Comment thread packages/engine/src/project-engine.ts Outdated
gsxdsm added 2 commits July 13, 2026 23:02
- Re-resolve oversight level at inject time so mid-session observe/off flips cannot keep injecting
- Pass live engine settings into OverseerAdvisorService so autoMerge:false human-control withholds
- Pass systemPrompt into createResolvedAgentSession for the advisor contract

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/engine/src/runtimes/in-process-runtime.ts (1)

1585-1596: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

New getExecutor() was inserted between getTaskStore()'s docstring and its declaration.

The pre-existing JSDoc block (Get the project's TaskStore instance. @throws Error if runtime has not been started) now sits directly above getExecutor() instead of getTaskStore(), since the new method was spliced in between. Purely a doc-placement issue but will confuse anyone reading hover-docs/generated API docs for either method.

🐛 Proposed fix
-  /**
-   * Get the project's TaskStore instance.
-   * `@throws` Error if runtime has not been started
-   */
   /**
    * FNXC:PlannerOversight 2026-07-13-23:05:
    * Expose TaskExecutor so ProjectEngine can wire session-advisor log flush.
    */
   getExecutor(): TaskExecutor | undefined {
     return this.executor;
   }

+  /**
+   * Get the project's TaskStore instance.
+   * `@throws` Error if runtime has not been started
+   */
   getTaskStore(): TaskStore {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/engine/src/runtimes/in-process-runtime.ts` around lines 1585 - 1596,
Move the existing TaskStore JSDoc back directly above getTaskStore(), and place
the getExecutor() method and its explanatory comment after that method’s
documentation or in the appropriate separate location. Ensure each public method
has only the documentation describing its own behavior.
🧹 Nitpick comments (1)
packages/engine/src/project-engine.ts (1)

2572-2646: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate settings resolution and cwd derivation.

resolveLevel and resolveModel each independently call resolveEffectiveSettings(store, { id: task.id }) — two separate resolution round-trips per advisor cycle for the same task. Separately, agentFactory re-derives cwd from store.getTask(taskId) even though resolveCwd above already implements the same fallback chain from an in-hand task object; if the service could pass the already-resolved cwd into agentFactory, the extra getTask round-trip could be avoided.

Consider consolidating the two resolveEffectiveSettings calls into one shared resolution, and threading the already-resolved cwd through to agentFactory instead of re-fetching it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/engine/src/project-engine.ts` around lines 2572 - 2646, Consolidate
the duplicated resolveEffectiveSettings calls used by resolveLevel and
resolveModel in buildSessionAdvisorService, reusing one per-task resolved
settings result while preserving existing fallbacks. Thread the cwd resolved by
resolveCwd into agentFactory and use it when creating the session; remove the
redundant store.getTask(taskId) lookup and retain the existing
config/process.cwd fallback behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/architecture.md`:
- Around line 1381-1385: Update the OverseerAdvisorService documentation to
describe the complete watchdog discovery contract, including supported
user-agent locations and .fusion/.omp variants alongside project
OVERSEER.md/WATCHDOG.md files. If this section is intentionally limited to
project-level files, explicitly state that scope and direct operators to the
documentation covering the other supported locations.

In `@packages/engine/src/overseer-advisor-runtime.ts`:
- Around line 220-233: Reset `#failureNotified` when the three-failure drop is
handled in the consecutive-failure branch, after the optional host notification
and before resetting `#consecutiveFailures`, so each newly accumulated failure
streak can notify the host once.

In `@packages/engine/src/project-engine.ts`:
- Around line 1209-1220: Update notifySessionAdvisorLogDelta so the promise
returned by sessionAdvisor.onExecutorLogDelta is handled with a rejection-safe
catch while preserving the existing synchronous try/catch and fail-soft
behavior. Ensure rejected asynchronous calls are swallowed and cannot become
unhandled promise rejections.
- Around line 2597-2645: Change the sessionPurpose in the
createResolvedAgentSession call within agentFactory’s complete callback from the
coding-capable executor lane to the established read-only or restricted purpose.
Keep the advisor completion transcript-only and preserve the existing session
lifecycle and response extraction behavior.

---

Outside diff comments:
In `@packages/engine/src/runtimes/in-process-runtime.ts`:
- Around line 1585-1596: Move the existing TaskStore JSDoc back directly above
getTaskStore(), and place the getExecutor() method and its explanatory comment
after that method’s documentation or in the appropriate separate location.
Ensure each public method has only the documentation describing its own
behavior.

---

Nitpick comments:
In `@packages/engine/src/project-engine.ts`:
- Around line 2572-2646: Consolidate the duplicated resolveEffectiveSettings
calls used by resolveLevel and resolveModel in buildSessionAdvisorService,
reusing one per-task resolved settings result while preserving existing
fallbacks. Thread the cwd resolved by resolveCwd into agentFactory and use it
when creating the session; remove the redundant store.getTask(taskId) lookup and
retain the existing config/process.cwd fallback behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 90b8aaac-67f4-4f66-ba22-0830a66c51c3

📥 Commits

Reviewing files that changed from the base of the PR and between 8e4514e and 53a87d9.

📒 Files selected for processing (28)
  • .changeset/overseer-session-advisor.md
  • docs/architecture.md
  • docs/plans/2026-07-13-001-feat-overseer-advisor-parity-plan.md
  • docs/settings-reference.md
  • packages/core/src/__tests__/overseer-emission-guard.test.ts
  • packages/core/src/builtin-workflow-settings.ts
  • packages/core/src/index.ts
  • packages/core/src/overseer-advice.ts
  • packages/core/src/overseer-emission-guard.ts
  • packages/core/src/planner-intervention.ts
  • packages/core/src/planner-overseer-events.ts
  • packages/core/src/planner-overseer-state.ts
  • packages/core/src/types.ts
  • packages/engine/src/__tests__/overseer-advise-tool.test.ts
  • packages/engine/src/__tests__/overseer-advisor-runtime.test.ts
  • packages/engine/src/__tests__/overseer-advisor-service.test.ts
  • packages/engine/src/__tests__/overseer-session-delta.test.ts
  • packages/engine/src/__tests__/overseer-watchdog.test.ts
  • packages/engine/src/agent-logger.ts
  • packages/engine/src/executor.ts
  • packages/engine/src/index.ts
  • packages/engine/src/overseer-advise-tool.ts
  • packages/engine/src/overseer-advisor-runtime.ts
  • packages/engine/src/overseer-advisor-service.ts
  • packages/engine/src/overseer-session-delta.ts
  • packages/engine/src/overseer-watchdog.ts
  • packages/engine/src/project-engine.ts
  • packages/engine/src/runtimes/in-process-runtime.ts

Comment thread docs/architecture.md Outdated
Comment thread packages/engine/src/overseer-advisor-runtime.ts
Comment thread packages/engine/src/project-engine.ts
Comment thread packages/engine/src/project-engine.ts
gsxdsm added 2 commits July 14, 2026 00:22
Add plannerOverseerAdvisorEnabled (boolean, default false). Require
explicit enable plus model ids before any second-model transcript review
runs; lifecycle overseer is unchanged.
Port oh-my-pi advisor persona, critical silence rules, and severity criteria
into OVERSEER_ADVISOR_SYSTEM_PROMPT while keeping Fusion's JSON reply
contract and PROMPT.md / File Scope anchors.
Comment thread packages/engine/src/overseer-advisor-service.ts Outdated
Comment thread packages/engine/src/project-engine.ts Outdated
- Reset failure-notify latch after each 3-failure backlog drop
- Catch async rejections on session-advisor log-delta notify
- Use reviewer + tools:readonly for advisor sessions
- Re-fetch settings at inject time for autoMerge human-control
- Runtime-agnostic assistant text extraction
- Document full OVERSEER/WATCHDOG discovery paths; fix getExecutor JSDoc
Comment thread packages/engine/src/overseer-advisor-service.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/engine/src/__tests__/overseer-advisor-service.test.ts`:
- Around line 268-273: Replace the fixed 80ms sleep after onExecutorLogDelta in
the affected test with vi.waitFor, matching the existing pattern used earlier in
the file. Wait for the relevant async condition or assertion to settle, then
retain the addSteeringComment negative assertion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bec81103-413a-4c34-a36f-f934632da8a2

📥 Commits

Reviewing files that changed from the base of the PR and between 53a87d9 and 5ba57ba.

📒 Files selected for processing (15)
  • .changeset/overseer-session-advisor.md
  • docs/architecture.md
  • docs/plans/2026-07-13-001-feat-overseer-advisor-parity-plan.md
  • docs/settings-reference.md
  • packages/core/src/__tests__/builtin-workflow-settings-triage.test.ts
  • packages/core/src/builtin-workflow-settings.ts
  • packages/engine/src/__tests__/overseer-advise-tool.test.ts
  • packages/engine/src/__tests__/overseer-advisor-runtime.test.ts
  • packages/engine/src/__tests__/overseer-advisor-service.test.ts
  • packages/engine/src/index.ts
  • packages/engine/src/overseer-advise-tool.ts
  • packages/engine/src/overseer-advisor-runtime.ts
  • packages/engine/src/overseer-advisor-service.ts
  • packages/engine/src/project-engine.ts
  • packages/engine/src/runtimes/in-process-runtime.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • .changeset/overseer-session-advisor.md
  • packages/engine/src/tests/overseer-advise-tool.test.ts
  • packages/engine/src/runtimes/in-process-runtime.ts
  • packages/engine/src/index.ts
  • packages/engine/src/tests/overseer-advisor-runtime.test.ts
  • docs/settings-reference.md
  • docs/architecture.md
  • docs/plans/2026-07-13-001-feat-overseer-advisor-parity-plan.md
  • packages/engine/src/overseer-advisor-runtime.ts
  • packages/engine/src/overseer-advisor-service.ts
  • packages/engine/src/project-engine.ts

Comment thread packages/engine/src/__tests__/overseer-advisor-service.test.ts
gsxdsm added 2 commits July 14, 2026 18:16
…ce (#2082)

- Migration 0006: tolerate concurrent fusion_runtime CREATE ROLE across DBs
  (duplicate_object OR unique_violation) — same root cause as main PG gate.
- deliverAdvice: withhold inject when store.getSettings() throws (do not use
  stale autoMerge:true cache).
- Tests: replace fixed setTimeout with vi.waitFor; add fail-closed regression.
Comment thread packages/engine/src/overseer-advisor-service.ts
Treat a missing live settings object the same as a getSettings throw: withhold
session-advisor inject so a stale autoMerge:true cache cannot bypass human
control. Regression covers undefined resolution.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/postgres/migrations/0006_project_ownership.sql`:
- Around line 34-49: Create a new forward migration named 0007 for the project
ownership role and grant changes instead of editing the already-versioned
0006_project_ownership migration. Preserve the shown DO block in the new
migration so databases that have applied 0006 execute the role creation and
current-user grant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 615cec66-cf2e-4fbe-83a6-2995860246cf

📥 Commits

Reviewing files that changed from the base of the PR and between 5ba57ba and 8de864c.

📒 Files selected for processing (5)
  • .changeset/fix-concurrent-project-ownership-migration.md
  • packages/core/src/index.ts
  • packages/core/src/postgres/migrations/0006_project_ownership.sql
  • packages/core/src/types.ts
  • packages/engine/src/__tests__/overseer-advisor-service.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/core/src/types.ts
  • packages/core/src/index.ts
  • packages/engine/src/tests/overseer-advisor-service.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/postgres/migrations/0006_project_ownership.sql`:
- Around line 34-49: Create a new forward migration named 0007 for the project
ownership role and grant changes instead of editing the already-versioned
0006_project_ownership migration. Preserve the shown DO block in the new
migration so databases that have applied 0006 execute the role creation and
current-user grant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 615cec66-cf2e-4fbe-83a6-2995860246cf

📥 Commits

Reviewing files that changed from the base of the PR and between 5ba57ba and 8de864c.

📒 Files selected for processing (5)
  • .changeset/fix-concurrent-project-ownership-migration.md
  • packages/core/src/index.ts
  • packages/core/src/postgres/migrations/0006_project_ownership.sql
  • packages/core/src/types.ts
  • packages/engine/src/__tests__/overseer-advisor-service.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/core/src/types.ts
  • packages/core/src/index.ts
  • packages/engine/src/tests/overseer-advisor-service.test.ts
🛑 Comments failed to post (1)
packages/core/src/postgres/migrations/0006_project_ownership.sql (1)

34-49: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Look for the migration runner/tracker to see if it hashes/validates applied migration file contents.
fd -e ts -e js . packages/core/src/postgres | xargs rg -n -i "checksum|hash|md5|sha256" -C3
rg -n -i "migration" packages/core/src -g '*.ts' -l | xargs rg -n "applyMigration|runMigration|migrations_applied|schema_migrations" -C3

Repository: Runfusion/Fusion

Length of output: 34351


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- outline: packages/core/src/postgres/schema-applier.ts ---'
ast-grep outline packages/core/src/postgres/schema-applier.ts --view expanded | sed -n '1,220p'

echo
echo '--- relevant lines: packages/core/src/postgres/schema-applier.ts ---'
sed -n '120,220p' packages/core/src/postgres/schema-applier.ts

echo
echo '--- relevant lines: packages/core/src/postgres/startup-factory.ts ---'
sed -n '1,220p' packages/core/src/postgres/startup-factory.ts

echo
echo '--- search for migration bookkeeping schema ---'
rg -n "fusion_schema_migrations|MIGRATION_BOOKKEEPING_TABLE|applied_at|version text PRIMARY KEY|checksum|hash" packages/core/src -g '*.ts' -g '*.sql'

Repository: Runfusion/Fusion

Length of output: 35229


Add this as a new forward migration

packages/core/src/postgres/migrations/0006_project_ownership.sql is already versioned, and fusion_schema_migrations only tracks applied versions. Editing it in place won’t reach databases that have already recorded 0006; they’ll keep the old state and miss this role/grant change. Move it into 0007_... instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/postgres/migrations/0006_project_ownership.sql` around
lines 34 - 49, Create a new forward migration named 0007 for the project
ownership role and grant changes instead of editing the already-versioned
0006_project_ownership migration. Preserve the shown DO block in the new
migration so databases that have applied 0006 execute the role creation and
current-user grant.

gsxdsm added 3 commits July 14, 2026 18:25
Add project sessionAdvisorEnabledByDefault, per-task sessionAdvisorEnabled
override, and a Quick Add eye toggle next to GitHub so the LLM overseer
agent can be opted in without relying only on workflow settings.
Resolve 0006_project_ownership.sql CREATE ROLE exception-handler formatting
while keeping race-safe duplicate_object OR unique_violation handling from both
sides, plus branch fail-closed advisor settings and session-advisor controls.
Gate boot-smoke failed selecting session_advisor_enabled because Drizzle
schema and health self-heal expected the column but migrations 0000-0007
never created it on fresh DBs. Versioned ADD COLUMN IF NOT EXISTS path
keeps applier/upgrade parity with per-task session advisor controls.
Comment thread packages/engine/src/overseer-advisor-service.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/session-advisor-project-task-controls.md:
- Around line 5-7: Update the dev description in the changeset so
plannerOverseerAdvisorEnabled is described as a workflow-level master gate that
can disable the session advisor regardless of task or project settings, rather
than as the final inheritance fallback. Preserve the existing descriptions of
project defaults, task overrides, Quick Add, and
resolveTaskSessionAdvisorEnabled.

In `@packages/dashboard/app/components/QuickEntryBox.tsx`:
- Around line 2216-2235: Update the onClick handler for the quick-entry session
advisor toggle to compute the next value from the current effective state, then
setSessionAdvisorOverride to null when that value matches
projectSessionAdvisorDefault; otherwise store the explicit boolean override.
Preserve the existing functional state update and toggle behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 45aed467-8099-4895-978e-24f616d79729

📥 Commits

Reviewing files that changed from the base of the PR and between 8de864c and 55c4e43.

📒 Files selected for processing (33)
  • .changeset/session-advisor-project-task-controls.md
  • docs/settings-reference.md
  • packages/core/src/__tests__/postgres/schema-applier.test.ts
  • packages/core/src/__tests__/session-advisor.test.ts
  • packages/core/src/__tests__/settings-parity.test.ts
  • packages/core/src/builtin-workflow-settings.ts
  • packages/core/src/index.gate.ts
  • packages/core/src/index.ts
  • packages/core/src/postgres/index.ts
  • packages/core/src/postgres/migrations/0006_project_ownership.sql
  • packages/core/src/postgres/migrations/0008_session_advisor_enabled.sql
  • packages/core/src/postgres/postgres-health.ts
  • packages/core/src/postgres/schema-applier.ts
  • packages/core/src/postgres/schema/project.ts
  • packages/core/src/session-advisor.ts
  • packages/core/src/settings-schema.ts
  • packages/core/src/store.ts
  • packages/core/src/task-store/persistence.ts
  • packages/core/src/task-store/remaining-ops-6.ts
  • packages/core/src/task-store/serialization.ts
  • packages/core/src/task-store/task-creation.ts
  • packages/core/src/task-store/task-update.ts
  • packages/core/src/types.ts
  • packages/dashboard/app/api/legacy.ts
  • packages/dashboard/app/components/QuickEntryBox.tsx
  • packages/dashboard/app/components/TaskDetailModal.tsx
  • packages/dashboard/app/components/settings/section-keys.ts
  • packages/dashboard/app/components/settings/sections/GeneralSection.tsx
  • packages/dashboard/app/components/settings/sections/__tests__/settings-default-descriptions.test.tsx
  • packages/dashboard/src/routes/register-task-workflow-routes.ts
  • packages/engine/src/__tests__/overseer-advisor-service.test.ts
  • packages/engine/src/overseer-advisor-service.ts
  • packages/engine/src/project-engine.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/core/src/index.ts
  • packages/engine/src/tests/overseer-advisor-service.test.ts
  • packages/core/src/builtin-workflow-settings.ts
  • packages/engine/src/overseer-advisor-service.ts
  • packages/engine/src/project-engine.ts

Comment thread .changeset/session-advisor-project-task-controls.md Outdated
Comment thread packages/dashboard/app/components/QuickEntryBox.tsx
…2082)

- deliverAdvice re-resolves resolveEnabled and clears runtime when disabled mid-session
- Changeset: workflow plannerOverseerAdvisorEnabled is a master/legacy gate, not final inheritance fallback
- Quick Add eye clears override to null when effective matches project default (TaskDetail parity)
@gsxdsm
gsxdsm merged commit 4f03767 into main Jul 15, 2026
7 checks passed
@gsxdsm
gsxdsm deleted the feature/improve-overseer branch July 15, 2026 03:27
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Adds a **session advisor** to the planner overseer so Fusion can review
live executor transcripts the way [oh-my-pi’s
advisor](https://github.com/can1357/oh-my-pi/tree/main/packages/coding-agent/src/advisor)
does — without replacing the existing lifecycle supervisor (stage watch,
retry, merge confirmation, human-control withhold).

### What ships

- **Emission guard** (`OverseerEmissionGuard`) — content-free phrase
filter, session dedupe with severity-rank escalation, one accept per
advisor update
- **Session delta runtime** — queues agent-log deltas, drains through an
advisor agent, drops backlog after 3 failures
- **Session advisor service** — model gate, level matrix (`observe` /
`steer` / `autonomous`), human-control re-check at inject,
`[session-advisor]` steering comments
- **OVERSEER.md / WATCHDOG.md** discovery for project review priorities
- **AgentLogger `onEntriesFlushed`** + poll-backed agent-log cursor for
durable deltas
- Workflow settings: `plannerOverseerAdvisorProvider` +
`plannerOverseerAdvisorModelId` (both required; empty = soft-disabled
for cost safety)
- Docs + changeset

### What does not ship (deferred)

- Multi-advisor YAML roster, mutating advisor tools, reviewer/merger
shadowing, true tool-abort interrupt

### Plan

`docs/plans/2026-07-13-001-feat-overseer-advisor-parity-plan.md`

## Enablement

1. Set workflow **Session advisor model provider** + **Session advisor
model id**
2. Oversight level `observe` (log only), `steer`, or `autonomous`
(inject)
3. Optional: add `OVERSEER.md` or `WATCHDOG.md` in the project

## Test plan

- [x] `pnpm --filter @fusion/core exec vitest run
src/__tests__/overseer-emission-guard.test.ts`
- [x] `pnpm --filter @fusion/engine exec vitest run` overseer-* unit
tests (21 tests)
- [x] Related planner-overseer / intervention regression tests
- [x] `@fusion/engine` + `@fusion/core` typecheck
- [ ] Manual: configure advisor model, run an executor task, confirm
`[session-advisor]` inject + timeline metadata when concern is raised

## Residual Review Findings

None from autofix pass (log-cursor ordering fix already committed).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added an off-by-default “session advisor” that can review live
execution activity and provide severity-based guidance.
* Added project and per-task controls to enable it, including a default
enable switch and Quick Add / Task Detail toggles.
* Enhanced advisor prompting by discovering and incorporating
`OVERSEER.md`/`WATCHDOG.md` review files.
* **Documentation**
* Added architecture and settings documentation for the new
session-advisor parity behavior.
* **Bug Fixes**
* Improved fail-soft handling so advisor behavior won’t disrupt
execution.
  * Fixed concurrent PostgreSQL migration startup failures.
* **Tests**
* Added coverage for advice parsing, emission guarding, runtime
behavior, and watchdog discovery.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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