Skip to content

Fix workflow run Open in IDE path#2003

Open
anhle128 wants to merge 1 commit into
coleam00:devfrom
anhle128:fix/workflow-run-open-ide-path
Open

Fix workflow run Open in IDE path#2003
anhle128 wants to merge 1 commit into
coleam00:devfrom
anhle128:fix/workflow-run-open-ide-path

Conversation

@anhle128

@anhle128 anhle128 commented Jun 15, 2026

Copy link
Copy Markdown

Summary

  • Problem: The legacy workflow run Chat tab opened the parent conversation worktree from Open in IDE instead of the workflow run worktree.
  • Why it matters: Users reviewing a run could land in the wrong checkout and edit or inspect the wrong branch/thread.
  • What changed: The workflow execution page now passes run.working_path into ChatInterface, and the chat header prefers that explicit path when building the IDE-open target.
  • What did not change (scope boundary): No server API, workflow execution, database, or IDE-opening behavior outside the existing header path source changed.

UX Journey

Before

User                         WorkflowExecution             ChatInterface/Header
────                         ─────────────────             ────────────────────
opens run Chat tab ───────▶  renders parentPlatformId ───▶ loads parent conversation cwd
clicks Open in IDE ◀───────  header subtitle = parent cwd  opens parent worktree

After

User                         WorkflowExecution                 ChatInterface/Header
────                         ─────────────────                 ────────────────────
opens run Chat tab ───────▶  reads run.working_path ────────▶ [passes cwdOverride]
clicks Open in IDE ◀───────  header subtitle = run cwd        opens workflow run worktree

Architecture Diagram

Before

/api/workflows/runs/:id
  └─ returns run.working_path, parent_platform_id
       └─ WorkflowExecution
            └─ ChatInterface(parentPlatformId)
                 └─ Header uses parent conversation cwd

After

/api/workflows/runs/:id
  └─ returns run.working_path, parent_platform_id
       └─ [~] WorkflowExecution
            === passes workingPath as cwdOverride
                 └─ [~] ChatInterface
                      └─ [+] chat-header resolver prefers override cwd
                           └─ Header uses workflow run cwd

Connection inventory (list every module-to-module edge, mark changes):

From To Status Notes
WorkflowExecution workflow run API response unchanged Existing working_path field is reused.
WorkflowExecution ChatInterface modified Passes cwdOverride={workingPath} for DAG Chat tab.
ChatInterface chat-header new Resolves override-vs-conversation header path.
ChatInterface Header unchanged Still passes title/subtitle into existing header component.

Label Snapshot

  • Risk: risk: low
  • Size: size: XS
  • Scope: web
  • Module: web:workflow-execution

Change Metadata

  • Change type: bug
  • Primary scope: web

Linked Issue

Validation Evidence (required)

Commands and result summary:

bun test packages/web/src/lib/chat-header.test.ts
bun --filter @archon/web type-check
bun x prettier --check packages/web/src/components/chat/ChatInterface.tsx packages/web/src/components/workflows/WorkflowExecution.tsx packages/web/src/lib/chat-header.ts packages/web/src/lib/chat-header.test.ts
bun x eslint packages/web/src/components/chat/ChatInterface.tsx packages/web/src/components/workflows/WorkflowExecution.tsx packages/web/src/lib/chat-header.ts --max-warnings 0
bun run validate
  • Evidence provided (test/log/trace/screenshot): All commands completed successfully locally. bun run validate passed in a clean worktree based on upstream/dev.
  • If any command is intentionally skipped, explain why: Browser/IDE click was not performed because clicking Open in IDE launches an external application; behavior is covered by the header path resolver unit test and the existing run API field path.

Security Impact (required)

  • New permissions/capabilities? (No)
  • New external network calls? (No)
  • Secrets/tokens handling changed? (No)
  • File system access scope changed? (No)
  • If any Yes, describe risk and mitigation: N/A

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Database migration needed? (No)
  • If yes, exact upgrade steps: N/A

Human Verification (required)

What was personally validated beyond CI:

  • Verified scenarios: Unit test confirms workflow run cwd override wins over parent conversation cwd; live local API for the reported run returned the expected working_path value.
  • Edge cases checked: Missing/empty override falls back to conversation cwd; missing paths return no subtitle.
  • What was not verified: I did not click Open in IDE because that would launch an external IDE on the local machine.

