Skip to content

fix: preserve customized workflow file instead of unconditionally overwriting (#316)#319

Open
Himanshu Kumar (himanshu231204) wants to merge 2 commits into
langchain-ai:mainfrom
himanshu231204:fix/preserve-custom-workflow
Open

fix: preserve customized workflow file instead of unconditionally overwriting (#316)#319
Himanshu Kumar (himanshu231204) wants to merge 2 commits into
langchain-ai:mainfrom
himanshu231204:fix/preserve-custom-workflow

Conversation

@himanshu231204

Copy link
Copy Markdown
Contributor

Fixes #316

writeCodeModeWorkflow() in src/code-mode.ts unconditionally overwrote .github/workflows/openwiki-update.yml on every openwiki code run, destroying user customizations (cron schedule, fork guards, env vars, pinned actions, etc.). The generated wiki then documented the overwritten defaults instead of the actual config.

Changes:

  • src/code-mode.ts: Modified writeCodeModeWorkflow() to check for an existing file first. If the workflow file exists, leave it untouched. If missing, create from template. Matches the existing preserve-by-default pattern used for AGENTS.md/CLAUDE.md.
  • test/code-mode.test.ts: Added tests verifying workflow creation, preservation of existing customized workflow, and idempotency.

All 7 code-mode tests pass.

Test User added 2 commits July 14, 2026 01:09
The isValidModelId regex required the first character to be alphanumeric,
rejecting Cloudflare Workers AI model IDs like @cf/meta/llama-3-8b-instruct.
Add '@' to the allowed first character set.

Fixes langchain-ai#315
…rwriting

The workflow write was unconditional, destroying user customizations
(cron schedule, fork guards, env vars, etc.) on every run. The generated
wiki then documented the overwritten defaults rather than the user's
actual config.

Now writeCodeModeWorkflow() checks for an existing file first and only
creates the workflow when it doesn't exist, matching the existing
preserve-by-default pattern used for agent snippet files.

Adds tests verifying:
- Workflow is created when absent
- Existing customized workflow is preserved as-is
- Idempotent across repeated runs

Fixes langchain-ai#316
@himanshu231204

Copy link
Copy Markdown
Contributor Author

Colin Francis (@colifran) Could you review this fix for #316? The workflow file was being unconditionally overwritten on every run. Now it only creates the file when missing, preserving any user customizations. All tests pass. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant