Skip to content

P1: Architectural integrity — command infra, god class decomposition, magic numbers, panic safety, ts-rs exports - #310

Merged
joelteply merged 7 commits into
mainfrom
feature/p1b-command-infrastructure
Mar 14, 2026
Merged

joelteply merged 7 commits into
mainfrom
feature/p1b-command-infrastructure

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Completes Priority 1 (Architectural Integrity) from the Alpha Gap Analysis — the foundation for open-source launch.

  • P1B: Command Infrastructure — TypesFilePatcher + CommandFixerStrategies auto-inject factory functions. Fixed 12 non-standard Result types, added static accessors to 86 commands
  • P1C: God Class Decomposition — Extracted DataSchemaManager (167 lines) and DataVectorOperations (131 lines) from DataDaemon, JTAGClientConnections (154 lines) from JTAGClient, PersonaAgentLoop (294 lines) from PersonaResponseGenerator
  • P1D: Magic Number Consolidation — All persona timing constants consolidated into PersonaTimingConfig.ts. 7 files updated to reference single source of truth
  • P1E: Rust Panic Safety — Executor .ok() swallowing → warn logging with first-failure-only pattern. step_err() helper for consistent error formatting across 6 sentinel step files
  • P1F: ts-rs Exports — Added #[derive(TS)] to 10 types (RagComposeRequest, AgentStatus, ToolCall, ToolResult, AgentAction, DatasetManifest, DatasetMetrics, MCPTool, MCPInputSchema, MCPProperty). Barrel exports for agent/, dataset/, mcp/

118 files changed, 5026 insertions, 1116 deletions.

Test plan

  • npm run build:ts compiles cleanly
  • cargo test passes (generates ts-rs bindings)
  • Existing command tests pass (factory functions are additive)
  • PersonaAgentLoop extraction: agent tool loop behavior unchanged
  • PersonaTimingConfig: all timing values match previous hardcoded constants
  • Sentinel executor: verify warn logs appear on write failures instead of silent swallowing

DataDaemon god class decomposition (P1C): extract schema extraction,
validation, and provisioning into DataSchemaManager (167 lines). DataDaemon
drops from 1,431 to 1,275 lines. Also remove vestigial Ollama badge
priority and error message text since the system uses Candle.
Move vector search, embedding, indexing, backfill, and capability
methods into DataVectorOperations (131 lines). DataDaemon retains thin
static delegators for API compatibility. 1,275 → 1,150 lines.
Move LocalConnection, RemoteConnection, and ICommandCorrelator into
JTAGClientConnections (154 lines). Introduce RemoteConnectionHost
interface to break circular dependency. JTAGClient drops from 1,220
to 1,100 lines. Clean up unused imports (CommandBase, JTAGMessageFactory,
TransportConfig, TransportSendResult).
Move canonical agent tool loop (native + XML paths, regeneration,
safety cap) into PersonaAgentLoop (294 lines). PersonaResponseGenerator
drops from 1,186 to 953 lines. Remove dead getSafetyMaxIterations
method and unused imports.
All scattered timing constants now reference PersonaTimingConfig as
single source of truth: snapshot throttle/delay/interval, self-task
cooldowns, gap assessment interval, subprocess priority wait times
(6-case switch → map lookup), diamond persist, daemon init wait/poll,
and generation timeout across 7 consuming files.
Replace 20 silent .ok() sites in sentinel executor with warn logging
(first-failure-only pattern for hot-path log writes). Add step_err()
helper to sentinel/types.rs for consistent error formatting, applied
across 6 step files. Update gap analysis with P1C/D/E status and
add 6D for 14 pre-existing Rust test failures.
RagComposeRequest, AgentStatus, AgentToolCall, AgentToolResult,
AgentAction, DatasetManifest, DatasetMetrics, MCPTool, MCPInputSchema,
MCPProperty — all now have #[derive(TS)] with proper export_to paths.
Generated barrel exports in agent/, dataset/, mcp/ directories.
Copilot AI review requested due to automatic review settings March 14, 2026 02:53
@joelteply
joelteply merged commit 6913bd8 into main Mar 14, 2026
4 of 6 checks passed
@joelteply
joelteply deleted the feature/p1b-command-infrastructure branch March 14, 2026 03:00

