google-gemini / google-gemini/gemini-fullstack-langgraph-quickstart

Separate planned queries from executed queries

Open
#153 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
18.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

### Description of the feature request:

If I understand correctly, currently both `generate_query` and `web_research` nodes write to the same `search_query` key in `OverallState`, which is declared as:

`search_query: Annotated[list, operator.add]`

Because of the `operator.add` reducer, this causes `search_query` to accumulate both the original planned queries and the queries that have been executed, leading to duplication.

We should probably separate the concepts of **planned queries** and **executed queries** in state management.

### What problem are you trying to solve with this feature?

This design makes `len(state["search_query"])` misleading, since it double-counts queries (planned + executed).

In the current flow:

1. generate_query sets `search_query = ["q1", "q2", "q3"]`

2. Each `web_research` branch appends its own query: `["q1", "q2", "q3", "q1", "q2", "q3"]`

3. Reflection calculates: `number_of_ran_queries = len(state["search_query"])` (6, but only 3 actually ran)

4. This inflated number is used to offset IDs for follow-up queries. Although because IDs remain unique, the count is actually incorrect. It works but any future logic relying on an accurate count will be wrong.

### Any other information you'd like to share?

Two possible solutions:

**1) Separate state keys**

* `planned_queries: Annotated[list[str], operator.add]` -> updated by `generate_query` and follow-up generation

* `executed_queries: Annotated[list[str], operator.add]` -> updated by `web_research`

* `number_of_ran_queries = len(state.get("executed_queries", []))`

**2) Keep one list but stop re-adding in web_research**

* Remove `search_query` write from `web_research`

* Add a `ran_count: Annotated[int, operator.add]` counter instead

* Reflection uses `ran_count`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.