Video summary
In this demonstration, Michael from GitLab illustrates how to resolve a specific bug in a Rust-based IoT backend using the synergy between OpenAI Codex and the GitLab Agent Platform. The scenario involves the Tanuki IoT platform, which collects sensor metrics via a REST API and streams them through WebSockets for dashboards. A critical issue was identified where the WebSocket stream failed to filter data correctly by both sensor type and metric name, causing unrelated data points like humidity to appear alongside the requested temperature readings. To address this, Michael utilizes Codex, configured with the latest GPT-5.5 model, to analyze the existing source code, identify the root cause of the filtering failure, and generate a precise fix without requiring manual coding from scratch.
Once Codex identifies the problem, it proceeds to implement the necessary changes by creating a new function that properly matches fields for WebSocket filters, effectively narrowing the live stream to only the requested metric. The AI agent goes beyond simple code generation by automatically updating documentation, adding relevant tests, and running local build tools like Cargo, Clippy, and test suites to ensure the fix is robust and adheres to Rust idioms. After verifying that the changes compile successfully and pass all internal checks, Codex is instructed to create a new branch, commit the changes, and push them to GitLab, which automatically triggers a merge request and initiates the CI/CD pipeline for further verification.
The integration with GitLab's native features ensures a seamless and secure development workflow as the merge request is created. Upon submission, GitLab Duo's code review agent immediately scans the proposed changes against defined style guides and security rules, finding no issues while confirming that public API changes are accompanied by updated tests. The CI/CD pipelines run successfully, validating the build and security posture of the new code, which allows a human developer to quickly review the automated work, approve the merge request, and integrate the fix into the main branch. This entire process, from bug identification to a verified, merged solution, is completed within approximately 15 minutes, showcasing the efficiency of combining local AI agents with GitLab's comprehensive DevOps infrastructure.
Read the full video transcript
Hello everyone. My name is Michael. I'm
a principal developer advocate here at
GitLab and today I want to dive into
Codex together with GitLab and also
GitLab 2 agent platform.
Um in this scenario we will be using the
Tanuki IoT platform, which is an IoT
platform collecting um metrics from
different sensors and it also has a back
end uh which is written in Rust, stores
the metrics. Um you can send in metrics
data using a REST API and there's also
live stream uh using web sockets for the
dashboards that can be
can be implemented for it.
Um this works relatively well, but
someone already found a bug um or found
a problem uh with filtering the web
socket stream. So, you can filter by
sensor, which could be the Arduino IoT
collector sensor for example, um and
there is a need to also filter by metric
name, which could be temperature
Celsius.
Um the problem is that it doesn't work
for that filter and in order to quickly
show you how it does not work, let's
switch over to the terminal
um where I've prepared uh the different
runtimes already. So, we uh want to
start the metrics back end on port 9090
um and we will be using cargo like the
build tool for Rust uh to run that in
the in the foreground now. So, let's go
over here. Compiles the source code and
then uh starts the service.
The next thing on the right-hand side
over here is to use web so cut um to
listen to the web socket.
We want to filter by the sensor for the
Arduino IoT collector and also the
metrics name should be temperature
Celsius. Let's start that. We can see on
the left-hand side we have a new
connection over here. Um
so um this is good to go and the last
remaining bit is sending in some sample
data, some sample metrics using curl and
the rest API. So, we are sending
temperature Celsius and humidity
percent. The expectation would be on
that the web socket filters by metric,
but we will see see that it does not.
So, let's send that over
and we can see we got the two different
metrics. So, we need to fix the problem
that this is not filtered away.
So, this is the main issue we we have
over here.
Um and in order to fix that, we want to
use codex. Um
I've installed codex on the CLI already
and configured in the background. So,
the only thing we need to do here is to
actually run it.
And we can see um
we're using GPT-55, the latest model
um
in our environment and um the uh tunnel
GRT platform is also trusted.
Um what I want to do next is to
help me fix the problem.
And in order to do that,
um
let's see.
Um I need help with a back-end change
to add met oops, metric filtering
to
the
Yeah, was it this endpoint?
Yeah, it's the /ws endpoint. Um so, live
streams
can be narrowed
to one metric.
And my expectation is that codex
analyzes the source code over here,
finds the problem and then helps me
implement
a fix.
We can see it reads the agents.md,
um the agents.md link to the uh customer
instructions for a generic chat and also
the code review instructions.
Um and it continues fetching content.
And it makes the changes. Let's scroll
up a little bit.
Here is the uh metric filter and it also
registers what should be streamed to the
client um from that implementation. It
makes sense.
Um
updates. I now create a function for
matching the field for the web socket
filters the WS.
And
Oh, yeah, this is
a simplified version of checking against
two things now. Um
And we have tests for that. That's also
great.
The documentation Oh, no, the agents
MD's updated and also the documentation
um for
filtering that. Okay.
That's nice.
The next thing it did is uh running
cargo like the former format test and
clippy. That's fine.
And now um it's compiling the source
code.
I didn't instruct it to create um a
merge request yet.
Uh but we can do that now.
Uh please
Please create new branch,
commit,
and push to create a merge request.
And we have a good branch and a merge
request that we can click on.
Um
Can we open that?
The good thing is um a merge request
immediately triggers
um CI/CD pipelines.
So, it's verified it can be verified
against the changes.
Uh the CI/CD configuration also only
builds the Rust backend. Uh so, there is
a CI/CD rule for that.
And while we're waiting for that, we can
also see that GitLab Duo on agent
platform started uh a code review
session
uh which is also running here.
And we can see pipelines have passed. Um
and GitLab Duo code review also finished
a review.
And it thought nothing to comment on.
So, um
this project uses uh code review
instructions. Uh let's quickly change
into the user's code view again so I can
show you that.
Here are the review instructions and
somewhere at the bottom
we do have the Rust style guide. So, we
can actually define to follow the Rust
idioms um to use proper error handling
uh run Clippy and address warnings, for
example.
Um
so, the uh Code Suggestions agent also
did that before. Um but in this case, um
the review agent is enforcing that. And
also when public APIs are changing
um it requires updated tests, uh which
are inside that merge request. So,
that's nice.
Um the documentation has been updated
and everything is good. Um so, the
review is okay here. Now, a human can
also review specific changes
um and then approve uh the merge request
so it can get merged.
Um the remaining thing we need to do now
is we actually also want to test um the
different behavior. So, let's switch
back into our terminal, but not this
one, but
um
this one.
And stop that process. That will also
kill the web socket, but that's
um do again. Run that.
And it should Yeah, it's now listening
because it compiled before.
Let's restart that.
Can see the connection again.
And then let's send over the metrics.
And we can see we're only filtering
this. So,
um
the merge request works.
Um what I can do now is
what I could do, I can create a
screenshot um and then post it into the
merge request, say it it works,
everything is fine, approve that, and
set it to merge. Um and this
this example or this use case it shows
um the life cycle from creating code uh
with Codex, implementing a fix for a
specific problem,
um
Codex then searches uh the locally
available context,
um implements a fix. Uh we can we saw
that it's uh creating a merge request
using the Git push options.
On the On the GitLab side, the merge
request CI/CD pipelines and also
security scanning kicked off.
Um security scanning is fine, pipelines
are fine. And also GitLab Duo Action
platform, the code review found nothing.
We tested it, okay. Now, it's ready for
merge. Um so, within 15 minutes,
something like that, um
I immediately have um a result that
keeps me going.
Um
Thanks for watching. I hope you learned
something new today and see you in the
next video. Bye-bye.