Skip to content

chore: sync dev → main (upstream commits + PRs #2 #4)#5

Merged
alexsiri7 merged 14 commits intomainfrom
dev
Apr 20, 2026
Merged

chore: sync dev → main (upstream commits + PRs #2 #4)#5
alexsiri7 merged 14 commits intomainfrom
dev

Conversation

@alexsiri7
Copy link
Copy Markdown
Owner

Reconciles the fork so main becomes the single canonical branch.

Brings onto main:

Doesn't touch any upstream remote. After this lands, the fork's default branch will be switched from dev to main.

github-actions Bot and others added 14 commits April 12, 2026 09:19
Rename the core AI provider interface and all related types, classes,
factory functions, and directory from clients/ to providers/.

Rename map:
- IAssistantClient → IAgentProvider
- ClaudeClient → ClaudeProvider
- CodexClient → CodexProvider
- getAssistantClient → getAgentProvider
- AssistantRequestOptions → AgentRequestOptions
- IWorkflowAssistantClient → IWorkflowAgentProvider
- AssistantClientFactory → AgentProviderFactory
- WorkflowAssistantOptions → WorkflowAgentOptions
- packages/core/src/clients/ → packages/core/src/providers/

NOT renamed (user-facing/DB-stored): assistant config key,
DEFAULT_AI_ASSISTANT env var, ai_assistant_type DB column.

No behavioral changes — purely naming.
…nd docs

- AssistantDefaults → ProviderDefaults, ClaudeAssistantDefaults → ClaudeProviderDefaults
- Logger domains: client.claude → provider.claude, client.codex → provider.codex
- Fix stale JSDoc, error messages, and references in architecture docs, CHANGELOG, testing rules
- ProviderDefaults → CodexProviderDefaults (symmetric with ClaudeProviderDefaults)
- Fix stale "AI client" comments in orchestrator-agent.ts and orchestrator.test.ts
- Remove dead createMockAgentProvider in test/mocks/streaming.ts (zero importers, wrong method names)
- Fix irregular whitespace in .claude/rules/workflows.md
…t-to-iagentprovider

refactor: rename IAssistantClient to IAgentProvider
docs: consolidate Claude guidance into CLAUDE.md
…oleam00#1137)

* refactor: extract providers from @archon/core into @archon/providers

Move Claude and Codex provider implementations, factory, and SDK
dependencies into a new @archon/providers package. This establishes a
clean boundary: providers own SDK translation, core owns business logic.

Key changes:
- New @archon/providers package with zero-dep contract layer (types.ts)
- @archon/workflows imports from @archon/providers/types — no mirror types
- dag-executor delegates option building to providers via nodeConfig
- IAgentProvider gains getCapabilities() for provider-agnostic warnings
- @archon/core no longer depends on SDK packages directly
- UnknownProviderError standardizes error shape across all surfaces

Zero user-facing changes — same providers, same config, same behavior.

* refactor: remove config type duplication and backward-compat re-exports

Address review findings:
- Move ClaudeProviderDefaults and CodexProviderDefaults to the
  @archon/providers/types contract layer as the single source of truth.
  @archon/core/config/config-types.ts now imports from there.
- Remove provider re-exports from @archon/core (index.ts and types/).
  Consumers should import from @archon/providers directly.
- Update @archon/server to depend on @archon/providers for MessageChunk.

* refactor: move structured output validation into providers

Each provider now normalizes its own structured output semantics:
- Claude already yields structuredOutput from the SDK's native field
- Codex now parses inline agent_message text as JSON when outputFormat
  is set, populating structuredOutput on the result chunk

This eliminates the last provider === 'codex' branch from dag-executor,
making it fully provider-agnostic. The dag-executor checks structuredOutput
uniformly regardless of provider.

Also removes the ClaudeCodexProviderDefaults deprecated alias — all
consumers now use ClaudeProviderDefaults directly.

* fix: address PR review — restore warnings, fix loop options, cleanup

Critical fixes:
- Restore MCP missing env vars user-facing warning (was silently dropped)
- Restore Haiku + MCP tool search warning
- Fix buildLoopNodeOptions to pass workflow-level nodeConfig (effort,
  thinking, betas, sandbox were silently lost for loop nodes)
- Add TODO(coleam00#1135) comments documenting env-leak gate gap

Cleanup:
- Remove backward-compat type aliases from deps.ts (keep WorkflowTokenUsage)
- Remove 26 unnecessary eslint-disable comments from test files
- Trim internal helpers from providers barrel (withFirstMessageTimeout,
  getProcessUid, loadMcpConfig, buildSDKHooksFromYAML)
- Add @archon/providers dep to CLI package.json
- Fix 8 stale documentation paths pointing to deleted core/src/providers/
- Add E2E smoke test workflows for both Claude and Codex providers

* fix: forward provider system warnings to users in dag-executor

The dag-executor only forwarded system chunks starting with
"MCP server connection failed:" — all other provider warnings
(missing env vars, Haiku+MCP, structured output issues) were
logged but never reached the user.

Now forwards all system chunks starting with ⚠️ (the prefix
providers use for user-actionable warnings).

* fix: add providers package to Dockerfile and fix CI module resolution

- Add packages/providers/ to all three Dockerfile stages (deps,
  production package.json copy, production source copy)
- Replace wildcard export map (./*) with explicit subpath entries
  to fix module resolution in CI (bun workspace linking)

* chore: update bun.lock for providers package exports
…1160)

* fix: make env-integration test cross-platform (Windows CI)

Check for Windows env var equivalents (Path instead of PATH,
USERPROFILE instead of HOME) in scenario 3 assertions.

Closes coleam00#1128

* fix: Windows PATH/HOME casing in provider subprocess env test

Same cross-platform fix for ClaudeProvider test — spread objects
lose Windows case-insensitive behavior (Path vs PATH, USERPROFILE
vs HOME).
…ies (coleam00#1162)

* refactor: decompose provider sendQuery() into explicit helper boundaries (coleam00#1139)

sendQuery() in both Claude and Codex providers was a monolith mixing SDK option
building, nodeConfig translation, stream normalization, and error classification.
This makes it hard to safely extend for Phase 2 provider extensibility.

Decompose both providers into focused internal helpers:

Claude:
- buildBaseClaudeOptions: SDK option construction
- buildToolCaptureHooks: PostToolUse/PostToolUseFailure hook setup
- applyNodeConfig: workflow nodeConfig → SDK translation + structured warnings
- streamClaudeMessages: raw SDK event → MessageChunk normalization
- classifyAndEnrichError: error classification with retry decisions

Codex:
- buildTurnOptions: per-turn option construction (output schema, abort)
- streamCodexEvents: raw SDK event → MessageChunk normalization
- classifyAndEnrichCodexError: error classification with retry decisions

Also introduces ProviderWarning { code, message } replacing raw string warnings
for machine-readable provider translation warnings.

Adds 43 focused unit tests covering the extracted helpers directly.

Fixes coleam00#1139

* fix: export ToolResultEntry type used in public buildBaseClaudeOptions API

* fix: unexport internal helpers to prevent API surface leakage, fix retry state bug

Review findings:
1. Internal helpers were exported and reachable through package.json subpath
   exports (./claude/provider, ./codex/provider), widening the public API.
   All new helpers are now file-local — the only public exports remain
   ClaudeProvider, CodexProvider, loadMcpConfig, buildSDKHooksFromYAML,
   withFirstMessageTimeout, getProcessUid.

2. Codex streamState (lastTodoListSignature) was shared across retry
   attempts, causing todo-list dedup to suppress output on retry.
   Now creates fresh state per attempt.

Removed direct helper test imports — existing sendQuery e2e tests
(51 Claude + 42 Codex) cover all behavior paths.

* fix: address review findings — abort handling, retry bugs, error swallowing

Fixes from CodeRabbit + multi-agent review:

1. classifyAndEnrichError preserves first-event timeout diagnostic instead
   of collapsing it into generic "Query aborted" (the timeout aborts the
   controller, but the original error carries the coleam00#1067 breadcrumb)

2. nodeConfigWarnings emitted once before retry loop, not per attempt

3. buildSubprocessEnv() called once before retry loop (was re-logging
   auth mode and rebuilding { ...process.env } per attempt)

4. Abort signal listener registered once with forwarding to current
   controller (was accumulating per-retry listeners)

5. PostToolUse hook wrapped in try/catch (JSON.stringify can throw on
   circular refs — was asymmetric with PostToolUseFailure which had it)

6. Codex streamCodexEvents throws on abort instead of silent break
   (callers were getting truncated stream with no result/error)

7. Both providers store enrichedError (not raw error) for retry
   exhaustion — preserves stderr context in final throw

8. Log is_error result events at error level in Claude stream normalizer

* test: add black-box behavioral tests for sendQuery decomposition fixes

Restore test coverage for the specific fixes from the decomposition review,
exercised through sendQuery (black-box) since helpers are file-local:

Claude (6 tests):
- Timeout error preserved (not collapsed into "Query aborted")
- nodeConfig warnings emitted once even when retries occur
- Abort signal cancels across retries via single forwarding listener
- Enriched error (with stderr) thrown at retry exhaustion
- PostToolUse hook handles circular reference without crashing
- is_error result events logged at error level

Codex (3 tests):
- Abort signal throws instead of silently truncating stream
- Enriched error thrown at retry exhaustion
- Todo-list dedup state resets between retry attempts
- e2e-all-nodes: exercises bash, prompt, script (bun), structured output,
  model override (haiku), effort control, and $nodeId.output refs
- e2e-mixed-providers: tests Claude + Codex in the same workflow with
  cross-provider output references
- echo-args.js: simple script node test helper
…leam00#1135)

Remove the entire env-leak scanning/consent infrastructure: scanner,
allow_env_keys DB column usage, allow_target_repo_keys config, PATCH
consent route, --allow-env-keys CLI flag, and UI consent toggle.

The env-leak gate was the wrong primitive. Target repo .env protection
is already structural:
- stripCwdEnv() at boot removes Bun-auto-loaded CWD .env keys
- Archon loads its own env sources afterward (~/.archon/.env)
- process.env is clean before any subprocess spawns
- Managed env injection (config.yaml env: + DB vars) is unchanged

No scanning, no consent, no blocking. Any repo can be registered and
used. Subprocesses receive the already-clean process.env.
* chore(homebrew): update formula to v0.3.6

* feat: open PRs as ready by default + pr-maintenance draft promotion (#1)

* Fix pr-maintenance cron: prepend user bins to PATH

When cron invoked the script every 15 min, PATH was the minimal
/usr/bin:/bin. archon (installed at ~/.bun/bin/archon) was not
findable, so every "launching archon" step died with:
    /mnt/ext-fast/archon/scripts/pr-maintenance-cron.sh: line 59:
    archon: command not found

As a result PRs that needed conflict resolution stopped being
processed — they just accumulated as DIRTY or UNKNOWN.

Prepend $HOME/.bun/bin, $HOME/.local/bin, and /usr/local/bin to PATH
at the top of the script. Works from cron and from an interactive
shell unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: open PRs as ready by default + pr-maintenance draft promotion

Archon workflows previously created PRs with --draft, which meant even a
CI-green PR would sit idle until a human marked it ready. Combined with the
Phase 1 merge filter in pr-maintenance-cron.sh (which skips drafts), a green
draft could linger indefinitely.

This change removes --draft from all three unconditional gh pr create
invocations so PRs open ready-for-review by default:
  - .archon/workflows/defaults/archon-fix-github-issue.yaml
  - .archon/workflows/defaults/archon-piv-loop.yaml
  - .archon/workflows/defaults/archon-ralph-dag.yaml

Also includes the already-in-tree pr-maintenance-cron.sh additions that
complement this:
  - Phase 0: promote any CLEAN draft PRs to ready (belt-and-suspenders
    for PRs that still open as drafts from other sources).
  - Surface gh pr merge stderr to the cron log so real failures (perms,
    branch protection, etc.) are diagnosable instead of silently swallowed.

Together these eliminate "green draft sitting idle" as a failure mode.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* scripts: remove pr-maintenance-cron (moved to interstellarai.net)

This script was never archon-specific — it was a cron wrapper that
invokes archon workflows. It's been moved to
alexsiri7/interstellarai.net:ops/cron/pr-maintenance-cron.sh where
the rest of the pipeline cron scripts live, in PR coleam00#12 there.

The old copy here also sourced a now-dead gt/mayor lib path, so
removing it also clears a latent bug.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Rasmus Widing <rasmus.widing@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore(homebrew): update formula to v0.3.6

* feat: open PRs as ready by default + pr-maintenance draft promotion (#1)

* Fix pr-maintenance cron: prepend user bins to PATH

When cron invoked the script every 15 min, PATH was the minimal
/usr/bin:/bin. archon (installed at ~/.bun/bin/archon) was not
findable, so every "launching archon" step died with:
    /mnt/ext-fast/archon/scripts/pr-maintenance-cron.sh: line 59:
    archon: command not found

As a result PRs that needed conflict resolution stopped being
processed — they just accumulated as DIRTY or UNKNOWN.

Prepend $HOME/.bun/bin, $HOME/.local/bin, and /usr/local/bin to PATH
at the top of the script. Works from cron and from an interactive
shell unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat: open PRs as ready by default + pr-maintenance draft promotion

Archon workflows previously created PRs with --draft, which meant even a
CI-green PR would sit idle until a human marked it ready. Combined with the
Phase 1 merge filter in pr-maintenance-cron.sh (which skips drafts), a green
draft could linger indefinitely.

This change removes --draft from all three unconditional gh pr create
invocations so PRs open ready-for-review by default:
  - .archon/workflows/defaults/archon-fix-github-issue.yaml
  - .archon/workflows/defaults/archon-piv-loop.yaml
  - .archon/workflows/defaults/archon-ralph-dag.yaml

Also includes the already-in-tree pr-maintenance-cron.sh additions that
complement this:
  - Phase 0: promote any CLEAN draft PRs to ready (belt-and-suspenders
    for PRs that still open as drafts from other sources).
  - Surface gh pr merge stderr to the cron log so real failures (perms,
    branch protection, etc.) are diagnosable instead of silently swallowed.

Together these eliminate "green draft sitting idle" as a failure mode.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* workflows: downshift routine nodes to haiku, keep opus for heavy reasoning (#3)

Applied a systematic model audit to the 15 default workflows. Moved
routine nodes (create-pr, fix-failures, loop counters, status reports)
from Sonnet/Opus to Haiku 4.5. Kept Opus for:
  - The 5 security-audit analysis agents (injection, auth, privacy,
    config-deps, logic) + synthesize
  - archon-adversarial-dev's core GAN loop
  - All `implement` / `implement-tasks` nodes in feature-dev,
    idea-to-pr, plan-to-pr, ralph-dag, fix-github-issue

Upgraded archon-adversarial-dev's `plan` to Opus (spec-writing from
scratch in an adversarial context needs depth Sonnet doesn't provide).

Expected impact: ~35-40% cost reduction on the routine nodes that
dominate cron-driven archon runs, without sacrificing quality on the
heavy-reasoning paths.

* workflows: add custom workflows + auto-merge phases

Adds three custom archon workflows that were living untracked in the
working tree (pr-maintenance, security-audit, test-audit). Applies the
same haiku/sonnet downshifts from #3 to their routine nodes (create-pr,
fix-failures, fix-security, coverage-gap-agent, flaky-test-agent).

Also commits the Phase 11 prepare-merge + Phase 12 watch-and-merge
auto-merge additions to archon-fix-github-issue.yaml (watch-and-merge
uses haiku — polling loop, not reasoning) and the Phase 9 auto-merge
step in archon-idea-to-pr.yaml.

Gitignores *.jks — keystore files must never be committed.

* deps: add @openai/codex-sdk

For using Codex as a provider in archon workflows alongside Claude.
Also bumps internal workspace versions 0.3.5 → 0.3.6 (bun regenerated
on install).

---------

Co-authored-by: Rasmus Widing <rasmus.widing@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexsiri7 alexsiri7 merged commit 4967a16 into main Apr 20, 2026
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.

2 participants