Skip to content

refactor: two-phase parameter flow (Intent / Resolved)#194

Merged
kangig94 merged 3 commits intomainfrom
dev
Apr 15, 2026
Merged

refactor: two-phase parameter flow (Intent / Resolved)#194
kangig94 merged 3 commits intomainfrom
dev

Conversation

@kangig94
Copy link
Copy Markdown
Owner

Summary

  • refactor(execution): Establish Intent / Resolved two-phase architecture for request parameters
    • Upstream layers (CLI → HTTP → Zod → handler): all optional, pure pass-through, zero defaults
    • Service layer: single resolution boundary — resolveEffort(), cwd, bypassPermissions resolved here
    • ProviderRequest.cwd: string, effort: EffortLevel (non-optional) — fully resolved contract
    • Provider adapters translate only, never default
  • refactor(service): ExecInput/ResumeInput/ForkInput/CoralInputLaunchIntentBase + discriminated variants
  • refactor(service): coralDispatch() simplified to thin pre-processor delegating to start()/resume()
  • refactor(service): resume() accepts optional agent for instruction injection
  • fix(codex): Effort mapping — Coral max → Codex xhigh
  • cleanup: Remove process.cwd() from provider request paths, resolveEffort() from provider adapters
  • test: Suppress stderr from intentional error scenarios, Codex effort vocabulary validation

Test plan

  • npm run build:release clean
  • npm test — 1549 tests pass, 0 failures, 0 errors
  • grep -r 'process.cwd()' src/providers/ --include='*.ts' | grep -v __tests__ — only infrastructure exceptions
  • grep -r 'resolveEffort' src/providers/ — 0 matches
  • Codex effort mapping: all 4 EffortLevel values map to valid Codex vocabulary

🤖 Generated with Claude Code

kangig94 and others added 3 commits April 15, 2026 15:58
…hitecture

Establish a clean two-phase architecture for request parameters:

**Intent** (CLI → HTTP → Zod → handler): all optional, pure pass-through,
zero defaults. Zod validates format only.

**Resolved** (ProviderRequest → Provider adapter): fully determined.
- ProviderRequest.cwd: string (non-optional, resolved from input.cwd ?? ctx.projectRoot)
- ProviderRequest.effort: EffortLevel (non-optional, resolveEffort() called once in service)
- Provider adapters translate only, never default

Key changes:
- ExecInput/ResumeInput/ForkInput/CoralInput → LaunchIntentBase + discriminated variants
- coralDispatch() simplified to thin pre-processor delegating to start/resume
- resume() accepts optional agent for instruction injection (replaces coralDispatch's manual resolution)
- resolveEffort() removed from claude-executor.ts, moved to service layer
- process.cwd() removed from all provider request paths
- Codex effort mapping: Coral 'max' → Codex 'xhigh'
- toProviderRequest() uses resolveEffort() for persisted record reconstruction

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests that deliberately trigger errors (KB init failure, probe unavailable)
were printing ERROR lines to stderr, making clean test runs look like
they had failures. Spy on process.stderr.write during those tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ensures every EffortLevel maps to a Codex-accepted value (low/medium/
high/xhigh) and never leaks Coral-only values like 'max' to the RPC.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kangig94 kangig94 merged commit 0844b7e into main Apr 15, 2026
1 check passed
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