---
phase: 10.1-aggressive-workflow-modularization
plan: 04
type: execute
wave: 2
depends_on: ["10.1-01"]
files_modified:
- n8n-workflow.json
- n8n-confirmation.json
autonomous: true
must_haves:
truths:
- "Stop confirmation dialog appears before stopping containers"
- "Update confirmation dialog appears for multi-container updates"
- "Expired confirmations show 'session expired' message"
- "Confirm/cancel buttons work correctly"
artifacts:
- path: "n8n-confirmation.json"
provides: "Confirmation dialog sub-workflow"
contains: "Execute Workflow Trigger"
- path: "n8n-workflow.json"
provides: "Main workflow with confirmation extraction"
key_links:
- from: "n8n-workflow.json"
to: "n8n-confirmation.json"
via: "Execute Workflow node"
pattern: "executeWorkflow.*confirm"
---
Extract confirmation dialog nodes from main workflow into dedicated n8n-confirmation.json sub-workflow.
Purpose: Remove ~15-20 nodes from main workflow by extracting the confirmation dialog domain.
Output: New n8n-confirmation.json sub-workflow, updated main workflow with confirmation nodes extracted.
@/home/luc/.claude/get-shit-done/workflows/execute-plan.md
@/home/luc/.claude/get-shit-done/templates/summary.md
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/10.1-aggressive-workflow-modularization/10.1-CONTEXT.md
@.planning/phases/10.1-aggressive-workflow-modularization/10.1-01-SUMMARY.md
@n8n-workflow.json
@n8n-actions.json
Task 1: Create n8n-confirmation.json sub-workflow with extracted confirmation nodes
n8n-confirmation.json (new)
Create new sub-workflow containing confirmation dialog nodes.
**Input contract (Execute Workflow Trigger):**
- chatId: number (required)
- messageId: number (required, for editing message)
- action: string ('show_stop' | 'show_update' | 'confirm' | 'cancel' | 'check_expired')
- containerId: string (optional)
- containerName: string (optional)
- containerIds: array (optional, for multi-container)
- confirmationToken: string (optional, for verifying non-expired)
- responseMode: string
**Nodes to extract** (confirmation related - excluding batch confirmations which stay in batch-ui):
- Build Stop Confirmation, Build Update Confirmation, Build Update All Confirmation
- Check Confirm Expired, Handle Confirm Expired, Send Expired Confirm
- Edit To Stop Confirmation, Send Stop Confirmation, Send Update Confirmation, Send Update All Confirmation
- Answer Confirm Callback, Answer Cancel Confirm Callback
- Build Confirmed Stop Command, Prepare Confirmed Stop, Prepare Confirmed Stop Input
- Execute Confirmed Stop, Execute Confirmed Stop Action
- Format Confirmed Stop Result, Handle Confirmed Stop Result, Send Confirmed Stop Result
- Route Confirm Action
**NOTE:** Batch confirmations (Build Batch Stop Confirmation, etc.) should stay in n8n-batch-ui.json since they're part of batch flow. This sub-workflow handles single-container confirmations and "update all" confirmations.
**Structure:**
1. Execute Workflow Trigger (entry point)
2. Parse Input (validate action type)
3. Switch on action type
4. For show_stop: Build confirmation keyboard, return for main to send
5. For confirm: Validate not expired, execute action via sub-workflow call
6. For cancel: Return cancellation result
7. For check_expired: Validate confirmation token age
**Output contract:**
```javascript
{
success: true/false,
action: 'show_stop|show_update|confirm|cancel|expired',
// For show:
keyboard: {...},
text: "confirmation text",
confirmationToken: "uuid for expiry tracking",
// For confirm:
executed: true/false,
result: { containerId, containerName, newState },
// For expired:
expired: true/false,
// Error:
error: "error message" || null
}
```
**Important:** For confirmed stop/restart actions, this sub-workflow should call n8n-actions.json to perform the actual container action.
- `cat n8n-confirmation.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(f'Nodes: {len(d.get(\"nodes\",[]))}')"` shows node count (~15-20)
- Sub-workflow has Execute Workflow Trigger node
- Sub-workflow has Execute Workflow node calling n8n-actions.json
n8n-confirmation.json created with confirmation dialog nodes extracted.
Task 2: Update main workflow to call confirmation sub-workflow
n8n-workflow.json
Modify main workflow to replace confirmation nodes with Execute Workflow call.
1. **Remove extracted confirmation nodes** from main workflow
(Keep batch confirmation nodes if they're still in main workflow - they belong in batch-ui)
2. **Add Execute Workflow node** ("Execute Confirmation"):
- Source: database
- WorkflowId: use TODO_DEPLOY_CONFIRMATION_WORKFLOW placeholder
- Mode: once
- waitForSubWorkflow: true
- Input: { chatId, messageId, action, containerId, containerName, confirmationToken, responseMode }
3. **Update routing** in main workflow:
- Route Callback should route confirmation callbacks (confirm:*, cancel:*) to Execute Confirmation
- Stop command should route to Execute Confirmation with action='show_stop'
4. **Add result handler** after Execute Confirmation:
- If result.expired: show expired message
- If result.executed: show result message
- If result has keyboard: send/edit confirmation dialog
- Main workflow has "Execute Confirmation" node
- No single-container confirmation nodes remain in main workflow
- TODO_DEPLOY_CONFIRMATION_WORKFLOW placeholder exists
Main workflow updated with confirmation nodes extracted.
Task 3: Create backup and commit extraction
n8n-workflow.json.backup-confirm
1. Create explicit backup:
`cp n8n-workflow.json n8n-workflow.json.backup-confirm`
2. Verify the extraction:
- Main workflow node count reduced by ~15-20 from previous state
- n8n-confirmation.json exists with extracted nodes
- No orphan references
3. Commit the extraction:
```bash
git add n8n-workflow.json n8n-confirmation.json n8n-workflow.json.backup-confirm
git commit -m "feat(10.1-04): extract confirmation dialogs to sub-workflow
- Created n8n-confirmation.json with stop/update confirmation nodes
- Handles confirmation display, expiry checking, and action execution
- Calls n8n-actions.json for confirmed stop/restart
- Added TODO_DEPLOY_CONFIRMATION_WORKFLOW placeholder"
```
- Backup file exists
- Git commit created
Confirmation extraction committed with backup.
- [ ] n8n-confirmation.json exists with Execute Workflow Trigger
- [ ] Main workflow node count further reduced
- [ ] Main workflow has Execute Confirmation node
- [ ] Backup file created
- [ ] Git commit records the extraction
1. New n8n-confirmation.json sub-workflow created
2. Main workflow reduced by ~15-20 additional nodes
3. Confirmation dialog functionality extracted cleanly
4. Backup created for rollback
5. Changes committed to git