Skip to content

Workflow_chat: Move placeholder string replacement to before YAML stream event#515

Merged
josephjclark merged 1 commit into
release/nextfrom
placeholder-replacement-bug
Jun 10, 2026
Merged

Workflow_chat: Move placeholder string replacement to before YAML stream event#515
josephjclark merged 1 commit into
release/nextfrom
placeholder-replacement-bug

Conversation

@hanna-paasivirta

Copy link
Copy Markdown
Contributor

Short Description

This PR moves the placeholder string replacement in workflow_chat to be applied before we emit the changes event containing the generated YAML, so that we never send placeholder strings to Lightning.

Fixes OpenFn/lightning#4828

Implementation details

The UUID and code placeholders that were sent to Lightning in the changes event were generally invisible to the user, because Lightning corrects the interim YAML with the YAML sent in the final payload. However, if the user were to click into a step they might potentially see the placeholders briefly. While this doesn't appear to be causing any problems for users now, it might become problematic with the Global chat, as users might already be viewing the job code when the changes stream in – in which case they might be more likely to see the placeholders. Given this and the errors in Lightning, it makes sense to move the placeholder string replacement steps to occur before we emit the YAML in changes.

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our Responsible AI Policy

@josephjclark

Copy link
Copy Markdown
Collaborator

To test: placeholder ids will always appear in the streamed lightning logs on main. On this PR they go away.

@josephjclark josephjclark changed the base branch from main to release/next June 10, 2026 08:28
@josephjclark josephjclark merged commit b5d8c67 into release/next Jun 10, 2026
2 checks passed
@josephjclark josephjclark deleted the placeholder-replacement-bug branch June 10, 2026 08:41
josephjclark added a commit that referenced this pull request Jun 10, 2026
* Update dependencies (#516)

* chore(deps): upgrade pinecone 7 + aiohttp 3.14 to close transitive HTTP CVEs

Bump langchain-pinecone 0.2.2 -> ^0.2.13 and pinecone SDK 5.4.2 -> 7.3.0,
which drops langchain-pinecone's aiohttp<3.11 cap and lets aiohttp advance
3.10.11 -> 3.14.1 (the security target). Closes 21 aiohttp Dependabot alerts.

No source changes required: the pinecone APIs in use (Pinecone(api_key=),
.Index(), list_indexes(), ServerlessSpec) are stable across v5->v7 and both
create_index() call sites already use keyword args. langchain-core held at
0.3.x (its 1.x migration is a separate PR). Lock also sheds unused test-only
transitive deps (pytest-asyncio/-socket/-benchmark, vcrpy, langchain-tests)
that were free-riding via the old pinecone pin.

* chore(deps): pytest 9 + urllib3 2.7 + dependabot config

Bump pytest 8.4.2 -> 9.0.3 and urllib3 2.6.3 -> 2.7.0; closes 7 Dependabot
alerts (urllib3 #32/#43/#44/#57/#99, pytest #91/#96). Add .github/dependabot.yml
(pip + github-actions, weekly, grouped minor/patch) so future updates arrive
as PRs rather than silent alerts.

Stacked on deps/pinecone-aiohttp. Only pytest and urllib3 changed in the lock;
pinecone/aiohttp/langchain held firm. Unit tests 9/9 green on pytest 9.

* chore(deps): migrate to LangChain 1.x + openai SDK 2.x

Bump langchain-core 0.3.85->1.4.1, langchain-openai 0.3.35->1.2.2,
langchain-community 0.3.31->0.4.2, langchain-text-splitters 0.3.11->1.1.2,
and openai SDK 1.109.1->2.41.0. Closes Dependabot alerts #62/#76 (langchain-core),
#94/#97 (langchain-openai) and #93 (langchain-text-splitters) - all fixed only
on the 1.x line.

Sole code change: embeddings.py used the deprecated langchain_pinecone.Pinecone
alias (removed at 1.0) -> PineconeVectorStore. All other langchain/openai APIs in
use are stable across the bump (Document, similarity_search_with_score,
OpenAIEmbeddings, DataFrameLoader/JSONLoader, RecursiveCharacterTextSplitter,
OpenAI().models.list()). Stacked on deps/safe-bumps; pinecone/aiohttp/pytest/
urllib3 held firm. Unit 9/9; 8/10 import smokes pass (2 fail on a pre-existing
undeclared 'datasets' HuggingFace import, unrelated to this change).

* update dependencies and add tests

* trim tests

---------

Co-authored-by: Stuart Corbishley <[email protected]>

* move id replacement (#515)

* version: 1.3.0

---------

Co-authored-by: Hanna Paasivirta <[email protected]>
Co-authored-by: Stuart Corbishley <[email protected]>
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.

AI assistant emits placeholder ids/code (__ID_JOB_…__, __CODE_BLOCK_…__) instead of UUIDs/real code in generated workflows

2 participants