Skip to content

fix: add missing isForkSubagentEnabled from main merge#4731

Merged
ytahdn merged 1 commit into
QwenLM:daemon_mode_b_mainfrom
doudouOUC:fix/merge-resolution-missing-fixes
Jun 3, 2026
Merged

fix: add missing isForkSubagentEnabled from main merge#4731
ytahdn merged 1 commit into
QwenLM:daemon_mode_b_mainfrom
doudouOUC:fix/merge-resolution-missing-fixes

Conversation

@doudouOUC

Copy link
Copy Markdown
Collaborator

Summary

  • Add isForkSubagentEnabled() method to Config class with env var gate (QWEN_CODE_ENABLE_FORK_SUBAGENT=1)
  • Add forkSubagentEnabled param and private field to Config
  • Re-export isForkSubagentEnabled() from fork-subagent.ts

These were in main but lost during the #4490 merge conflict resolution. Follow-up to #4730.

Test plan

  • Full build passes (npm run build exit 0)
  • TypeScript compilation clean — no TS2339/TS2305 errors

🤖 Generated with Qwen Code

Copilot AI review requested due to automatic review settings June 3, 2026 09:35
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

📋 Review Summary

This PR is described as a follow-up to #4730 to restore isForkSubagentEnabled() functionality lost during merge conflict resolution. However, the diff contains extensive unrelated changes beyond the stated scope, including MCP transport pool additions, runtime MCP server management, permission audit infrastructure, daemon logger integration, and a 6184-line test file deletion. The core fork subagent changes are straightforward, but the additional modifications significantly expand the PR's surface area and should be carefully evaluated for whether they belong in this "fix" PR or should be split into separate PRs.

🔍 General Feedback

  • Scope creep concern: The PR title/description suggests a narrow merge-resolution fix, but the actual diff touches telemetry interfaces, daemon serving infrastructure, MCP client management, permission auditing, and deletes an entire test file. This makes review difficult and increases merge risk.
  • Positive: The core fork subagent feature gate implementation (isForkSubagentEnabled()) is clean and follows the established pattern of combining env var + programmatic config.
  • Architectural consistency: The telemetry runtime config extension is well-structured, adding interface methods that match the existing pattern.
  • Test deletion: The removal of httpAcpBridge.test.ts (6184 lines) is significant and needs justification — is this file being moved, replaced, or are these tests genuinely no longer needed?

🎯 Specific Feedback

🔴 Critical

  • packages/cli/src/serve/httpAcpBridge.test.ts:1Entire test file deleted (6184 lines). This is a critical concern for a "fix" PR. If these tests are being moved elsewhere, the new location should be referenced. If they're obsolete, the PR description should explain why. Deleting this much test coverage without explanation risks regressions going undetected.

  • packages/core/src/config/config.ts:1024-1041disabledTools field mutability change. Changing from private readonly disabledTools: ReadonlySet<string> to private disabledTools: ReadonlySet<string> with a new setDisabledTools() method is a significant architectural change that affects thread-safety guarantees. The JSDoc mentions this is for daemon mutation via setWorkspaceToolEnabled, but this belongs in a separate refactor PR, not a merge-fix PR.

  • packages/core/src/config/config.ts:1041New runtimeMcpServers Map added. This introduces a whole new MCP server layer (runtime overlay over settings layer) with addRuntimeMcpServer() and removeRuntimeMcpServer() methods. This is feature work, not a merge fix.

🟡 High

  • packages/core/src/config/config.ts:919-935skipMcpDiscovery option added. The JSDoc references "proposal(serve): Mode B feature-priority roadmap toward v0.16 production-ready #4175 commit 6 review fix" and describes closing a "2N subprocess leak." This is substantive bugfix/feature work that should be its own PR with proper test coverage.

  • packages/core/src/config/config.ts:2653-2702setDisabledTools() method with extensive JSDoc. The JSDoc references "feat(serve): approval / tools / init / MCP-restart mutation routes (#4175 Wave 4 PR 17) #4282 fold-in 5" and describes runtime tool toggling semantics. This is part of a larger feature initiative and should be reviewed in that context.

  • packages/core/src/config/config.ts:2702-2754MCP transport pool integration (mcpTransportPool, setMcpTransportPool(), getMcpTransportPool()). References "F2 (proposal(serve): Mode B feature-priority roadmap toward v0.16 production-ready #4175 commit 4)" — this is major infrastructure work for workspace-shared MCP transport pooling.

  • packages/cli/src/serve/runQwenServe.ts:119-122Telemetry runtime config implementation. While the implementation is correct, it's part of a much larger telemetry expansion that includes many other changes throughout the file (permission audit ring, daemon logger, device flow registry disposal, etc.).

🟢 Medium

  • packages/core/src/tools/agent/fork-subagent.ts:4-13JSDoc removal. The removed JSDoc comment actually provides valuable context about the feature gate's two conditions (env var + interactive session). Consider keeping the documentation even if the function body is simplified.

  • packages/cli/src/serve/runQwenServe.ts:entire fileMassive expansion (~900+ lines added). Includes permission policy parsing, context filename extraction, audit ring allocation, filesystem factory resolution, diagnostic sink integration, and extensive shutdown telemetry handling. All of this is valuable work but belongs in separate PRs with focused scopes.

🔵 Low

  • packages/core/src/config/config.ts:3334Blank line before isComputerUseEnabled(). Minor formatting inconsistency — the new isForkSubagentEnabled() method ends with a trailing blank line that doesn't match the style of adjacent methods.

✅ Highlights

  • Fork subagent feature gate: The core isForkSubagentEnabled() implementation is clean, combining env var (QWEN_CODE_ENABLE_FORK_SUBAGENT=1) with programmatic config and the isInteractive() check for proper feature gating.

  • Telemetry interface consistency: The TelemetryRuntimeConfig interface additions follow the existing getter pattern and integrate cleanly with the daemon telemetry setup.

  • Daemon logger integration: The DaemonLogger wiring throughout runQwenServe.ts improves observability for daemon lifecycle events, replacing ad-hoc writeStderrLine calls with structured logging.


Recommendation

This PR needs to be split. The stated purpose is "add missing isForkSubagentEnabled from main merge," but the diff includes:

  1. ✅ Fork subagent feature (the stated fix)
  2. ❌ MCP transport pool infrastructure (proposal(serve): Mode B feature-priority roadmap toward v0.16 production-ready #4175)
  3. ❌ Runtime MCP server overlay (proposal(serve): Mode B feature-priority roadmap toward v0.16 production-ready #4175 T2.8)
  4. ❌ Disabled tools mutability (feat(serve): approval / tools / init / MCP-restart mutation routes (#4175 Wave 4 PR 17) #4282)
  5. ❌ Permission audit ring + publisher (F3)
  6. ❌ Daemon logger integration
  7. ❌ Telemetry expansion
  8. ❌ 6184-line test file deletion

Suggested action: Create a minimal PR with only:

  • packages/core/src/config/config.ts: forkSubagentEnabled param/field + isForkSubagentEnabled() method
  • packages/core/src/tools/agent/fork-subagent.ts: isForkSubagentEnabled() export
  • packages/core/src/telemetry/runtime-config.ts: isInteractive() method (required dependency)
  • packages/cli/src/serve/runQwenServe.ts: isInteractive() implementation (required dependency)

Move all other changes to their respective feature/fix PRs with proper context and test coverage.

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

Restores configuration and gating surfaces that were lost during a merge conflict resolution, ensuring fork-subagent enablement can be queried consistently and telemetry runtime config matches what the core telemetry SDK expects.

Changes:

  • Add Config.isForkSubagentEnabled() with an env-var override (QWEN_CODE_ENABLE_FORK_SUBAGENT=1) and plumb forkSubagentEnabled through ConfigParameters.
  • Add isForkSubagentEnabled(config) helper export in fork-subagent.ts (gated by both fork flag and interactive mode).
  • Extend TelemetryRuntimeConfig with isInteractive() and getOutboundCorrelationPropagateTraceContext(), and implement them for the daemon telemetry runtime config; remove httpAcpBridge.test.ts.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/tools/agent/fork-subagent.ts Adds exported helper to decide whether fork-subagent behavior is enabled.
packages/core/src/telemetry/runtime-config.ts Extends telemetry runtime config interface with two required methods.
packages/core/src/config/config.ts Adds forkSubagentEnabled parameter/field and isForkSubagentEnabled() method with env override.
packages/cli/src/serve/runQwenServe.ts Implements new telemetry runtime-config methods for the daemon telemetry config.
packages/cli/src/serve/httpAcpBridge.test.ts Removes the obsolete large test file from the CLI package.

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

Comment on lines 119 to +123
telemetry.resourceAttributeWarnings ?? [],
getCliVersion: () => cliVersion,
getSessionId: () => daemonSessionId,
isInteractive: () => false,
getOutboundCorrelationPropagateTraceContext: () => false,
@doudouOUC doudouOUC requested review from chiga0, yiliang114 and ytahdn June 3, 2026 09:40
Add isForkSubagentEnabled() to Config class and fork-subagent.ts,
brought in by main but lost during merge conflict resolution.
@doudouOUC doudouOUC force-pushed the fix/merge-resolution-missing-fixes branch from 21cfdfe to b1590e6 Compare June 3, 2026 09:44
@doudouOUC doudouOUC requested a review from wenshao June 3, 2026 11:00
return this.cronEnabled;
}

isForkSubagentEnabled(): boolean {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Suggestion] Config.isForkSubagentEnabled() and the free function isForkSubagentEnabled(config) in fork-subagent.ts share the same name but have different semantics — this method only checks env-var + config-field, while the free function additionally gates on config.isInteractive(). All current callers use the free function so there's no active bug, but the identical naming makes it easy for future code to call the Config method directly and bypass the interactive-mode guard.

Note: isCronEnabled() is fully self-contained in Config (no wrapper), making this two-layer pattern unique to fork-subagent.

Consider moving the isInteractive() check into this method itself (Config already has isInteractive() at line 3744), so the method has complete semantics. The free function can then become a pass-through or be removed entirely.

— qwen3.7-max via Qwen Code /review

@ytahdn ytahdn merged commit 42a01bc into QwenLM:daemon_mode_b_main Jun 3, 2026
4 checks passed
@doudouOUC doudouOUC deleted the fix/merge-resolution-missing-fixes branch June 3, 2026 13:47
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.

5 participants