Needs work
Project:
AI powered Search Block
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 May 2025 at 22:34 UTC
Updated:
18 May 2026 at 11:28 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
akempler commentedComment #3
wouters_f commentedI will look into this.
Feel free to try out if you can fix this and then we can work on this together.
Any hints in order to solve this is helpful.
Comment #4
keiserjb commentedWhen using layout builder, the $block_id is a UUID. Haven't figured out how to fix it yet though.
Comment #6
lammensj commentedThe fact that the Response block can not be found by the controller is normal: the block isn't saved in the database in the "normal" way, its configuration is serialized and put into the entire blob that is the LB-config.
In order to solve this, there are a couple of options:
1. We force the site builders and LB-users to link the two blocks together by an ID that they need to specify. It's the same way how Facets are connected to Views and their exposed filters.
2. We append the response of the LLM directly to the form block.
Don't know what Frederik prefers or how many users are actually placing the two blocks in different regions (instead of just below each other).
Comment #7
lammensj commentedComment #8
nikro commentedHey hey - picking this up - will send a solution for QA @lammensj (today)
Comment #9
nikro commentedQuick update from my side:
I reworked this toward a signed locator flow (instead of shipping full block config in requests).
High-level:
search_context+search_context_sig.source=block_entity- load block entity settingssource=layout_builder- load section storage + locate component UUIDIf that inference fails, we still have a signed legacy fallback path.
So the main path is now: signed payload -> verify -> resolve canonical config server-side -> execute search.
Testing I ran (and you can run too):
Notes:
-
search_contextstill appears as `enc:...` in HTML (expected), but on the new path it carries locator info, not full plain config.in example:


--
Comment #10
nikro commentedComment #12
nikro commentedok this one was a PAIN :) tbh
Comment #13
arianraeesi commentedComment #14
csakiistvanTesting description
Environment
drupal/ai: 2.0.x-dev (b88de44)— upgraded from 1.4.x-devdrupal/ai_provider_google_vertex: dev-2.x (c83e0b8)Prerequisites
drupal/keymodule installed.Steps
Update
composer.jsonto require AI 2.x and the 2.x branch of the Vertex provider:composer require drupal/ai:2.0.x-dev drupal/ai_provider_google_vertex:dev-2.xRun database updates:
drush updb -yExpected: one pending update for
ai_automators_update_11001.Enable the required modules:
drush pm:enable symfony_http_client ai_provider_google_vertex -yExpected: modules enable without errors alongside AI 2.x.
Verify the changes introduced by MR !17 are present in the installed codebase:
web/modules/contrib/ai_provider_google_vertex/src/Plugin/AiProvider/VertexProvider.phpand confirm thesetAuthentication()method signature uses$service_accountas the parameter name (renamed from$file_location).web/modules/contrib/ai_provider_google_vertex/ai_provider_google_vertex.info.ymland confirm it containscore_version_requirement: ^10.4 || ^11.Create a Key entity for the GCP service account at
/admin/config/system/keys/add, using the JSON key file as the key value.Navigate to
/admin/config/ai/providersand open the Google Vertex AI provider configuration form. Verify that the service account key created in the previous step is selectable from the key dropdown.Save the provider configuration and confirm no errors are thrown.
Expected results
drupal/aimodule upgrades cleanly from 1.4.x to 2.0.x.core_version_requirement: ^10.4 || ^11is present in the module's info file.setAuthentication()parameter is named$service_account.Actual results
All steps completed successfully. Both changes introduced by MR !17 were already present in the
dev-2.xbranch, making the patch unnecessary. The module installs and configures correctly with AI 2.x.Next steps
Check the MR it has failed pipeline jobs.
This comment was produced with the assistance of an LLM
Comment #15
csakiistvanComment #16
csakiistvanComment #17
nikro commentedComment #18
nikro commentedThat's a slop review - don't use AI 2.x - it's not released yet.
Comment #19
abhisekmazumdarComment #20
marcus_johansson commented@csakiistvan - that review probably should be here #3566301: Compatibility with AI 2.x?
Comment #21
abhisekmazumdarTested the MR on Drupal 11 with ai 1.3.x
Manual testing
All scenarios I can think of passed. Standard block layout works without regression.
- Placing AI Search and AI Search Response blocks in Layout Builder (per-node override) saves and renders without error.
- The AJAX call to
/ai-search-block/queryreturns 200 for LB-placed blocks, the original "Missing required parameter: block_id" error does not occur. Block config correctly storeslb_storage_type,lb_storage_id, andlb_component_uuid, confirming the controller resolves settings via the signed context rather than the config entity ID.- Tampering the hidden search_context field returns HTTP 400 with no search executed. The page renders cleanly with only AI Search placed and no Response block present.
Code review issues
Issue 1:
SearchResponseBlock::build()breaks DB-results under Layout Builder. It still callsloadByProperties()on theblockstorage to find the paired form block's DB-results config. Under LB there is no config entity to find, so DB-results silently render nothing. Same root cause as the original bug, just in the response block path.Issue 2: Removing the
block_id-only fallback requires a full cache flush on deploy. Pages cached before deploy send nosearch_contextfield at allresolveSettings()returnsNULLand users get a 400 until caches are warm. This should be noted somewhere over the docs maybe ?These 2 issues should be addressed before RTBC. The core fix is sound and the signed stateless context approach is tamper-resistant.
AI disclosure: Code review and comment were preped with AI assistance and manually reviewed before posting.