Marcin Moskala Audited GeminiAI: What the Code Review Revealed About Coroutines and Android Architecture
The developer of the open-source GeminiAI client demonstrated how the project passed a line-by-line audit by Marcin Moskala—author of Kotlin books and…
AI-processed from Habr AI; edited by Hamidun News
The open Android project GeminiAI, conceived as a full-fledged Gemini client with a replica of the original interface, underwent a line-by-line audit by Marcin Moskala — author of books on Kotlin and a JetBrains-certified instructor. The focus of the review was not the appearance of the application, but rather how well coroutines, structured concurrency, and task lifecycle control were organized in it.
How GeminiAI Emerged
The story began with a fairly simple observation: GitHub had almost no full-fledged Gemini clients that could be studied not as a collection of API calls, but as a normal Android project with thoughtful architecture. The author of the article decided to close this gap and assemble an open-source application that not only calls the model, but also demonstrates what a modern AI client might look like on a mobile stack. The goal was twofold: replicate the UI of the original Gemini while simultaneously building a technical foundation that could be analyzed layer by layer.
As a result, GeminiAI was built using Navigation3, Jetpack Compose, Dagger-Hilt, Room, Kotlin Coroutines, and Flow. However, the key task was not to showcase technologies, but rather the behavior of the application under load: answer streaming, dialog context management, correct operation cancellation, and the absence of memory leaks. For the author, this was also a personal engineering challenge following difficult interviews, where architectural questions regularly proved more important than the ability to quickly implement a feature on screen.
The Moskala Audit
The next stage turned out to be much more rigorous than typical code review. In December 2025, the project underwent a workshop by Marcin Moskala, where the analysis proceeded literally line by line. This format is important because it quickly reveals the difference between code that simply works and code that withstands growth, task cancellations, and complex asynchronous scenarios. For AI applications, this is particularly critical: coroutine errors are not always immediately visible, but later turn into hanging requests, redundant states, and elusive UI bugs.
According to the author, the audit did not end with a formal check. Marcin was added to the repository's contributors, and the project itself received an evaluation as a quality educational example of coroutines for Android development. This is an important signal for the open-source community: the value of GeminiAI turned out to be not in its replication of a familiar chatbot interface, but in demonstrating engineering discipline where many projects settle for a demo wrapper over an API.
"The code turned out to be reliable and well-structured — this is a strong example for studying coroutines in
Android".
What Exactly Was Reviewed
The central theme of the review was structured concurrency — an approach in which each asynchronous operation lives within a clear scope of responsibility and is not lost after the screen closes or the parent task is canceled. In the article, this is connected to a broader idea: uncontrolled launching of background operations in a modern application is as dangerous as endless GOTO jumps in old code. If tasks have no clear life boundaries, the application starts to pay for it with memory, resources, and predictability.
- Context inheritance: child coroutines receive parent parameters, including dispatcher and execution rules.
- Completion awaiting: the parent scope does not close until all launch and async operations within it are completed.
- Automatic cancellation: upon error or parent termination, the task tree collapses without manual cleanup.
- Responsibility boundary: heavy logic is extracted to ChatRepository, while cancellation control remains with ViewModel.
- UI behavior: when the screen closes, API and database requests should complete correctly, without hanging operations.
Following work on the project, the topic extended beyond a single repository. The author prepared material on structured concurrency based on Edsger Dijkstra's ideas about the dangers of unstructured jumps and transferred this debate to the world of coroutines. For mobile development, such a bridge between computer science and practice is useful because it helps explain architectural decisions not by team taste, but by fundamental logic of managing complexity. At the same time, it shows why task cancellation is not a minor implementation detail, but part of the architecture.
What This Means
The story of GeminiAI demonstrates a simple thing: in AI applications, success goes not only to those who quickly connected the model, but also to those who carefully assembled architecture around streaming, task cancellation, and UI lifecycle. For Android developers, this is a good signal: even a project that started as a copy of Gemini can become a reference if it truly has well-thought-out coroutines, responsibility boundaries, and application behavior in real scenarios. It is precisely these details that separate a learning pet project from code that can be used as a foundation in production.
Want to stop reading about AI and start using it?
AI News is a curated feed of AI/tech news. Hamidun Academy teaches you to use AI systematically in your work.