Copilot AI 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.

Pull request overview

Implements the “P1: Architectural integrity” workstream by extracting large subsystems into focused modules, consolidating timing “magic numbers” into a single config, improving sentinel executor observability/panic-safety, and expanding Rust→TS type exports for the open-source launch foundation.

Changes:

  • Standardizes sentinel step error formatting (step_err) and replaces silent .ok() I/O swallowing in the sentinel executor with warning logs.
  • Consolidates persona timing constants into PersonaTimingConfig and refactors multiple persona modules + UI to reference the centralized values; extracts the agent tool loop into PersonaAgentLoop.
  • Decomposes god classes by extracting DataSchemaManager/DataVectorOperations from DataDaemon and JTAGClientConnections from JTAGClient; expands ts-rs exports + generated barrel exports.

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/workers/continuum-core/src/modules/sentinel/types.rs Adds step_err() helper for consistent step error formatting.
src/workers/continuum-core/src/modules/sentinel/steps/watch.rs Uses step_err for consistent watch-step error messages.
src/workers/continuum-core/src/modules/sentinel/steps/shell.rs Uses step_err for shell-step failures/timeouts.
src/workers/continuum-core/src/modules/sentinel/steps/llm.rs Uses step_err for LLM-step error paths.
src/workers/continuum-core/src/modules/sentinel/steps/emit.rs Uses step_err for missing MessageBus errors.
src/workers/continuum-core/src/modules/sentinel/steps/command.rs Uses step_err for command execution failures.
src/workers/continuum-core/src/modules/sentinel/steps/coding_agent.rs Uses step_err for coding-agent step errors.
src/workers/continuum-core/src/modules/sentinel/executor.rs Replaces .ok() I/O swallowing with warn logging + first-failure-only flags.
src/workers/continuum-core/src/modules/rag.rs Adds TS derive/export for RagComposeRequest and TS attribute refinements.
src/workers/continuum-core/src/modules/mcp.rs Adds TS derive/export for MCP protocol types.
src/workers/continuum-core/src/modules/dataset.rs Adds TS derive/export for dataset manifest/metrics types.
src/workers/continuum-core/src/modules/agent.rs Adds TS derive/export for agent status + tool call/result/action types.
src/shared/generated/index.ts Extends generated master barrel exports to include agent/dataset/mcp.
src/widgets/chat/user-list/PersonaTile.ts Replaces hardcoded UI timing with PersonaTimingConfig.
src/system/user/server/modules/SelfTaskGenerator.ts Replaces cooldown magic numbers with PersonaTimingConfig.
src/system/user/server/modules/PersonaTimingConfig.ts Adds additional centralized timing constants (daemon init, snapshot, subprocess, UI, etc.).
src/system/user/server/modules/PersonaSubprocess.ts Replaces priority wait-time switch with config lookup.
src/system/user/server/modules/PersonaState.ts Replaces snapshot timing constants with config values.
src/system/user/server/modules/PersonaResponseGenerator.ts Delegates tool loop to extracted runAgentLoop; moves daemon init timings to config.
src/system/user/server/modules/PersonaAutonomousLoop.ts Replaces gap assessment interval with config value.
src/system/user/server/modules/PersonaAgentLoop.ts New extracted module implementing canonical agent tool loop.
src/system/user/server/PersonaUser.ts Replaces generation timeout constant with PersonaTimingConfig.
src/system/genome/fine-tuning/server/TrainingMemoryGuard.ts Generalizes low-memory remediation text.
src/system/core/client/shared/JTAGClientConnections.ts New extracted connection implementations + interfaces for JTAGClient.
src/system/core/client/shared/JTAGClient.ts Refactors to consume extracted connection module and implement RemoteConnectionHost.
src/daemons/data-daemon/shared/DataSchemaManager.ts New extracted schema extraction/validation/provisioning module.
src/daemons/data-daemon/shared/DataVectorOperations.ts New extracted vector-search facade delegating to adapter capabilities.
src/daemons/data-daemon/shared/DataDaemon.ts Refactors to delegate schema + vector responsibilities to extracted modules.
docs/planning/ALPHA-GAP-ANALYSIS.md Updates progress/status notes for P1 items and adds test-failure inventory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

