Skip to content

Refactor: Move shared hooks from ui/hooks to shared/hooks#729

Merged
Wirasm merged 1 commit intomainfrom
refactor/move-hooks-to-shared
Sep 22, 2025
Merged

Refactor: Move shared hooks from ui/hooks to shared/hooks#729
Wirasm merged 1 commit intomainfrom
refactor/move-hooks-to-shared

Conversation

@Wirasm
Copy link
Copy Markdown
Collaborator

@Wirasm Wirasm commented Sep 22, 2025

Summary

Reorganize hook structure to follow vertical slice architecture by moving truly shared hooks from features/ui/hooks to features/shared/hooks.

Changes Made

  • Moved useSmartPolling, useThemeAware, and useToast hooks to features/shared/hooks
  • Updated 38+ import statements across the codebase
  • Updated test file mocks to reference new locations
  • Created barrel export file in new location
  • Removed old ui/hooks directory

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring

Affected Services

  • Frontend (React UI)
  • Server (FastAPI backend)
  • MCP Server (Model Context Protocol)
  • Agents (PydanticAI service)
  • Database (migrations/schema)
  • Docker/Infrastructure
  • Documentation site

Testing

  • All existing tests pass
  • Added new tests for new functionality
  • Manually tested affected user flows
  • Docker builds succeed for all services

Test Evidence

# Hook tests passing
npm run test -- useSmartPolling.test.ts --run
# ✓ src/features/shared/hooks/tests/useSmartPolling.test.ts (10 tests) 15ms

# Query hook tests passing  
npm run test -- useProjectQueries.test.ts --run
# Test Files  1 passed (1)
# Tests  7 passed (7)

# No old imports remain
grep -r "features/ui/hooks" src --include="*.ts" --include="*.tsx"
# ✓ No old imports found

Checklist

  • My code follows the service architecture patterns
  • If using an AI coding assistant, I used the CLAUDE.md rules
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass locally
  • My changes generate no new warnings
  • I have updated relevant documentation
  • I have verified no regressions in existing features

Breaking Changes

None - This is a pure refactoring with no API or functionality changes.

Additional Notes

This change aligns shared utilities with the architectural pattern where truly shared code resides in the shared directory, following the vertical slice architecture principles outlined in the project documentation.

Import path changes:

  • @/features/ui/hooks@/features/shared/hooks
  • Relative paths updated accordingly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor

    • Consolidated toast and smart-polling hooks under a shared module and updated imports across the app (settings, knowledge, projects, tasks, onboarding, layout, bug reporting, migrations, version, and pages). No user-facing behavior changes.
  • Tests

    • Updated test mocks to reference the new shared hook locations. No changes to test behavior or coverage.
  • Chores

    • Standardized internal import paths and aliases for consistency and easier maintenance. No user-visible impact.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Sep 22, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR updates import paths to consolidate hooks (useToast, useSmartPolling) under features/shared, switching many relative imports to shared or alias-based paths. Tests update mock paths accordingly. Minor internal path tweak in useToast.ts for createOptimisticId. No runtime logic, signatures, or behavior changes.

Changes

