InMemorySessionService.appendEvent recreates a deleted session
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
Línea de trabajo
Empieza en InMemorySessionService.appendEvent y examina la búsqueda y la inserción en el mapa de sesiones que se muestran en el issue. Lee el caso de prueba específico InMemorySessionServiceTest y compara el comportamiento de Python ADK mencionado en el informe. Se considera terminado cuando añadir un evento con una referencia conservada después de la eliminación lanza SessionNotFoundException y getSession sigue devolviendo null.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🔴 Required Information
Describe the Bug:
InMemorySessionService.appendEvent can bring a deleted session back. If code keeps a reference to a Session, deletes it through the service, and then appends an event using the old reference, appendEvent inserts that session into the internal map again.
Steps to Reproduce:
- Create an
InMemorySessionServiceand a session. - Delete the session.
- Call
appendEventwith the retainedSessionobject. - Fetch the deleted session again.
Expected Behavior:
The append should fail because the session no longer exists, and the session should remain deleted. SessionNotFoundException seems like the natural error here.
Observed Behavior:
The append succeeds, and getSession returns the previously deleted session again.
appendEvent currently ends with:
sessions
.computeIfAbsent(appName, unused -> new ConcurrentHashMap<>())
.computeIfAbsent(userId, unused -> new ConcurrentHashMap<>())
.put(sessionId, session);
so all three missing levels are recreated.
Environment Details:
- ADK Library Version: current
mainat84bae34a9ae4c133c7e6294faff5cb50f64a3474 - OS: Ubuntu 24.04
- Java Version: OpenJDK 21.0.12.1
Model Information:
- Which model is being used: N/A
🟡 Optional Information
Regression:
Unknown.
Logs:
I added the focused test below and ran:
./mvnw -pl core -Dtest=InMemorySessionServiceTest#appendEvent_afterDelete_doesNotRecreateSession test
It fails with:
expected com.google.adk.sessions.SessionNotFoundException to be thrown, but nothing was thrown
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
Screenshots / Video:
N/A
Additional Context:
The Python ADK InMemorySessionService.append_event checks that the session ID is present and raises SessionNotFoundError before applying the event. Matching that behavior would also prevent a stale session reference from undoing a successful deletion.
Minimal Reproduction Code:
@Test
public void appendEvent_afterDelete_doesNotRecreateSession() {
InMemorySessionService sessionService = new InMemorySessionService();
Session session = sessionService.createSession("app", "user").blockingGet();
sessionService.deleteSession("app", "user", session.id()).blockingAwait();
assertThrows(
SessionNotFoundException.class,
() -> sessionService.appendEvent(session, Event.builder().build()).blockingGet());
assertThat(
sessionService.getSession("app", "user", session.id(), Optional.empty()).blockingGet())
.isNull();
}
How often has this issue occurred?:
- Always (100%)
- Lenguaje dominante
- Java
- Estrellas
- 1.8k
- Forks
- 440
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 92
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de google/adk-java
-
Runner drops callbackContextData written in onUserMessageCallback when it resumes an invocationPosiblemente ocupada @hirematha la tomó hace 4 días. Abiertoneeds review
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google/adk-java#1695 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
AgentExecutor ignores the A2A contextId when creating a session, so multi-turn conversations start over every turnPosiblemente ocupada @hirematha la tomó hace 2 días. Abiertoneeds review
google/adk-java#1718 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
McpToolset hangs silently for ~5 minutes per retry (3 retries) when stdio command is an npm shim ("npx") on WindowsPosiblemente ocupada @hemasekhar-p la tomó hace 8 días. Abiertoneeds review
google/adk-java#1686 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
runLive passes partial events to appendEvent and never aggregates text chunks, unlike ADK PythonPosiblemente ocupada @hemasekhar-p la tomó hace 18 días. Abiertoneeds review
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
google/adk-java#1648 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
FirestoreSessionService compares event timestamps as text, reordering or skipping same-second eventsPosiblemente ocupada @hemasekhar-p la tomó hace 18 días. Abiertoneeds review
Dificultad 3/5 1-2 días Aptitud para principiantes 50/100
google/adk-java#1646 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de google/adk-java
Issues similares
-
area: triage theme: undefined
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
jhipster/generator-jhipster#35895 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
oracle/graalvm-reachability-metadata#11659 ·
Los mantenedores suelen responder en 1 día
-
Build failure report and inbox copy miss a proof split by colour codes, which the build log redactsAbiertobug follow-up
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Sanne/incus-spawn#1864 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
openhab/openhab-addons#22135 ·
Los mantenedores suelen responder en 1 día