getCommandsInterface(): CommandsInterface {
const map = new Map();
Comment on lines +22 to +28
import { PersonaTimingConfig } from '../../../system/user/server/modules/PersonaTimingConfig';

/**
* Diamond persist duration — each stage of cognition holds its diamond
* lit for this long after the last event, giving a visible sequential glow.
*/
const DIAMOND_PERSIST_MS = 2500;
const DIAMOND_PERSIST_MS = PersonaTimingConfig.ui.diamondPersistMs;
Comment on lines +403 to +406
if let Err(e) = stdout_writer.write_all(line.as_bytes()).await
.and(stdout_writer.write_all(b"\n").await)
.and(combined_writer.write_all(timestamped.as_bytes()).await)
.and(combined_writer.flush().await)
Comment on lines +446 to +450
if let Err(e) = stderr_writer.write_all(line.as_bytes()).await
.and(stderr_writer.write_all(b"\n").await)
.and(combined_writer.write_all(timestamped.as_bytes()).await)
.and(combined_writer.flush().await)
{
Comment on lines +53 to +55
await this.schemaManager.ensureSchema(options.collection, this.getAdapterForCollection(options.collection));

const adapter = this.getAdapter() as VectorCapableAdapter;
joelteply added a commit that referenced this pull request Aug 3, 2026
…adapter — never lane-spawn weights served elsewhere (#310) (#2127)

Live failure 2026-08-03: cognition/eval --base_model_id=deepseek-v4-flash tried to
stand up an ~81GB ephemeral llama-server lane for a model the ds4 sidecar was
already answering on :8901; the memory veto then rightly refused (and the bounded
180s defer failed loud) — but the lane should never have been asked for.

build_base_eval_lane_inner now branches on the registry row's provider: anything
that isn't the local llama-server routes through an adapter built from the
provider row (no spawn, no VRAM lease, no headroom gate — it prices a cold-load
this path never pays). served_ctx comes from the provider's live /v1/models
context_length (the ds4 sidecar serves 8192 while the row states the 1M
capability), falling back to the row. EvalLaneInner.lane becomes Option to carry
the nothing-to-kill case honestly.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Aug 8, 2026
…ies LOUD, never silently forever (#2180)

Harnesses-first (Joel, 2026-08-08): both live graded runs froze after
attempt 2 for 2.5 hours — zero ticks, zero markers, serving lane busy with
resident personas (demand_lanes=4 vs lanes=2, the #310/#205 starvation
family) — and the operator found out by ASKING. Silence must never be
ambiguous with progress.

Two additions to the detached N-chances loop:
- benchmark.attempt.start probe per attempt — the pulse anchor a
  run-liveness watcher keys on (positron exam-room surface, #329, consumes
  the same class).
- A per-attempt DEADLINE derived from the act budget (max_acts × 15 min,
  3× headroom over the measured ~5.5 min/act — never flat; eval's 600s
  bounds one small task, a 12-act SWE attempt legitimately runs ~1h).
  On expiry: benchmark.stall probe + a loud failed/infra_error marker on
  the poll surface, and the run ENDS — one detection, never a retry into
  the same wedge. An infra fault, never a capability verdict.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants