From e15febcabf188fc9c94678f72d1fd2a6c83e0f16 Mon Sep 17 00:00:00 2001 From: htafolla Date: Fri, 15 May 2026 06:14:19 -0500 Subject: [PATCH] Codify Test Coverage Expansion pattern --- .strray/state/state.json | 55 ++++ .../Codify-Test-Coverage-Expansion-pattern.md | 10 + .../release-v1.22.46-to-head-2026-05-15.md | 288 ++++++++++++++++++ src/inference/inference-cycle.ts | 30 +- 4 files changed, 377 insertions(+), 6 deletions(-) create mode 100644 .strray/state/state.json create mode 100644 docs/guards/Codify-Test-Coverage-Expansion-pattern.md create mode 100644 docs/reflections/deep/release-v1.22.46-to-head-2026-05-15.md diff --git a/.strray/state/state.json b/.strray/state/state.json new file mode 100644 index 000000000..3c90c33ce --- /dev/null +++ b/.strray/state/state.json @@ -0,0 +1,55 @@ +{ + "votingHistory": [], + "metrics": { + "totalVotes": 0, + "successfulVotes": 0, + "failedVotes": 0, + "averageConfidence": 0, + "strategyUsage": { + "majority_vote": 0, + "consensus": 0, + "expert_priority": 0 + }, + "agentParticipation": {}, + "averageVoterTurnout": 0 + }, + "exportedAt": "2026-05-15T10:37:21.740Z", + "voting:history": [ + { + "id": "vote_1778843419105_32efdce0", + "sessionId": "inference-governance-1778843343067", + "topic": "Codify Extract Method pattern", + "voteCount": 3, + "strategy": "consensus", + "decision": "approve", + "confidence": 0.04772122424242425, + "participantCount": 4, + "timestamp": 1778843419105, + "resolvedAt": 1778843419106 + }, + { + "id": "vote_1778843419106_8c1eb826", + "sessionId": "inference-governance-1778843343067", + "topic": "Codify Test Coverage Expansion pattern", + "voteCount": 3, + "strategy": "expert_priority", + "decision": "approve", + "confidence": 0.75, + "participantCount": 4, + "timestamp": 1778843419106, + "resolvedAt": 1778843419106 + }, + { + "id": "vote_1778843419106_02e1ae2d", + "sessionId": "inference-governance-1778843343067", + "topic": "Address: Bug: fix: increase timeout for processor auto-discovery tests to prevent flak... (112x)", + "voteCount": 3, + "strategy": "expert_priority", + "decision": "approve", + "confidence": 0.576, + "participantCount": 4, + "timestamp": 1778843419106, + "resolvedAt": 1778843419106 + } + ] +} \ No newline at end of file diff --git a/docs/guards/Codify-Test-Coverage-Expansion-pattern.md b/docs/guards/Codify-Test-Coverage-Expansion-pattern.md new file mode 100644 index 000000000..27049c741 --- /dev/null +++ b/docs/guards/Codify-Test-Coverage-Expansion-pattern.md @@ -0,0 +1,10 @@ +# Guard: Codify Test Coverage Expansion pattern + +Test Coverage Expansion detected across 110 sessions (avg confidence: 95%). 7 new test files added. Test-first or test-alongside development — covering new code as it ships. + +## Evidence ++ src/__tests__/e2e/inference-e2e.test.ts ++ src/__tests__/integration/inference-pipeline.test.ts ++ src/__tests__/unit/inference/deploy-verifier.test.ts ++ src/__tests__/unit/inference/inference-accumulator.test.ts ++ src/__tests__/unit/inference/inference-cycle.test.ts \ No newline at end of file diff --git a/docs/reflections/deep/release-v1.22.46-to-head-2026-05-15.md b/docs/reflections/deep/release-v1.22.46-to-head-2026-05-15.md new file mode 100644 index 000000000..3a575f8ab --- /dev/null +++ b/docs/reflections/deep/release-v1.22.46-to-head-2026-05-15.md @@ -0,0 +1,288 @@ +# Release Reflection: 1.22.46 → HEAD + +**Generated:** 2026-05-15T10:37:09.095Z +**Cadence:** release (since tag v1.22.46) +**Commits examined:** 72 +**Span:** v1.22.46..HEAD + +## Scope + +- **72 commits** with **15622 file changes** +- **+641011 insertions / -302175 deletions** +- **0 files added, 0 modified, 0 deleted** + +## Commit Chronicle + +- **fix: replace console.log with frameworkLogger in governance-client; propagate SolarGovernanceVoteResult through inference cycle** (d1537bf) + 0 files: src/inference/inference-cycle.ts, src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts + +- **refactor: complete governance client refactor — callTool proxy, evaluateGovernance route, remove dead code** (770a131) + 3 files: docs/reflections/deep/release-v1.22.46-to-head-2026-05-13.md, src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts + +- **refactor: use confidenceAdjustment numeric threshold instead of solarActivityLevel string for recommendation logic** (470556a) + 3 files: src/integrations/governance/index.ts + +- **feat: wire govern_with_solar as the primary governance endpoint** (72263a1) + 1 files: src/integrations/governance/index.ts, src/integrations/governance/types.ts, src/opencode/strray/features.json + +- **Revert "remove solar enhancement overlay — endpoint already consumes NOAA GOES natively via dynamo___evaluate_governance"** (0f807e1) + 3 files: src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts, src/integrations/governance/types.ts, src/opencode/strray/features.json + +- **remove solar enhancement overlay — endpoint already consumes NOAA GOES natively via dynamo___evaluate_governance** (9c34ca7) + 4 files: src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts, src/integrations/governance/types.ts, src/opencode/strray/features.json + +- **fix: increase opencode spawn timeout from 60s to 300s to prevent premature timeouts during agent voting** (31f0fe6) + 4 files: src/inference/inference-cycle.ts + +- **fix: initialize external governance in inference:run CLI command for two-oscillator governance** (c187e04) + 1 files: src/cli/index.ts + +- **fix: two-oscillator governance — trust endpoint decision, remove local confidence override** (caa444f) + 1 files: init.sh, opencode.json, package.json, src/__tests__/pipeline/test-agent-registry-pipeline.mjs, src/inference/inference-cycle.ts +2 more + +- **docs(agents): correct agent counts — 42 YAML agents, 22 TS routing modules** (eeee498) + 7 files: AGENTS.md, README.md + +- **refactor(config): source-of-truth pipeline — src/opencode/ → .opencode/** (6c5909e) + 2 files: .gitignore, .opencode/activity-report.json, .opencode/agents/.gitkeep, .opencode/agents/enforcer.yml, .opencode/agents/orchestrator.yml +281 more + +- **feat: enable spawn gate monitoring mode + release reflection doc** (5746fa8) + 286 files: .opencode/activity-report.json, .opencode/logs/.strray-init.lock, .opencode/state, .strray/inference/prompts/01-researcher.md, .strray/state/state.json +2 more + +- **fix: singleton + state management to prevent recursive agent spawning** (2b2a018) + 7 files: src/cli/index.ts, src/inference/inference-cycle.ts, src/integrations/hermes-agent/bridge.mjs, src/integrations/openclaw/api-server.ts, src/mcps/orchestrator/server.ts + +- **feat: enable inference_governance + solar enhancement for monitoring** (b4d782f) + 5 files: .opencode/strray/features.json, .strray/features.json + +- **feat: wire govern_with_solar tool — real-time NOAA solar context into governance decisions** (4ba49d5) + 2 files: .opencode/strray/features.json, .strray/features.json, src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts, src/integrations/governance/types.ts + +- **fix: add centralized OpenCode spawn gate to prevent all recursive agent spawning** (b8ff0e7) + 5 files: .opencode/activity-report.json, .opencode/logs/.strray-init.lock, .opencode/state, .opencode/strray/features.json, .strray/config.json +597 more + +- **v1.22.59** (28183e3) + 602 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/codex.codex, .opencode/command/dependency-audit.md, .opencode/commands/pre-commit-introspection.sh +184 more + +- **fix: disable auto-spawning of opencode agents to prevent runaway processes** (2948703) + 189 files: .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/commands/pre-commit-introspection.sh, .opencode/logs/.strray-init.lock +541 more + +- **v1.22.58** (30a1674) + 546 files: .strray/config.json, .strray/integrations.json + +- **v1.22.58** (2361dad) + 2 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/codex.codex, .opencode/command/dependency-audit.md, .opencode/commands/pre-commit-introspection.sh +183 more + +- **v1.22.56** (1a428c0) + 188 files: node_modules/.package-lock.json, node_modules/strray-ai/.opencode/AGENTS-consumer.md, node_modules/strray-ai/.opencode/codex.codex, node_modules/strray-ai/.opencode/commands/model-health-check.md, node_modules/strray-ai/.opencode/commands/pre-commit-introspection.sh +13120 more + +- **chore: sync config files to v1.22.56, add inference_governance feature block** (1584fd1) + 13125 files: .opencode/logs/.strray-init.lock, .strray/config.json, .strray/features.json, .strray/integrations.json, package-lock.json +1 more + +- **v1.22.57** (170472e) + 6 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +194 more + +- **feat: integrate chrono-warp-drive governance MCP for inference checking** (a61cd6f) + 199 files: .opencode/strray/integrations.json, .opencode/strray/routing-mappings.json, src/inference/inference-cycle.ts, src/integrations/governance/governance-client.ts, src/integrations/governance/index.ts +1 more + +- **Address: Bug: fix: increase timeout for processor auto-discovery tests to prevent flak... (112x)** (02d8fa9) + 6 files: .opencode/logs/.strray-init.lock, .opencode/state, .opencode/strray/features.json, .strray/inference/prompts/01-researcher.md, .strray/state/state.json +1 more + +- **chore: update strray-ai to v1.22.55, add vote scripts and reflection** (13280fd) + 6 files: .strray/config.json, .strray/inference/prompts/01-researcher.md, .strray/integrations.json, docs/reflections/deep/release-v1.22.46-to-head-2026-05-09.md, package-lock.json +7 more + +- **feat: add auto-rotation to activity logger at 5MB threshold** (ee6a4da) + 12 files: src/core/activity-logger.ts + +- **v1.22.55** (c343767) + 1 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +196 more + +- **feat: wire 3 orphaned features + add tests + remove empty api-gateway** (077b8dc) + 201 files: docs/dead-code-audit.md, docs/integration-surfaces.md, docs/target-architecture.md, src/__tests__/unit/commit-batcher-processor.test.ts, src/__tests__/unit/mcp-servers-integration.test.ts +5 more + +- **feat: wire apply phase via MCP routing + fix e2e tests (41/41 PASS)** (db8abef) + 10 files: .strray/inference/prompts/01-researcher.md, docs/reflections/apply-phase-real-code-changes-via-mcp-routing.md, scripts/test/test-opencode-e2e.mjs, src/inference/inference-cycle.ts, src/integrations/hermes-agent/bridge.mjs +3 more + +- **docs: add apply phase design — real code changes via MCP routing** (8eab050) + 8 files: docs/reflections/apply-phase-real-code-changes-via-mcp-routing.md + +- **revert: roll back apply phase marker system — needs real agent invocation via plugin/MCP routing** (10309b2) + 1 files: src/inference/inference-cycle.ts + +- **feat: wire apply phase for real code changes instead of markdown markers** (f190318) + 1 files: src/inference/inference-cycle.ts + +- **fix: remove unused imports and any type from processor-manager.interfaces.test.ts (processor-test-rules ESLint)** (529d3d2) + 1 files: src/processors/processor-manager.interfaces.test.ts + +- **fix: address all open bugs (#29-32, #34) and prevent noise PRs from inference cycle** (c32d711) + 1 files: src/__tests__/unit/security-encryption-fix.test.ts, src/enforcement/core/__tests__/violation-fixer.test.ts, src/enforcement/core/violation-fixer.ts, src/inference/inference-cycle.ts, src/processors/processor-manager.ts +2 more + +- **fix: remove enforcer references from integration test, add fetch-depth:0 for e2e git tests** (deb49f4) + 7 files: .github/workflows/ci.yml, src/__tests__/unit/integration.test.ts + +- **fix: triage and fix all GitHub workflow pipelines** (097b48c) + 2 files: .github/workflows/auto-report.yml, .github/workflows/processor-tests.yml, .github/workflows/publish.yml, .github/workflows/release.yml, .github/workflows/security-audit.yml +2 more + +- **fix: restore package.json, mcp-install.ts, workflows, and govern-reflection.mjs gutted by 84dae31b1** (7417fd6) + 7 files: .github/workflows/ci-cd-monitor.yml, .github/workflows/ci.yml, .github/workflows/enforce-agents-md.yml, .github/workflows/release.yml, .github/workflows/security.yml +6 more + +- **fix: add npm audit fix to main CI workflow** (84dae31) + 11 files: .github/workflows/ci.yml + +- **fix: run npm audit fix to resolve moderate vulnerabilities** (314cc06) + 1 files: .github/workflows/security.yml, package.json + +- **fix: remove duplicate case undefined in mcp-install.ts (lint error)** (9b713b9) + 2 files: src/cli/commands/mcp-install.ts + +- **chore: trigger ci-cd-monitor with force_fix=true** (b36970f) + 1 files: .github/force-monitor-trigger.txt + +- **ci: improve ci-cd-monitor.yml - better error handling + governance integration** (a095f17) + 1 files: .github/workflows/ci-cd-monitor.yml + +- **chore: trigger monitoring script** (0dddd30) + 1 files: .github/monitor-trigger.txt + +- **fix: make trace-context more robust + fix ESM issues in govern-reflection** (e665442) + 1 files: scripts/node/govern-reflection.mjs, src/core/trace-context.ts + +- **ci: improve all workflows - add caching, coverage, security hardening, and new governance test step** (05a8c08) + 2 files: .github/workflows/ci.yml, .github/workflows/enforce-agents-md.yml, .github/workflows/release.yml, .github/workflows/security.yml + +- **feat: add centralized TraceContext + integrate Reflection Governance with ValidatorRegistry** (1a79c88) + 4 files: scripts/node/govern-reflection.mjs, src/core/trace-context.ts + +- **feat: implement governance-approved stagger + trace propagation, add reflection governance pipeline** (27d6e29) + 2 files: docs/reflections/deep/lexicon-cross-correlation-journey-2026-05-06.md, scripts/node/govern-reflection.mjs, src/core/framework-logger.ts, src/inference/inference-cycle.ts, src/processors/processor-manager.ts + +- **v1.22.53** (6ddf31d) + 5 files: .opencode/activity-report.json, .strray/config.json, .strray/integrations.json, CHANGELOG.md, backups/version-manager-backup-2026-05-06T16-22-00-109Z/CHANGELOG.md +7 more + +- **chore: UVM sync v1.22.52 — all version references updated** (ce3b70e) + 12 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/codex.codex, .opencode/command/dependency-audit.md, .opencode/commands/pre-commit-introspection.sh +186 more + +- **chore: UVM sync to v1.22.51** (b53a5ac) + 191 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +184 more + +- **v1.22.51** (3d96823) + 189 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +186 more + +- **fix: agent registry cleanup — remove skill-only entries, delete deprecated agents** (1cafc3a) + 191 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +226 more + +- **fix: agent export naming + single-architect governance** (b5c6100) + 231 files: agents/testing-lead.yml, src/__tests__/agents/testing-lead.test.ts, src/__tests__/unit/inference/inference-cycle.test.ts, src/agents/content-creator.ts, src/agents/growth-strategist.ts +8 more + +- **fix: complete inference-cycle.ts — all fixes applied.** (cef1ecd) + 13 files: src/inference/inference-cycle.ts + +- **docs: deep reflection — inference apply phase journey (honest assessment)** (1a05086) + 1 files: docs/reflections/deep/inference-apply-phase-journey-2026-05-01.md + +- **fix: guard inference:run for StringRay internal use only** (beefefb) + 1 files: src/cli/index.ts + +- **feat: wire apply phase + researcher double-check for PRs** (7bfa4ca) + 1 files: src/cli/index.ts, src/inference/inference-cycle.ts + +- **fix: governance pipeline — force flag, skipDeployVerify default, deploy failure handling** (40ae8ae) + 2 files: src/cli/index.ts, src/inference/inference-cycle.ts + +- **feat: unify governance — wire WeightedVotingAggregator, expand agents, connect orchestrator** (fca44e6) + 2 files: .gitignore, .opencode/activity-report.json, .strray/inference/latest-workflow.json, .strray/inference/workflow-status.json, .strray/state/state.json +1321 more + +- **feat: unify governance — wire WeightedVotingAggregator, expand agents, connect orchestrator** (191536d) + 1326 files: dist/delegation/index.d.ts, dist/delegation/index.d.ts.map, dist/delegation/index.js, dist/delegation/index.js.map, dist/delegation/voting-coordinator.d.ts +15 more + +- **docs: governance unification saga — deep reflection on wiring four systems into one loop** (9cd5b8b) + 20 files: docs/reflections/deep/governance-unification-saga-2026-04-30.md + +- **feat: lower inference thresholds to trigger on real data, keep raw problem text** (c7c09a4) + 1 files: dist/inference/inference-accumulator.js, dist/inference/inference-accumulator.js.map, dist/inference/inference-cycle.d.ts.map, dist/inference/inference-cycle.js, dist/inference/inference-cycle.js.map +6 more + +- **feat: production-ready inference governance — CLI, real agents, DI, learning loop** (501eb8d) + 11 files: .opencode/activity-report.json, .strray/inference/latest-workflow.json, .strray/inference/workflow-status.json, .strray/state/state.json, AGENTS.md +82 more + +- **feat: inference layer — semantic patterns, session capture, accumulator, governance cycle, deploy verifier** (5963ce1) + 87 files: .strray/inference/latest-workflow.json, .strray/inference/workflow-status.json, dist/CHANGELOG.md, dist/inference/deploy-verifier.d.ts, dist/inference/deploy-verifier.d.ts.map +50 more + +- **fix: increase timeout for processor auto-discovery tests to prevent flaky failures** (baae755) + 55 files: src/__tests__/unit/processor-auto-discovery.test.ts + +- **fix: inference processor double-joining absolute path created bogus Users/ dir** (a795635) + 1 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +577 more + +- **chore: v1.22.48, add prepublishOnly to strip source maps and declarations** (112ef89) + 582 files: .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex, .opencode/command/dependency-audit.md +303 more + +- **chore: v1.22.47, add .npmignore to strip .d.ts and source maps from package** (e2f7225) + 308 files: .npmignore, .opencode/.strrayrc.json, .opencode/AGENTS-consumer.md, .opencode/activity-report.json, .opencode/codex.codex +248 more + +- **chore: remove 92 build artifacts (.d.ts, .d.ts.map) from .opencode git tracking, add to .gitignore** (22f9ddf) + 253 files: .gitignore, .opencode/activity-report.json, .opencode/core/activity-logger.d.ts.map, .opencode/core/adaptive-kernel.d.ts.map, .opencode/core/boot-orchestrator.d.ts.map +59 more + +- **docs: the engine that built the engine — deep reflection on the meta-system, consumer tweet, release reflection** (522c28b) + 64 files: AGENTS.md, docs/reflections/deep/release-v1.22.46-to-head-2026-04-29.md, docs/reflections/deep/the-engine-that-built-the-engine-saga-2026-04-29.md, tweets/v1.22.46.md + +- **chore: rebuild dist after path fix** (4453c41) + 4 files: .strray/codex.json, .strray/config.json, .strray/features.json, .strray/integrations.json, dist/AGENTS.md + +## Files Added + +*(none)* + +## Files Modified + +*(none)* + +## Patterns Observed + +- Bug fixes present — stability improvement +- Refactoring detected — architectural debt being addressed +- Version bumps/releases present — release cadence active + +## Key Decisions + +- Structural change: fix: replace console.log with frameworkLogger in governance-client; propagate SolarGovernanceVoteResult through inference cycle +- Structural change: refactor: complete governance client refactor — callTool proxy, evaluateGovernance route, remove dead code +- Structural change: refactor: use confidenceAdjustment numeric threshold instead of solarActivityLevel string for recommendation logic +- Removal: Revert "remove solar enhancement overlay — endpoint already consumes NOAA GOES natively via dynamo___evaluate_governance" +- Removal: remove solar enhancement overlay — endpoint already consumes NOAA GOES natively via dynamo___evaluate_governance +- Fix: fix: increase opencode spawn timeout from 60s to 300s to prevent premature timeouts during agent voting +- Fix: fix: initialize external governance in inference:run CLI command for two-oscillator governance +- Fix: fix: two-oscillator governance — trust endpoint decision, remove local confidence override +- Structural change: refactor(config): source-of-truth pipeline — src/opencode/ → .opencode/ +- Fix: fix: singleton + state management to prevent recursive agent spawning +- Fix: fix: add centralized OpenCode spawn gate to prevent all recursive agent spawning +- Fix: fix: disable auto-spawning of opencode agents to prevent runaway processes +- Fix: Address: Bug: fix: increase timeout for processor auto-discovery tests to prevent flak... (112x) +- Removal: feat: wire 3 orphaned features + add tests + remove empty api-gateway +- Fix: feat: wire apply phase via MCP routing + fix e2e tests (41/41 PASS) +- Fix: fix: remove unused imports and any type from processor-manager.interfaces.test.ts (processor-test-rules ESLint) +- Fix: fix: address all open bugs (#29-32, #34) and prevent noise PRs from inference cycle +- Fix: fix: remove enforcer references from integration test, add fetch-depth:0 for e2e git tests +- Fix: fix: triage and fix all GitHub workflow pipelines +- Fix: fix: restore package.json, mcp-install.ts, workflows, and govern-reflection.mjs gutted by 84dae31b1 +- Fix: fix: add npm audit fix to main CI workflow +- Fix: fix: run npm audit fix to resolve moderate vulnerabilities +- Fix: fix: remove duplicate case undefined in mcp-install.ts (lint error) +- Fix: chore: trigger ci-cd-monitor with force_fix=true +- Fix: fix: make trace-context more robust + fix ESM issues in govern-reflection +- Fix: fix: agent registry cleanup — remove skill-only entries, delete deprecated agents +- Fix: fix: agent export naming + single-architect governance +- Fix: fix: complete inference-cycle.ts — all fixes applied. +- Fix: fix: guard inference:run for StringRay internal use only +- Fix: fix: governance pipeline — force flag, skipDeployVerify default, deploy failure handling +- Fix: fix: increase timeout for processor auto-discovery tests to prevent flaky failures +- Fix: fix: inference processor double-joining absolute path created bogus Users/ dir +- Removal: chore: remove 92 build artifacts (.d.ts, .d.ts.map) from .opencode git tracking, add to .gitignore +- Fix: chore: rebuild dist after path fix + +## Inference Notes + +- Active development session: 72 commits across 0 areas + +--- +*Generated by StorytellingTriggerProcessor — release cadence — 2026-05-15T10:37:09.095Z* \ No newline at end of file diff --git a/src/inference/inference-cycle.ts b/src/inference/inference-cycle.ts index e663961f6..46ea5a144 100644 --- a/src/inference/inference-cycle.ts +++ b/src/inference/inference-cycle.ts @@ -851,6 +851,8 @@ Respond with EXACTLY one of: promptLength: prompt.length, }); + let mcpResponseText: string | undefined; + try { const { mcpClientManager } = await import("../mcps/mcp-client.js"); const result = await mcpClientManager.callServerTool("orchestrator", "orchestrate-task", { @@ -864,20 +866,22 @@ Respond with EXACTLY one of: executionMode: "sequential", }); const content = (result as { content?: Array<{ text?: string }> }).content; - let responseText = ""; + mcpResponseText = ""; if (content && Array.isArray(content)) { - responseText = content.map((c: { text?: string }) => c.text ?? "").join(""); + mcpResponseText = content.map((c: { text?: string }) => c.text ?? "").join(""); } else { - responseText = JSON.stringify(result); + mcpResponseText = JSON.stringify(result); } // Only return if the response contains actual vote data (PROPOSAL blocks). // Generic orchestration ACKs like "Tool orchestrate-task executed..." have no votes. - if (/PROPOSAL:\s*\d+/i.test(responseText)) { - return responseText; + if (/PROPOSAL:\s*\d+/i.test(mcpResponseText)) { + frameworkLogger.log("inference-cycle", "using-mcp-orchestrator-path", "info", { agentName }); + console.error(`>>> USING MCP PATH (orchestrator/orchestrate-task) for ${agentName}`); + return mcpResponseText; } frameworkLogger.log("inference-cycle", "mcp-no-votes", "info", { agentName, - responsePreview: responseText.substring(0, 200), + responsePreview: mcpResponseText.substring(0, 200), }); } catch (mcpError) { frameworkLogger.log("inference-cycle", "mcp-invocation-failed", "info", { @@ -891,10 +895,24 @@ Respond with EXACTLY one of: return this.agentInvoker(agentName, prompt); } + // === PURE MCP TEST MODE === + // Set STRRAY_FORCE_MCP_GOVERNANCE=true to run and test ONLY the MCP path. + // This completely disables the opencode run fallback for governance deliberation. + // Use this to validate that the MCP (orchestrator + knowledge skills) route works in isolation. + if (process.env.STRRAY_FORCE_MCP_GOVERNANCE === "true") { + frameworkLogger.log("inference-cycle", "pure-mcp-mode-no-opencode-fallback", "warning", { + agentName, + message: "OPENCODE FALLBACK BLOCKED — pure MCP governance test mode active", + }); + console.error(`>>> PURE MCP MODE: opencode fallback disabled for ${agentName}`); + return mcpResponseText || `MCP-ONLY: No usable PROPOSAL output from orchestrator for ${agentName}`; + } + return this.invokeViaOpencode(agentName, prompt); } private async invokeViaOpencode(agentName: string, prompt: string): Promise { + console.error(`>>> USING LEGACY OPENCODE FALLBACK (opencode run --agent ${agentName})`); // GATE: Centralized spawn gate — blocks all opencode spawning by default spawnGate.assertAllowed("inference-cycle");