Skip to content

feat: add ops backend and ops panel UI (reports + triggers)#13

Open
huiyuanXP wants to merge 3 commits into
Ninglo:mainfrom
huiyuanXP:pr/ops-split
Open

feat: add ops backend and ops panel UI (reports + triggers)#13
huiyuanXP wants to merge 3 commits into
Ninglo:mainfrom
huiyuanXP:pr/ops-split

Conversation

@huiyuanXP
Copy link
Copy Markdown
Contributor

Summary

  • add orchestration backend foundations (reports, triggers/scheduler, workflow/task engine, MCP bridge files)
  • add chat ops panel UI for reports/triggers visualization and actions
  • fix ops panel hidden-state click interception bug

Scope

  • includes backend + frontend required by ops
  • excludes session-label and dark-mode toggle changes

huiyuanXP and others added 2 commits March 29, 2026 14:24
Task system:
- task-manager.mjs: dependency-based task orchestration across sessions
- API routes: GET/POST/PATCH/DELETE /api/tasks

Report system:
- reports.mjs: report CRUD with HTML storage
- API routes: POST /api/internal/report, GET/DELETE /api/reports

Scheduler:
- scheduler.mjs: interval-based recurring schedule execution
- API routes: GET/PATCH/DELETE /api/schedules

Workflow engine:
- workflow-engine.mjs: multi-step parallel/sequential workflows
- Adapted to v2 API (createSession + sendMessage)

MCP server:
- mcp-server.mjs: session management MCP for orchestrator
- mcp-task-server.mjs: standalone task MCP for child agents
- Label API routes: GET/POST/DELETE /api/session-labels,
  PATCH /api/sessions/:id/label

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

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

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: 8c9e4b4024

ℹ️ 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 thread chat/router-control-routes.mjs Outdated
getLabels,
removeLabel,
setSessionLabel,
} from './session-labels.mjs';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Badge Remove unresolved session-labels import

router-control-routes now imports ./session-labels.mjs, but that module is not present in this commit, so Node fails module resolution before the server can start. This is a universal startup failure (not input-dependent) because the import is at top level and loaded during route module initialization.

Useful? React with 👍 / 👎.

Comment thread chat/reports.mjs
import { randomBytes } from 'crypto';
import { readFileSync, writeFileSync, mkdirSync, existsSync, unlinkSync, copyFileSync, renameSync } from 'fs';
import { dirname, join } from 'path';
import { REPORTS_DIR, REPORTS_META_FILE } from '../lib/config.mjs';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Badge Export report config keys before loading reports module

reports.mjs imports REPORTS_DIR and REPORTS_META_FILE from lib/config.mjs, but this commit does not add those exports. In ESM this throws at link time (does not provide an export named ...), so any code path importing reports.mjs (including control routes) will crash during startup.

Useful? React with 👍 / 👎.

Comment thread chat/task-manager.mjs
@@ -0,0 +1,175 @@
import { readFileSync, writeFileSync, existsSync, renameSync } from 'fs';
import { randomBytes } from 'crypto';
import { TASKS_FILE } from '../lib/config.mjs';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Badge Define TASKS_FILE export before importing task manager

task-manager.mjs now imports TASKS_FILE from lib/config.mjs, but this commit does not define that export. That produces an ESM link error when the module is loaded, so task routes cannot initialize and server startup fails once this import is reached.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

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

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: 2b6016d1aa

ℹ️ 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 +1114 to +1118
if (pathname === '/api/tasks' && req.method === 'POST') {
let body;
try { body = JSON.parse(await readBody(req, 16384)); } catch {
writeJson(res, 400, { error: 'Invalid JSON' });
return true;
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 Restrict task ops endpoints to owner sessions

This route accepts any authenticated caller and does not enforce authSession.role === 'owner', so visitor sessions created from shared App links can create/update/delete global tasks. I checked the same commit’s chat/router.mjs owner-only allowlist and /api/tasks is not included there either, so the new task APIs bypass the Owner/Visitor isolation model and let visitors mutate owner-wide orchestration state.

Useful? React with 👍 / 👎.

Comment on lines +1041 to +1044
if (scheduleReloadMatch && req.method === 'POST') {
reloadSchedule(scheduleReloadMatch[1]);
writeJson(res, 200, { ok: true });
return true;
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 Initialize scheduler before reporting reload success

This endpoint always returns { ok: true } even when reloadSchedule() cannot arm anything because _onTrigger is unset. In this commit, startScheduler(...) is defined but never invoked (repo search only finds its definition), so schedules added via MCP (schedule_message) are acknowledged as reloaded but never executed.

Useful? React with 👍 / 👎.

Comment thread chat/task-manager.mjs
Comment on lines +79 to +82
export function initTaskManager(onTaskReady) {
_onTaskReady = onTaskReady;
loadTasks();
console.log(`[TaskManager] Loaded ${tasks.length} task(s) from disk`);
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 Load persisted tasks at startup before task mutations

Disk hydration only happens inside initTaskManager(), but this initializer is never called anywhere in this commit. That leaves tasks empty after every restart; once a new task is created/updated, saveTasks() writes the in-memory subset back to tasks.json, which can drop previously persisted tasks and dependency links.

Useful? React with 👍 / 👎.

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