Side Effects / Blast Radius (required)

  • Affected subsystems/workflows: Legacy web workflow run Chat tab header path.
  • Potential unintended effects: A wrong or missing working_path would fall back to the parent conversation cwd, preserving prior behavior.
  • Guardrails/monitoring for early detection: Unit test covers the path precedence rule; existing workflow run API contract remains unchanged.

Rollback Plan (required)

  • Fast rollback command/path: Revert commit d3901cbe.
  • Feature flags or config toggles (if any): None.
  • Observable failure symptoms: Chat tab header/path would again show the parent conversation worktree for workflow runs.

Risks and Mitigations

  • Risk: working_path may be unavailable on older or unusual run records.
    • Mitigation: Resolver falls back to the existing conversation cwd behavior when no override is present.

Summary by CodeRabbit

  • New Features

    • Chat interface now respects workflow execution context for improved path display accuracy.
  • Tests

    • Added test coverage for path resolution functionality to ensure correct behavior across different context scenarios.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0309206d-9129-4c64-9c80-249a3e99d1f6

📥 Commits

Reviewing files that changed from the base of the PR and between e77a338 and d3901cb.

📒 Files selected for processing (4)
  • packages/web/src/components/chat/ChatInterface.tsx
  • packages/web/src/components/workflows/WorkflowExecution.tsx
  • packages/web/src/lib/chat-header.test.ts
  • packages/web/src/lib/chat-header.ts

📝 Walkthrough

Walkthrough

Adds a resolveChatHeaderPath utility that prioritizes a cwdOverride over the conversation's own cwd. ChatInterface accepts a new optional cwdOverride prop and feeds it through this utility for headerSubtitle. WorkflowExecution extracts working_path from the run query and passes it as cwdOverride to ChatInterface in the DAG Chat tab.

Changes

Workflow run CWD override for chat header

Layer / File(s) Summary
resolveChatHeaderPath utility and tests
packages/web/src/lib/chat-header.ts, packages/web/src/lib/chat-header.test.ts
New exported function trims and prioritizes cwdOverride over conversationCwd, returning undefined when both are absent. Three Bun tests cover override precedence, fallback, and the missing-both case.
ChatInterface cwdOverride prop and header subtitle
packages/web/src/components/chat/ChatInterface.tsx
ChatInterfaceProps gains optional cwdOverride?: string | null; component destructures it and passes it with currentConv?.cwd to resolveChatHeaderPath when computing headerSubtitle.
WorkflowExecution working_path propagation
packages/web/src/components/workflows/WorkflowExecution.tsx
WorkflowRunQueryData gains workingPath: string | null; getWorkflowRun maps data.run.working_path to it; a derived workingPath constant is extracted; and ChatInterface in the DAG Chat tab receives cwdOverride={workingPath}.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • coleam00/Archon#1756: Modifies workflow resume logic using working_path/worktree values on the same workflow run object that this PR reads run.working_path from to populate cwdOverride.

Poem

🐇 A worktree went astray, the wrong path showed its face,
the IDE would open up some other rabbit's place!
Now cwdOverride hops in, with precedence so neat,
resolveChatHeaderPath trims the path — the fix is sweet.
The worker worktree wins the day, the header knows the score,
no more lost IDE opens — the right path, evermore! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix workflow run Open in IDE path' accurately summarizes the main change: correcting the path opened by the IDE button in the workflow run Chat tab.
Description check ✅ Passed The PR description is comprehensive and includes all major template sections: Summary, UX Journey (Before/After), Architecture Diagram with connection inventory, Label Snapshot, Change Metadata, Linked Issue, Validation Evidence, Security Impact, Compatibility, Human Verification, Side Effects, Rollback Plan, and Risks & Mitigations.
Linked Issues check ✅ Passed The code changes fully address issue #2001: ChatInterface accepts cwdOverride prop [ChatInterface], WorkflowExecution passes run.working_path as cwdOverride [WorkflowExecution], and chat-header resolver prefers override path over conversation cwd [chat-header/test].
Out of Scope Changes check ✅ Passed All changes are in-scope: modifications to ChatInterface, WorkflowExecution, and new chat-header utility directly address the linked issue without introducing unrelated features or modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@anhle128 anhle128 marked this pull request as ready for review June 17, 2026 05:09
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.

Workflow run Chat tab Open in IDE opens parent worktree instead of run worktree

1 participant