Cohort / File(s) Change summary
Components using useToast
archon-ui-main/src/components/bug-report/BugReportModal.tsx, .../components/layout/MainLayout.tsx, .../components/onboarding/ProviderStep.tsx
Updated useToast import path from features/ui to features/shared.
Settings components (useToast)
.../components/settings/APIKeysSection.tsx, .../CodeExtractionSettings.tsx, .../FeaturesSection.tsx, .../IDEGlobalRules.tsx, .../OllamaConfigurationPanel.tsx, .../OllamaInstanceHealthIndicator.tsx, .../OllamaModelDiscoveryModal.tsx, .../OllamaModelSelectionModal.tsx, .../RAGSettings.tsx
Switched useToast imports to features/shared.
Knowledge feature (alias imports)
.../features/knowledge/components/AddKnowledgeDialog.tsx, .../KnowledgeTable.tsx, .../hooks/useKnowledgeQueries.ts, .../views/KnowledgeView.tsx
Moved useToast and useSmartPolling imports to alias path "@/features/shared/...".
MCP feature
.../features/mcp/components/McpConfigSection.tsx, .../features/mcp/hooks/useMcpQueries.ts
Redirected imports to "@/features/shared/hooks" (useToast/useSmartPolling).
Progress feature
.../features/progress/hooks/useProgressQueries.ts
Changed useSmartPolling import to ../../shared/hooks.
Projects feature (components/hooks)
.../features/projects/components/ProjectCardActions.tsx, .../tasks/components/TaskCardActions.tsx, .../tasks/hooks/useTaskEditor.ts, .../tasks/hooks/useTaskQueries.ts, .../hooks/useProjectQueries.ts
Updated useToast/useSmartPolling imports to features/shared (some via alias "@/").
Settings migrations/version hooks
.../features/settings/migrations/components/PendingMigrationsModal.tsx, .../features/settings/migrations/hooks/useMigrationQueries.ts, .../features/settings/version/hooks/useVersionQueries.ts
Pointed useToast/useSmartPolling to features/shared (alias-based).
Tests updating mocks
.../features/knowledge/hooks/tests/useKnowledgeQueries.test.ts, .../features/projects/hooks/tests/useProjectQueries.test.ts, .../features/projects/tasks/hooks/tests/useTaskQueries.test.ts
Updated mock module paths from ui/hooks to shared/hooks (using "@/..." aliases where applicable).
Shared hooks module
.../features/shared/hooks/index.ts, .../features/shared/hooks/useToast.ts
No API changes; adjusted internal import path for createOptimisticId (../optimistic).
UI Toast provider
.../features/ui/components/ToastProvider.tsx
Changed useToast import to ../../shared/hooks/useToast.
Page
archon-ui-main/src/pages/SettingsPage.tsx
Switched useToast import to features/shared.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • coleam00

Poem

I hopped through files with gentle cheer,
Moving toasts where all can hear.
Shared burrows for hooks unite,
Aliased paths now clean and light.
No logic stirred, no storms to cast—
Just tidier trails for code to pass. 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/move-hooks-to-shared

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ff3f7f and 73042cb.

