Conversation
Closes #183 --------- Co-authored-by: Eivind Meyer <eiv.meyer@gmail.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Eivind Meyer <eivind.meyer@ksat.no> Co-authored-by: Michael Eichelbeck <141341133+mkceichelbeck@users.noreply.github.com> Co-authored-by: Michael Eichelbeck <michael.eichelbeck.ext@wtsde.onmicrosoft.de>
## Summary - add typed command registry + dispatch wiring for TUI slash commands - add CLI compatibility helpers for list/status output - add tests for registry and dispatcher updates ## Testing - npm test (via pre-commit) - npm run lint (warnings only) Fixes #185
## Summary - add reusable start-cluster helper for TUI (text/issue/file) - add TUI service wrapper for starting clusters - add unit tests for helper ## Testing - npm test (via pre-commit) - npm run lint (warnings only) Fixes #187
## Summary - wire Launcher submit to start cluster from text - treat numeric input as plain text - optimistic cluster id + navigate to Cluster view - tests for launcher behavior ## Testing - npm test (via pre-commit) - npm run lint (warnings only) Fixes #189
## Summary - implement /issue command to launch an issue cluster and move to Cluster view - add issue launch wiring + deps in dispatcher/context - add cluster launch helper and tests ## Testing - not run (eslint reports pre-existing issues in repo)
## Summary - exclude generated lib/tui output from linting ## Testing - npm run lint (warnings only) - tsc --noEmit (pre-push)
## Summary - add a cluster log streaming helper that polls the ledger and emits normalized log lines - render live logs with timestamps and agent attribution in Cluster view (bounded to last N lines) - add unit coverage for db path resolution and stream readiness - stabilize /status detection under parallel tests by honoring env home paths and adding a task/cluster fallback ## Testing - `npm test` Closes #194.
## Summary - add a cluster registry helper to read orchestrator cluster summaries - render a selectable Monitor view list with refresh + keyboard navigation - wire Monitor view into app/router and open selected cluster - add unit coverage for cluster sorting and cwd resolution ## Testing - `npx mocha tests/unit/tui-cluster-registry.test.js` Closes #196.
## Summary - add cluster metrics aggregation using pidusage - render CPU/memory columns in Monitor view - extend cluster registry tests for metrics handling ## Testing - npx mocha tests/unit/tui-cluster-registry.test.js Closes #198
## Summary - start TUI in Monitor view when using `zeroshot watch` - keep default Launcher view for `zeroshot tui` ## Testing - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/mocha tests/cli-rendering.test.js Closes #201
## Summary - add cluster topology model from config (agents + topic wiring) - render topology section in Cluster view (agents + adjacency list) - add unit coverage for topology model parsing ## Testing - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/tsc -p tsconfig.tui.json - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/mocha tests/unit/tui-cluster-topology.test.js Closes #203
## Summary - add ledger-backed workflow timeline stream for key topics - render timeline section in Cluster view - add unit coverage for timeline service ## Testing - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/tsc -p tsconfig.tui.json - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/mocha tests/unit/tui-cluster-timeline.test.js Closes #205
## Summary - add agent selection in Cluster view with Enter to open Agent view - tail logs for a specific agent using filtered cluster log stream - add agent log filtering coverage ## Testing - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/tsc -p tsconfig.tui.json - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/mocha tests/unit/tui-cluster-logs.test.js Closes #207
## Summary - add agent message queue helper utilities - render message input + queued list in Agent view - queue pending messages in app state for Agent view ## Testing - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/tsc -p tsconfig.tui.json - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/mocha tests/unit/tui-agent-messages.test.js Closes #209
## Summary - add guidance topics module and ledger mailbox query helper - map target_agent_id to receiver on ledger writes - expose guidance mailbox via message bus and add tests ## Testing - NODE_PATH=/Users/tom/code/covibes/external/zeroshot/node_modules /Users/tom/code/covibes/external/zeroshot/node_modules/.bin/mocha tests/unit/guidance-mailbox.test.js Closes #211
## Summary
When Claude CLI returns an error result without actual agent output, the
extraction pipeline was falling through to `extractDirectJson` which
blindly accepted any JSON object - including raw CLI metadata like:
```json
{"type":"result","subtype":"error","duration_ms":1234,"session_id":"abc",...}
```
This caused schema validation to run against the wrong data structure,
generating confusing warnings:
```
Agent worker output failed JSON schema validation: #/required must have required property 'summary';
#/required must have required property 'completionStatus'
```
## Fix
Add `isCliMetadata()` check to reject objects that have:
- `type:result` (CLI wrapper format)
- 2+ CLI-specific metadata fields (duration_ms, session_id,
total_cost_usd, etc.)
This ensures `parseResultOutput` returns `null` for error cases,
triggering proper error handling rather than schema validation against
wrong data.
## Test plan
- [x] Added unit tests for CLI metadata rejection
- [x] Added regression test for error result scenario
- [x] All 70 output extraction tests pass
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
## Summary
- Add `extractCliError()` for Claude, Codex, Gemini, Opencode error
formats
- Check CLI errors FIRST before JSON extraction in `parseResultOutput()`
- Surface real error messages instead of useless schema validation
errors
## Before/After
**Before:**
```
Agent worker output failed JSON schema validation: must have required property 'summary'
```
**After:**
```
CLI error (claude): Permission denied for tool Write
```
## Provider Error Formats
| Provider | Error Event Format |
|----------|-------------------|
| Claude | `{type:"result", is_error:true, errors:[...]}` |
| Codex | `{type:"turn.failed", error:{message:...}}` |
| Gemini | `{type:"result", success:false, error:...}` |
| Opencode | `{type:"session.error", error:{...}}` |
## Test Coverage
14 tests covering all providers, error variants, and edge cases.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>
## Summary - add live guidance injection via attach stdin - persist guidance delivery metadata on guidance messages - add tests for attach stdin + guidance delivery ## Testing - npm test -- tests/unit/attach-stdin.test.js tests/unit/guidance-delivery.test.js - npm run lint - npm run typecheck
## Summary\n- add CLI entrypoints for codex/claude/gemini/opencode that launch the TUI\n- keep invalid-command handling aware of new entrypoints\n- add unit coverage for entrypoint provider overrides\n\n## Testing\n- npm test -- tests/unit/cli-invalid-command.test.js\n- npm test -- tests/unit/cli-tui-entrypoints.test.js\n\nCloses #227
## Summary\n- remove legacy dashboard doc and scrub TUI v2 docs of old blessed/watch references\n- update CLI/docs to describe Ink TUI entrypoints and Monitor view\n- refresh CHANGELOG/AGENTS/CLAUDE/CONTRIBUTING with Ink TUI terminology\n\n## Testing\n- N/A (doc/cleanup)\n\nCloses #229
## Summary\n- add testable helpers for app input handling and monitor list formatting\n- expand command parser coverage and add Esc-back + monitor render unit tests\n- note guidance mailbox status and manual checklist items for Issue 8.4\n\n## Testing\n- npm test -- tests/unit/tui-command-parser.test.js tests/unit/tui-router-esc-back.test.js tests/unit/tui-monitor-list-render.test.js\n\nCloses #231
## Summary Store the issue number from `inputData` in cluster state and expose it in `listClusters()` output. This enables heroshot and other external tools to reliably identify which issue a cluster is working on **without parsing logs**. ## Changes - Store `cluster.issue` when fetching issue from provider - Persist to `clusters.json` alongside `autoPr`, `modelOverride` - Include in `listClusters()` response - Load on cluster resume ## Before/After **Before (fragile):** ```typescript // heroshot parses logs to find issue number const out = runZeroshot(['logs', clusterId, '-n', '200']); const m = out.match(/# GitHub Issue #(\d+)/); ``` **After (reliable):** ```typescript // Direct lookup from cluster state const clusters = JSON.parse(runZeroshot(['list', '--json'])); const issue = clusters.find(c => c.id === clusterId)?.issue; ``` ## Test plan - [x] All 1109 tests pass - [x] TypeScript passes - [x] ESLint passes (warnings only, no new ones) Fixes #233 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
## Summary
Two changes:
### 1. Repo-local settings for GitHub PR and worktree config
Add `.zeroshot/settings.json` for per-repository configuration:
```json
{
"github": {
"prBase": "dev",
"useMergeQueue": true,
"closeIssue": "auto"
},
"worktree": {
"baseRef": "origin/dev"
}
}
```
**Features:**
- `github.prBase` - Target branch for PRs (default: repo default)
- `github.useMergeQueue` - Use GitHub merge queue instead of direct
merge
- `github.closeIssue` - When to close issue: `auto`/`always`/`never`
- `worktree.baseRef` - Base ref for worktree branches (default: HEAD)
**Environment variables** override repo settings for one-off runs:
- `ZEROSHOT_GH_PR_BASE`
- `ZEROSHOT_GH_USE_MERGE_QUEUE`
- `ZEROSHOT_GH_CLOSE_ISSUE`
### 2. Fix: fail-safe restart when task not found
When `zeroshot status` returns "ID not found", immediately fail with
restart error instead of retrying 30 times.
**POSTMORTEM:** Agent worker polling failed 30 times when task completed
and was cleaned up before worker could detect it. Wasted 30+ seconds.
**Fix:** Detect "ID not found" immediately → return error → trigger
restart
## Test plan
- [x] All 1114 tests pass
- [x] TypeScript passes
- [x] ESLint passes (warnings only, no new ones)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
## Summary
This PR adds support for GitHub PR configuration via CLI args and repo
settings:
### CLI Arguments (New)
- `--pr-base <branch>` - Target branch for PRs (default: repo default
branch)
- `--merge-queue` - Use GitHub merge queue instead of direct merge
- `--close-issue <mode>` - When to close issue after merge:
auto|always|never
### Repo Settings (.zeroshot/settings.json)
```json
{
"github": {
"prBase": "dev",
"useMergeQueue": true,
"closeIssue": "auto"
}
}
```
### Priority Order
CLI args > repo settings > defaults
### Other Changes
- Bug fix: "ID not found" now fails immediately instead of retrying 30x
- Persists prOptions in cluster state for resume capability
- Removed environment variables (ZEROSHOT_GH_PR_BASE, etc.) in favor of
CLI args
## Breaking Change
Removed env vars ZEROSHOT_GH_PR_BASE, ZEROSHOT_GH_USE_MERGE_QUEUE,
ZEROSHOT_GH_CLOSE_ISSUE - use CLI args instead.
## Test Plan
- [x] Unit tests pass (1114 passing)
- [x] Pre-commit hooks pass
- [ ] Manual test: `zeroshot run 123 --ship --pr-base dev --merge-queue`
---------
Co-authored-by: Claude <noreply@anthropic.com>
Updates the TUI v2 implementation plan and PRD.
## Summary - add semantic-release config under `package.json#release` - package config is discovered before `.releaserc.json`, so release publishes with npm/GitHub only even if the divergent main/dev merge keeps resolving `.releaserc.json` to the stale branch-writing version ## Why The merge queue repeatedly leaves `main:.releaserc.json` with `@semantic-release/changelog` and `@semantic-release/git`; semantic-release then computes `6.5.0` but fails when `@semantic-release/git` tries to push generated commits to protected `main`. This moves the effective release contract to the first config source semantic-release reads. ## Verification - package release plugin list: `commit-analyzer, release-notes-generator, npm, github` - simulated `git merge-tree origin/main HEAD` preserves `package.json#release` with no changelog/git plugins even though `.releaserc.json` resolves stale Co-authored-by: Eivind <eivindcovibes.ai@Eivinds-MacBook-Pro.local>
## Summary - add a release preflight that validates the effective semantic-release config and release-worthy promotion signal - run the preflight on main promotion PRs/merge queue and in the release workflow - assert after release that npm latest and the git tag both point at the released HEAD ## Verification - node -c scripts/release-preflight.js && node -c scripts/assert-release-published.js - node tests/run-tests.js tests/release-preflight.test.js - npx eslint scripts/release-preflight.js scripts/assert-release-published.js tests/release-preflight.test.js - npx prettier --check .github/workflows/ci.yml .github/workflows/release.yml package.json scripts/release-preflight.js scripts/assert-release-published.js tests/release-preflight.test.js - npm run release:preflight Co-authored-by: Eivind <eivindcovibes.ai@Eivinds-MacBook-Pro.local>
## Summary - merge current main back into dev to repair the divergent squash ancestry - preserve the protected-branch-safe release config; do not reintroduce @semantic-release/git or changelog into the effective release path - keep the new release preflight job from #631 ## Verification - node -c scripts/release-preflight.js && node -c scripts/assert-release-published.js - node tests/run-tests.js tests/release-preflight.test.js - npx prettier --check .github/workflows/ci.yml .releaserc.json package.json scripts/release-preflight.js scripts/assert-release-published.js tests/release-preflight.test.js - commit hook: typecheck passed - push hook: lint warnings only, typecheck passed --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Eivind Meyer <eivind.meyer@ksat.no> Co-authored-by: Michael Eichelbeck <141341133+mkceichelbeck@users.noreply.github.com> Co-authored-by: tomdps <tom.dupuis24@gmail.com> Co-authored-by: tomdps <60640908+tomdps@users.noreply.github.com> Co-authored-by: Michael Eichelbeck <michael.eichelbeck.ext@wtsde.onmicrosoft.de> Co-authored-by: Ubuntu <ubuntu@ip-172-31-38-53.eu-north-1.compute.internal> Co-authored-by: Eivind <eivind@covibes.ai> Co-authored-by: CI Test <ci-test@covibes.ai> Co-authored-by: Codex <codex@example.com> Co-authored-by: Atharv Singh <132380045+atharvwasthere@users.noreply.github.com> Co-authored-by: Sense_wang <167664334+haosenwang1018@users.noreply.github.com> Co-authored-by: haosenwang1018 <haosenwang1018@users.noreply.github.com> Co-authored-by: Eivind <eivindcovibes.ai@Eivinds-MacBook-Pro.local> Co-authored-by: Zeroshot Agent <agent@covibes.ai>
## Summary - move the release-preflight CI job to the end of the workflow to avoid the old dev/main merge-base conflict hunk - preserve the same release preflight behavior ## Verification - npx prettier --check .github/workflows/ci.yml - commit hook: typecheck passed - local merge test: origin/main merges codex/relocate-release-preflight without conflicts - push hook: lint warnings only, typecheck passed Co-authored-by: Eivind <eivindcovibes.ai@Eivinds-MacBook-Pro.local>
## Summary - make post-release verification use the git tag on HEAD as the expected version - poll npm latest until the registry dist-tag catches up instead of failing on propagation lag - add focused unit coverage for release-tag selection ## Verification - node -c scripts/assert-release-published.js - node tests/run-tests.js tests/assert-release-published.test.js - npx eslint scripts/assert-release-published.js tests/assert-release-published.test.js - npx prettier --check scripts/assert-release-published.js tests/assert-release-published.test.js - commit hook: typecheck passed - push hook: lint warnings only, typecheck passed Co-authored-by: Eivind <eivindcovibes.ai@Eivinds-MacBook-Pro.local>
## What Reconciles the diverged `main` and `dev` histories by merging `origin/main` into `dev`. Heals the divergence root cause behind #640 and unblocks releasing the `resume --detach` zombie fix (#639, #637). ## Why `main` and `dev` last shared history on 2026-07-09 and could not fast-forward: - `main` carried 6 release/promotion commits (incl. `#591`, `#617`, `#632`) plus the `@semantic-release/changelog` + `@semantic-release/git` plugins in `.releaserc.json` that never flowed back to `dev`. - `dev` carried 59 commits including the `resume --detach` fix (#639). A plain merge hit 4 conflicts. This PR resolves them **without losing anything from either side**. ## Conflict resolution (both sides preserved) | File | Resolution | Rationale | |---|---|---| | `src/orchestrator.js`, `lib/detached-startup.js` | dev | dev's shared `process-liveness` predicate supersedes main's inline pre-fix duplicates. Taking main would **revert #639**. | | `scripts/assert-release-published.js` | dev | dev's `#635` npm-propagation-wait version supersedes main's older `#632` snapshot. | | `tests/e2e/helpers/e2e-harness.js` | dev | dev's `buildEnv` export. | | `.releaserc.json` | main (auto-merge) | main's semantic-release plugins are genuinely main-unique; kept. | **Net delta vs `dev` = 8 lines in `.releaserc.json`, zero deletions vs `dev`** (fix fully intact). All of main's real feature content (`run-plan.js`, `setup-plan.js`, `release-preflight.js`, etc.) was already present on `dev` via prior promotions. ## Verification - `npm install` + build clean. - 34 unit tests green: fix suites (`process-liveness` 3, `detached-startup` 27) **and** main's release tooling (`release-preflight`, `assert-release-published`). - 2 real-daemon e2e cases green: zombie recovery without manual `stop`, and single-daemon win on concurrent `resume --detach`. ## Merge instructions **Merge as a merge commit, NOT squash.** A squash flattens the two parents and leaves `main` un-ancestored, so the branches would immediately re-diverge. The merge commit is what actually reconciles them. Follow-up: adopt the trunk + Changesets pipeline in #640 so this drift cannot recur. --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Eivind Meyer <eivind.meyer@ksat.no> Co-authored-by: Michael Eichelbeck <141341133+mkceichelbeck@users.noreply.github.com> Co-authored-by: tomdps <tom.dupuis24@gmail.com> Co-authored-by: tomdps <60640908+tomdps@users.noreply.github.com> Co-authored-by: Michael Eichelbeck <michael.eichelbeck.ext@wtsde.onmicrosoft.de> Co-authored-by: Ubuntu <ubuntu@ip-172-31-38-53.eu-north-1.compute.internal> Co-authored-by: Eivind <eivind@covibes.ai> Co-authored-by: CI Test <ci-test@covibes.ai> Co-authored-by: Codex <codex@example.com> Co-authored-by: Atharv Singh <132380045+atharvwasthere@users.noreply.github.com> Co-authored-by: Sense_wang <167664334+haosenwang1018@users.noreply.github.com> Co-authored-by: haosenwang1018 <haosenwang1018@users.noreply.github.com> Co-authored-by: Eivind <eivindcovibes.ai@Eivinds-MacBook-Pro.local> Co-authored-by: Zeroshot Agent <agent@covibes.ai>
…r contracts (#703) Implements #694. ## What changed - Adds separate bounded `IssueProvider` and `SourceCodeProvider` contracts, registries, identities, capabilities, and evidence types. - Enforces inspect-before-repeat and merge-receipt binding to the requested base/head. - Adds deterministic contract, bounds, architecture, and compile-fail coverage. - Isolates the existing Node unit-test environment so the full repository gate remains reliable. - Documents the new product-private provider boundaries in `AGENTS.md`. ## Validation - `cargo build -p zeroshot-rust --all-targets` - `cargo test -p zeroshot-rust --test provider_contracts` - `cargo test -p zeroshot-rust --test provider_bounds` - `cargo test -p zeroshot-rust --test backend_boundary` - `cargo test -p zeroshot-rust --test architecture` - `cargo test -p zeroshot-rust --doc` - `cargo fmt --all -- --check` - `cargo clippy --workspace --all-targets -- -D warnings` - `cargo test --workspace` - `npm run protocol:check` - `npm run lint` - `npm run test:unit` - `opcore check --changed` Both Zeroshot validation agents approved the final commit.
## Summary - plan resume recovery before starting agents or mutating the ledger - selectively resume missing/interrupted validators and preserve completed validation evidence - recover durable issue context from complete history, with structured no-mutation diagnostics when reconstruction is unsafe - make foreground and detached resume behavior equivalent ## Related Issues Fixes #712 Fixes #713 ## Changes Made - add an internal preflight resume plan with explicit target precedence and registered-vs-eligible handler diagnostics - cross-check lifecycle, persisted execution, iteration, and task ID state before considering work interrupted - clear transient execution state only after a valid plan while preserving worktree and iteration history - prevent snapshot/ledger mutation for impossible recovery and persist registry-only `resume_reconstruction` failure information - add unit and daemon E2E coverage for partial validation, stale context, atomic failure, and foreground/detached parity ## Testing - focused resume tests: 15 passing - state snapshot tests: 7 passing - `npm run lint` (0 errors) - `npm run typecheck` - `npm run test:unit` (1646 passing, 18 pending) - `npm run test:e2e` (22 passing) - `npm run test:slow` (143 passing, 18 pending) - `npm run protocol:check` - `npm run rust:check` - `opcore check --changed` - independent direct-file review: `APPROVED` ## Checklist - [x] Tests pass - [x] Documentation updated (not needed; no public interface change) - [x] Follows commit guidelines
|
Too many files changed for review. ( Bypass the limit by tagging |
# Conflicts: # AGENTS.md # lib/detached-startup.js # lib/start-cluster.js # scripts/assert-release-published.js # src/orchestrator.js # tests/e2e/helpers/e2e-harness.js
…-6-7 chore(release): preserve main ancestry for 6.7 promotion
|
🎉 This PR is included in version 6.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This was referenced Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Promote the current, dependency-reconciled
devsnapshot tomainfor Zeroshot 6.7.0.This is the complete release candidate, including the Open Engine Cluster Protocol / strict-native work currently landed on
devand the atomic resume recovery repair from #714 (closing #712 and #713). It is intentionally not a cherry-pick release.Release candidate
devSHA:5dc1639476ea320cae8e8a9ccb45e50104ba0379@the-open-engine/zeroshot@6.6.0main: 285 commits, 357 filesrelease:minor rule, targeting 6.7.0Verification
Fresh detached checkout of
origin/dev:npm run lint(0 errors)npm run typechecknpm run test:unit(1840 passing, 36 pending)npm run test:e2e(22 passing)npm run test:slow(143 passing, 18 pending)npm run protocol:checknpm run rust:checkopcore check --changednpm run release:preflightconfiguration validation passesThe PR and main merge queue must additionally pass
check,install-matrix, and release preflight on the syntheticmaincandidate before merge.