📒 Files selected for processing (34)
  • archon-ui-main/src/components/bug-report/BugReportModal.tsx (1 hunks)
  • archon-ui-main/src/components/layout/MainLayout.tsx (1 hunks)
  • archon-ui-main/src/components/onboarding/ProviderStep.tsx (1 hunks)
  • archon-ui-main/src/components/settings/APIKeysSection.tsx (1 hunks)
  • archon-ui-main/src/components/settings/CodeExtractionSettings.tsx (1 hunks)
  • archon-ui-main/src/components/settings/FeaturesSection.tsx (1 hunks)
  • archon-ui-main/src/components/settings/IDEGlobalRules.tsx (1 hunks)
  • archon-ui-main/src/components/settings/OllamaConfigurationPanel.tsx (1 hunks)
  • archon-ui-main/src/components/settings/OllamaInstanceHealthIndicator.tsx (1 hunks)
  • archon-ui-main/src/components/settings/OllamaModelDiscoveryModal.tsx (1 hunks)
  • archon-ui-main/src/components/settings/OllamaModelSelectionModal.tsx (1 hunks)
  • archon-ui-main/src/components/settings/RAGSettings.tsx (1 hunks)
  • archon-ui-main/src/features/knowledge/components/AddKnowledgeDialog.tsx (1 hunks)
  • archon-ui-main/src/features/knowledge/components/KnowledgeTable.tsx (1 hunks)
  • archon-ui-main/src/features/knowledge/hooks/tests/useKnowledgeQueries.test.ts (1 hunks)
  • archon-ui-main/src/features/knowledge/hooks/useKnowledgeQueries.ts (1 hunks)
  • archon-ui-main/src/features/knowledge/views/KnowledgeView.tsx (1 hunks)
  • archon-ui-main/src/features/mcp/components/McpConfigSection.tsx (1 hunks)
  • archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts (1 hunks)
  • archon-ui-main/src/features/progress/hooks/useProgressQueries.ts (1 hunks)
  • archon-ui-main/src/features/projects/components/ProjectCardActions.tsx (1 hunks)
  • archon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.ts (1 hunks)
  • archon-ui-main/src/features/projects/hooks/useProjectQueries.ts (1 hunks)
  • archon-ui-main/src/features/projects/tasks/components/TaskCardActions.tsx (1 hunks)
  • archon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.ts (1 hunks)
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskEditor.ts (1 hunks)
  • archon-ui-main/src/features/projects/tasks/hooks/useTaskQueries.ts (1 hunks)
  • archon-ui-main/src/features/settings/migrations/components/PendingMigrationsModal.tsx (1 hunks)
  • archon-ui-main/src/features/settings/migrations/hooks/useMigrationQueries.ts (1 hunks)
  • archon-ui-main/src/features/settings/version/hooks/useVersionQueries.ts (1 hunks)
  • archon-ui-main/src/features/shared/hooks/index.ts (1 hunks)
  • archon-ui-main/src/features/shared/hooks/useToast.ts (1 hunks)
  • archon-ui-main/src/features/ui/components/ToastProvider.tsx (1 hunks)
  • archon-ui-main/src/pages/SettingsPage.tsx (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Reorganize hook structure to follow vertical slice architecture:
- Move useSmartPolling, useThemeAware, useToast to features/shared/hooks
- Update 38+ import statements across codebase
- Update test file mocks to reference new locations
- Remove old ui/hooks directory

This change aligns shared utilities with the architectural pattern
where truly shared code resides in the shared directory.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Wirasm Wirasm force-pushed the refactor/move-hooks-to-shared branch from 8f908b7 to 73042cb Compare September 22, 2025 09:52
@Wirasm Wirasm merged commit d3a5c33 into main Sep 22, 2025
7 of 8 checks passed
@Wirasm Wirasm deleted the refactor/move-hooks-to-shared branch September 22, 2025 09:55
leonj1 pushed a commit to leonj1/Archon that referenced this pull request Oct 13, 2025
Reorganize hook structure to follow vertical slice architecture:
- Move useSmartPolling, useThemeAware, useToast to features/shared/hooks
- Update 38+ import statements across codebase
- Update test file mocks to reference new locations
- Remove old ui/hooks directory

This change aligns shared utilities with the architectural pattern
where truly shared code resides in the shared directory.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
coleam00 added a commit that referenced this pull request Apr 7, 2026
…based retries (#729)

* feat: safe session continuity across workflow steps with forkSession-based retries (#691)

Retries previously discarded all prior conversation context by passing
resumeSessionId=undefined, because naive session resume would append to
the original session file and corrupt it on a crash. This adds
forkSession:true support so the SDK copies the prior session history into
a new file before appending — leaving the source untouched — making it
safe to always pass the prior session ID on retry.

Changes:
- Add forkSession?: boolean to WorkflowAssistantOptions (deps.ts) and AssistantRequestOptions (types/index.ts)
- Pass forkSession to SDK Options in ClaudeClient with enhanced resuming_session log
- Sequential executor: set shouldForkSession=true when resuming; inject into stepOptions; fix retry to always pass resumeSessionId
- DAG executor: set shouldForkSession=true when resuming in executeNodeInternal; fix retry to always pass resumeSessionId; update isFresh comment
- Fix resolvedOptions to explicitly set persistSession:false for Claude workflows (was silently defaulting to SDK's true)
- Add context:'shared' union to DagNodeBase.context type; update clearContext docstring

Fixes #691

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: remove persistSession:false from workflow resolvedOptions to preserve cross-step session continuity

SDK docs confirm that persistSession:false prevents session files from being written to disk,
making resume impossible for subsequent steps. Removing this option restores the SDK default
(true), so step 1's session ID can be used by step 2 to resume. Also clarify context:'shared'
docstring to note it has no effect on parallel layer nodes, and add unit tests asserting that
retries pass forkSession:true when a prior session exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add persistSession: false to Claude resolvedOptions

Implements the missing persistSession fix claimed in the PR description.
Without this, the SDK defaults to true and writes session transcripts to disk.

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

* fix(loader): preserve context: 'shared' in DAG node YAML parsing

The PR added 'shared' to DagNodeBase.context type but the loader only
preserved 'fresh', silently dropping 'shared' during YAML parsing.
This meant context: shared in workflow YAML was ignored at load time.

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

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
coleam00 pushed a commit that referenced this pull request Apr 7, 2026
…ole format (#805)

* refactor(workflows)!: remove sequential execution mode, DAG becomes sole format

Remove the steps-based (sequential) workflow execution mode entirely.
All workflows now use the nodes-based (DAG) format exclusively.

- Convert 8 sequential default workflows to DAG format
- Delete archon-fix-github-issue sequential (DAG version absorbs triggers)
- Remove SingleStep, ParallelBlock, StepWorkflow types and guards
- Gut executor.ts from ~2200 to ~730 lines (remove sequential loop)
- Remove step_started/completed/failed and parallel_agent_* events
- Remove logStepStart/Complete and logParallelBlockStart/Complete
- Delete SequentialEditor, StepProgress, ParallelBlockView components
- Remove sequential mode from workflow builder and execution views
- Delete executor.test.ts (4395 lines), update ~45 test fixtures
- Update CLAUDE.md and docs to reflect DAG-only format

BREAKING CHANGE: Workflows using `steps:` format are no longer supported.
Convert to `nodes:` (DAG) format. The loader provides a clear error message
directing users to the migration guide.

* fix: address review findings — guard errors, remove dead code, add tests

- Guard logNodeSkip/logWorkflowError against filesystem errors in dag-executor
- Move mkdir(artifactsDir) inside try-catch with user-friendly error
- Remove startFromStep dead parameter from executeWorkflow signature
- Remove isDagWorkflow() tautology and all callers (20+ sites)
- Remove dead BuilderMode/mode state from frontend components
- Remove vestigial isLoop, selectedStep, stepIndex, step_index fields
- Remove "DAG" prefix from user-facing resume/error messages
- Fix 5 stale docs (README, getting-started, authoring-commands, web adapter)
- Update event-emitter tests to use node events instead of removed step events
- Add executor-shared.test.ts (12 tests) for substituteWorkflowVariables
- Add executor.test.ts (11 tests) for concurrent-run, model resolution, resume

* fix(workflows): add migration guide, port preamble tests, improve error message

- Add docs/sequential-dag-migration-guide.md with 3 conversion patterns
  (single step, chain with clearContext, parallel block) and a Claude Code
  migration command for automated conversion
- Update loader error message to point to migration guide and include
  ready-to-run claude command
- Port 8 preamble tests from deleted executor.test.ts to new
  executor-preamble.test.ts: staleness detection (3), concurrent-run
  guard (3), DAG resume (2)

Addresses review feedback from #805.

* fix(workflows): update loader test to match new error message wording

* fix: address review findings — fail stuck runs, remove dead code, fix docs

- Mark workflow run as failed when artifacts mkdir fails (prevents
  15-min concurrent-run guard block)
- Remove vestigial totalSteps from WorkflowStartedEvent and executor
- Delete dead WorkflowToolbar.tsx (369 lines, no importers)
- Remove stepIndex prop from StepLogs (always 0, label now "Node logs")
- Restore cn() in StatusBar for consistent conditional classes
- Promote resume-check log to error, add errorType to failure logs
- Remove ghost $PLAN/$IMPLEMENTATION_SUMMARY from docs (never implemented)
- Update workflows.md rules to DAG-only format
- Fix migration guide trigger_rule example
- Clean up blank-line residues and stale comments

* fix: resolve rebase conflicts with #729 (forkSession) and #730 (dashboard)

- Remove sequential forkSession/persistSession code from #729 (dead after
  sequential removal)
- Fix loader type narrowing for DagNode context field
- Update dashboard components from #730 to use dagNodes instead of steps
- Remove WorkflowStepEvent/ParallelAgentEvent from dashboard SSE hook
Tyone88 pushed a commit to Tyone88/Archon that referenced this pull request Apr 16, 2026
…based retries (coleam00#729)

* feat: safe session continuity across workflow steps with forkSession-based retries (coleam00#691)

Retries previously discarded all prior conversation context by passing
resumeSessionId=undefined, because naive session resume would append to
the original session file and corrupt it on a crash. This adds
forkSession:true support so the SDK copies the prior session history into
a new file before appending — leaving the source untouched — making it
safe to always pass the prior session ID on retry.

Changes:
- Add forkSession?: boolean to WorkflowAssistantOptions (deps.ts) and AssistantRequestOptions (types/index.ts)
- Pass forkSession to SDK Options in ClaudeClient with enhanced resuming_session log
- Sequential executor: set shouldForkSession=true when resuming; inject into stepOptions; fix retry to always pass resumeSessionId
- DAG executor: set shouldForkSession=true when resuming in executeNodeInternal; fix retry to always pass resumeSessionId; update isFresh comment
- Fix resolvedOptions to explicitly set persistSession:false for Claude workflows (was silently defaulting to SDK's true)
- Add context:'shared' union to DagNodeBase.context type; update clearContext docstring

Fixes coleam00#691

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: remove persistSession:false from workflow resolvedOptions to preserve cross-step session continuity

SDK docs confirm that persistSession:false prevents session files from being written to disk,
making resume impossible for subsequent steps. Removing this option restores the SDK default
(true), so step 1's session ID can be used by step 2 to resume. Also clarify context:'shared'
docstring to note it has no effect on parallel layer nodes, and add unit tests asserting that
retries pass forkSession:true when a prior session exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add persistSession: false to Claude resolvedOptions

Implements the missing persistSession fix claimed in the PR description.
Without this, the SDK defaults to true and writes session transcripts to disk.

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

* fix(loader): preserve context: 'shared' in DAG node YAML parsing

The PR added 'shared' to DagNodeBase.context type but the loader only
preserved 'fresh', silently dropping 'shared' during YAML parsing.
This meant context: shared in workflow YAML was ignored at load time.

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

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Tyone88 pushed a commit to Tyone88/Archon that referenced this pull request Apr 16, 2026
…ole format (coleam00#805)

* refactor(workflows)!: remove sequential execution mode, DAG becomes sole format

Remove the steps-based (sequential) workflow execution mode entirely.
All workflows now use the nodes-based (DAG) format exclusively.

- Convert 8 sequential default workflows to DAG format
- Delete archon-fix-github-issue sequential (DAG version absorbs triggers)
- Remove SingleStep, ParallelBlock, StepWorkflow types and guards
- Gut executor.ts from ~2200 to ~730 lines (remove sequential loop)
- Remove step_started/completed/failed and parallel_agent_* events
- Remove logStepStart/Complete and logParallelBlockStart/Complete
- Delete SequentialEditor, StepProgress, ParallelBlockView components
- Remove sequential mode from workflow builder and execution views
- Delete executor.test.ts (4395 lines), update ~45 test fixtures
- Update CLAUDE.md and docs to reflect DAG-only format

BREAKING CHANGE: Workflows using `steps:` format are no longer supported.
Convert to `nodes:` (DAG) format. The loader provides a clear error message
directing users to the migration guide.

* fix: address review findings — guard errors, remove dead code, add tests

- Guard logNodeSkip/logWorkflowError against filesystem errors in dag-executor
- Move mkdir(artifactsDir) inside try-catch with user-friendly error
- Remove startFromStep dead parameter from executeWorkflow signature
- Remove isDagWorkflow() tautology and all callers (20+ sites)
- Remove dead BuilderMode/mode state from frontend components
- Remove vestigial isLoop, selectedStep, stepIndex, step_index fields
- Remove "DAG" prefix from user-facing resume/error messages
- Fix 5 stale docs (README, getting-started, authoring-commands, web adapter)
- Update event-emitter tests to use node events instead of removed step events
- Add executor-shared.test.ts (12 tests) for substituteWorkflowVariables
- Add executor.test.ts (11 tests) for concurrent-run, model resolution, resume

* fix(workflows): add migration guide, port preamble tests, improve error message

- Add docs/sequential-dag-migration-guide.md with 3 conversion patterns
  (single step, chain with clearContext, parallel block) and a Claude Code
  migration command for automated conversion
- Update loader error message to point to migration guide and include
  ready-to-run claude command
- Port 8 preamble tests from deleted executor.test.ts to new
  executor-preamble.test.ts: staleness detection (3), concurrent-run
  guard (3), DAG resume (2)

Addresses review feedback from coleam00#805.

* fix(workflows): update loader test to match new error message wording

* fix: address review findings — fail stuck runs, remove dead code, fix docs

- Mark workflow run as failed when artifacts mkdir fails (prevents
  15-min concurrent-run guard block)
- Remove vestigial totalSteps from WorkflowStartedEvent and executor
- Delete dead WorkflowToolbar.tsx (369 lines, no importers)
- Remove stepIndex prop from StepLogs (always 0, label now "Node logs")
- Restore cn() in StatusBar for consistent conditional classes
- Promote resume-check log to error, add errorType to failure logs
- Remove ghost $PLAN/$IMPLEMENTATION_SUMMARY from docs (never implemented)
- Update workflows.md rules to DAG-only format
- Fix migration guide trigger_rule example
- Clean up blank-line residues and stale comments

* fix: resolve rebase conflicts with coleam00#729 (forkSession) and coleam00#730 (dashboard)

- Remove sequential forkSession/persistSession code from coleam00#729 (dead after
  sequential removal)
- Fix loader type narrowing for DagNode context field
- Update dashboard components from coleam00#730 to use dagNodes instead of steps
- Remove WorkflowStepEvent/ParallelAgentEvent from dashboard SSE hook
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…based retries (coleam00#729)

* feat: safe session continuity across workflow steps with forkSession-based retries (coleam00#691)

Retries previously discarded all prior conversation context by passing
resumeSessionId=undefined, because naive session resume would append to
the original session file and corrupt it on a crash. This adds
forkSession:true support so the SDK copies the prior session history into
a new file before appending — leaving the source untouched — making it
safe to always pass the prior session ID on retry.

Changes:
- Add forkSession?: boolean to WorkflowAssistantOptions (deps.ts) and AssistantRequestOptions (types/index.ts)
- Pass forkSession to SDK Options in ClaudeClient with enhanced resuming_session log
- Sequential executor: set shouldForkSession=true when resuming; inject into stepOptions; fix retry to always pass resumeSessionId
- DAG executor: set shouldForkSession=true when resuming in executeNodeInternal; fix retry to always pass resumeSessionId; update isFresh comment
- Fix resolvedOptions to explicitly set persistSession:false for Claude workflows (was silently defaulting to SDK's true)
- Add context:'shared' union to DagNodeBase.context type; update clearContext docstring

Fixes coleam00#691

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: remove persistSession:false from workflow resolvedOptions to preserve cross-step session continuity

SDK docs confirm that persistSession:false prevents session files from being written to disk,
making resume impossible for subsequent steps. Removing this option restores the SDK default
(true), so step 1's session ID can be used by step 2 to resume. Also clarify context:'shared'
docstring to note it has no effect on parallel layer nodes, and add unit tests asserting that
retries pass forkSession:true when a prior session exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add persistSession: false to Claude resolvedOptions

Implements the missing persistSession fix claimed in the PR description.
Without this, the SDK defaults to true and writes session transcripts to disk.

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

* fix(loader): preserve context: 'shared' in DAG node YAML parsing

The PR added 'shared' to DagNodeBase.context type but the loader only
preserved 'fresh', silently dropping 'shared' during YAML parsing.
This meant context: shared in workflow YAML was ignored at load time.

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

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…ole format (coleam00#805)

* refactor(workflows)!: remove sequential execution mode, DAG becomes sole format

Remove the steps-based (sequential) workflow execution mode entirely.
All workflows now use the nodes-based (DAG) format exclusively.

- Convert 8 sequential default workflows to DAG format
- Delete archon-fix-github-issue sequential (DAG version absorbs triggers)
- Remove SingleStep, ParallelBlock, StepWorkflow types and guards
- Gut executor.ts from ~2200 to ~730 lines (remove sequential loop)
- Remove step_started/completed/failed and parallel_agent_* events
- Remove logStepStart/Complete and logParallelBlockStart/Complete
- Delete SequentialEditor, StepProgress, ParallelBlockView components
- Remove sequential mode from workflow builder and execution views
- Delete executor.test.ts (4395 lines), update ~45 test fixtures
- Update CLAUDE.md and docs to reflect DAG-only format

BREAKING CHANGE: Workflows using `steps:` format are no longer supported.
Convert to `nodes:` (DAG) format. The loader provides a clear error message
directing users to the migration guide.

* fix: address review findings — guard errors, remove dead code, add tests

- Guard logNodeSkip/logWorkflowError against filesystem errors in dag-executor
- Move mkdir(artifactsDir) inside try-catch with user-friendly error
- Remove startFromStep dead parameter from executeWorkflow signature
- Remove isDagWorkflow() tautology and all callers (20+ sites)
- Remove dead BuilderMode/mode state from frontend components
- Remove vestigial isLoop, selectedStep, stepIndex, step_index fields
- Remove "DAG" prefix from user-facing resume/error messages
- Fix 5 stale docs (README, getting-started, authoring-commands, web adapter)
- Update event-emitter tests to use node events instead of removed step events
- Add executor-shared.test.ts (12 tests) for substituteWorkflowVariables
- Add executor.test.ts (11 tests) for concurrent-run, model resolution, resume

* fix(workflows): add migration guide, port preamble tests, improve error message

- Add docs/sequential-dag-migration-guide.md with 3 conversion patterns
  (single step, chain with clearContext, parallel block) and a Claude Code
  migration command for automated conversion
- Update loader error message to point to migration guide and include
  ready-to-run claude command
- Port 8 preamble tests from deleted executor.test.ts to new
  executor-preamble.test.ts: staleness detection (3), concurrent-run
  guard (3), DAG resume (2)

Addresses review feedback from coleam00#805.

* fix(workflows): update loader test to match new error message wording

* fix: address review findings — fail stuck runs, remove dead code, fix docs

- Mark workflow run as failed when artifacts mkdir fails (prevents
  15-min concurrent-run guard block)
- Remove vestigial totalSteps from WorkflowStartedEvent and executor
- Delete dead WorkflowToolbar.tsx (369 lines, no importers)
- Remove stepIndex prop from StepLogs (always 0, label now "Node logs")
- Restore cn() in StatusBar for consistent conditional classes
- Promote resume-check log to error, add errorType to failure logs
- Remove ghost $PLAN/$IMPLEMENTATION_SUMMARY from docs (never implemented)
- Update workflows.md rules to DAG-only format
- Fix migration guide trigger_rule example
- Clean up blank-line residues and stale comments

* fix: resolve rebase conflicts with coleam00#729 (forkSession) and coleam00#730 (dashboard)

- Remove sequential forkSession/persistSession code from coleam00#729 (dead after
  sequential removal)
- Fix loader type narrowing for DagNode context field
- Update dashboard components from coleam00#730 to use dagNodes instead of steps
- Remove WorkflowStepEvent/ParallelAgentEvent from dashboard SSE hook
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