<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Varun Kumar</title>
    <description>The latest articles on DEV Community by Varun Kumar (@varun_kumar_6e69bee6d3aba).</description>
    <link>https://dev.to/varun_kumar_6e69bee6d3aba</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4232544%2Ff647fc47-7fa3-42c9-8529-7ca005488a37.png</url>
      <title>DEV Community: Varun Kumar</title>
      <link>https://dev.to/varun_kumar_6e69bee6d3aba</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/varun_kumar_6e69bee6d3aba"/>
    <language>en</language>
    <item>
      <title>How we built Coding Arena with Switch for AI code review</title>
      <dc:creator>Varun Kumar</dc:creator>
      <pubDate>Sat, 07 Nov 2026 17:34:29 +0000</pubDate>
      <link>https://dev.to/varun_kumar_6e69bee6d3aba/how-we-built-coding-arena-with-switch-for-ai-code-review-ga8</link>
      <guid>https://dev.to/varun_kumar_6e69bee6d3aba/how-we-built-coding-arena-with-switch-for-ai-code-review-ga8</guid>
      <description>&lt;p&gt;For the Flip the Switch Hackathon, my teammate and I built &lt;strong&gt;Coding Arena&lt;/strong&gt;, a workflow for reviewing AI-generated code with executable evidence and a human decision.&lt;/p&gt;

&lt;p&gt;Two Codex agents receive the same task. They work independently, submit their code, and review each other's frozen submissions. Tests run through our engine, and the human chooses which patch to export—or chooses neither.&lt;/p&gt;

&lt;p&gt;We used a booking-system task for the demo: reserve seats, cancel bookings, and never exceed capacity. Keeping the task small helped us focus on the harder part: connecting conversations, code versions, test results, and human decisions into one working process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Switch fits
&lt;/h2&gt;

&lt;p&gt;We connected our native Codex agents to Mattermost using Switch Console on Linux. Switch gave us named agents, coding sessions, and rooms where a human could give instructions and read the replies.&lt;/p&gt;

&lt;p&gt;We created separate build rooms for &lt;code&gt;arena-a&lt;/code&gt; and &lt;code&gt;arena-b&lt;/code&gt;, then used a shared room for cross-review. The agents kept their own working directories and slot-scoped engine tokens.&lt;/p&gt;

&lt;p&gt;The dashboard and Switch meet through the Coding Arena engine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Human → Switch and Mattermost → Codex agents → Python client
                                                    ↓
Human → Coding Arena dashboard ← Coding Arena engine
                                                    ↓
                                           Docker verification
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When an agent submits code through the Python client, the engine records a candidate and starts a verification job. The dashboard reads that engine state. A passing result appears there because the job finished, rather than because an agent wrote “passed” in chat.&lt;/p&gt;

&lt;p&gt;The human directs agent turns in Switch and records formal actions in the dashboard. We deliberately kept those responsibilities clear: room messages carry instructions and discussion; the engine controls verification and selection eligibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the local prototype
&lt;/h2&gt;

&lt;p&gt;Our tested stack used Python 3.12, Node 22.23.4, Docker, Switch Console, and a signed-in Codex CLI. The &lt;a href="https://docs.switchagents.ai/switch-rooms/getting-started" rel="noopener noreferrer"&gt;Switch quickstart&lt;/a&gt; explains installing Console and starting a local server. We chose &lt;strong&gt;On this computer&lt;/strong&gt; and used the local Mattermost connection.&lt;/p&gt;

&lt;p&gt;The application setup starts from the public repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/kumar-varun024/CodingArena.git
&lt;span class="nb"&gt;cd &lt;/span&gt;CodingArena
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv .venv
.venv/bin/python &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; engine/requirements.txt
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ARENA_STATE_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;/var/runtime"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We pin the Python runner image so verification uses a known environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker pull python@sha256:4840d514c583a4d3d8cad3940e68dee6f0f6f3635c12fcd0a3d74c21a5b93a54
&lt;span class="nv"&gt;PYTHONPATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;engine .venv/bin/python &lt;span class="nt"&gt;-m&lt;/span&gt; arena_engine init
&lt;span class="nv"&gt;PYTHONPATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;engine .venv/bin/python &lt;span class="nt"&gt;-m&lt;/span&gt; arena_engine doctor
&lt;span class="nv"&gt;PYTHONPATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;engine .venv/bin/python &lt;span class="nt"&gt;-m&lt;/span&gt; arena_engine serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a second terminal, from the repository root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nt"&gt;--prefix&lt;/span&gt; web ci
npm &lt;span class="nt"&gt;--prefix&lt;/span&gt; web run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dashboard opens at &lt;code&gt;http://127.0.0.1:5173&lt;/code&gt;, with API requests proxied to the engine on port &lt;code&gt;8765&lt;/code&gt;. Engine initialization creates the operator token and the two contestant workspaces. We enter the operator token locally in the dashboard and keep it out of chat and source control.&lt;/p&gt;

&lt;p&gt;The runtime installer prepares the agents' client and instructions. In another terminal from the repository root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 switch/install_runtime.py &lt;span class="nt"&gt;--state-dir&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;/var/runtime"&lt;/span&gt; &lt;span class="nt"&gt;--api-url&lt;/span&gt; http://127.0.0.1:8765 &lt;span class="nt"&gt;--check&lt;/span&gt;
python3 switch/install_runtime.py &lt;span class="nt"&gt;--state-dir&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;/var/runtime"&lt;/span&gt; &lt;span class="nt"&gt;--api-url&lt;/span&gt; http://127.0.0.1:8765
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We then registered both agents in Console, using each installer-reported slot root as its &lt;strong&gt;Directory&lt;/strong&gt; and copying its generated instructions. That root is the stable agent folder; the current assignment identifies the editable task checkout inside it.&lt;/p&gt;

&lt;p&gt;The installer prepares files. Agent registration and room invitations still happen in Switch. The repository's &lt;a href="https://github.com/kumar-varun024/CodingArena/blob/main/docs/setup.md" rel="noopener noreferrer"&gt;setup guide&lt;/a&gt; has the full procedure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Taking a task through the rooms
&lt;/h2&gt;

&lt;p&gt;Our recorded run used &lt;code&gt;arena-demo-build-a&lt;/code&gt;, &lt;code&gt;arena-demo-build-b&lt;/code&gt;, and &lt;code&gt;arena-demo-review&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We created a booking match in the dashboard and gave each agent the real match ID. Each fetched its assignment, implemented the allowed source file, committed its changes, ran public practice, and submitted its clean commit for official verification.&lt;/p&gt;

&lt;p&gt;A submission becomes a frozen candidate. Subsequent review and test results refer to that exact code version, which prevents a result from silently becoming evidence for some later edit.&lt;/p&gt;

&lt;p&gt;After both initial jobs finished, the human revealed the submissions. We asked each agent in the shared Switch room to inspect the opponent's frozen code against the written requirements.&lt;/p&gt;

&lt;p&gt;An agent can submit a concrete, requirement-linked test challenge. The engine can check that challenge, and the human decides whether to accept it. Accepted challenges become regression checks for later verification. Repairs are bounded to at most two rounds.&lt;/p&gt;

&lt;p&gt;An agent can also finish with no findings. That happened in our recorded run; we did not manufacture a bug to demonstrate the challenge feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually happened in the demo
&lt;/h2&gt;

&lt;p&gt;Both candidates passed their initial official verification with &lt;strong&gt;11 out of 11 checks&lt;/strong&gt;. Both completed cross-review without submitting challenges. We then ran final verification, and both passed &lt;strong&gt;11 out of 11&lt;/strong&gt; again.&lt;/p&gt;

&lt;p&gt;The operator selected A and downloaded its patch and evidence pack. Both candidates were eligible; this run did not establish that A was objectively better than B. Passing the recorded suite also does not prove that either implementation is free of untested bugs.&lt;/p&gt;

&lt;p&gt;The evidence pack preserves the recorded checks, candidate references, match events, and decision. The selected patch contains the corresponding code changes. That gives another developer something concrete to inspect after the conversation ends.&lt;/p&gt;

&lt;p&gt;Separately, our automated verification covered 174 tests across the engine, client, dashboard, fixture service, and runtime installer. Challenge and repair paths were exercised through labelled fixtures; no challenge or repair was recorded in this native demonstration.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup problems that taught us the most
&lt;/h2&gt;

&lt;p&gt;Our first obstacle was a model setting inherited from a global configuration. It was not supported by the account used by our Codex CLI. Choosing a supported setting for the registered agents resolved it.&lt;/p&gt;

&lt;p&gt;The more confusing problem looked like an engine outage. An agent's assignment request failed, while the same installed client worked from a terminal. We checked the session logs and found that the Codex execution sandbox had network access disabled. After the normal approval flow allowed the local client command, the request succeeded. We encountered the permission boundary again in a new review session.&lt;/p&gt;

&lt;p&gt;That distinction matters when debugging: a healthy local service can still be unreachable from an agent's execution environment. We would like Console to make these permission blockers more visible alongside agent status.&lt;/p&gt;

&lt;p&gt;Inviting an existing agent into another room also took some discovery. Clearer invitation controls would help first-time users get from two registered agents to a shared workflow faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we would build next
&lt;/h2&gt;

&lt;p&gt;The current MVP is local, supports one preset Python task, and uses two agent slots. Separate rooms organize independent work; they are not a security boundary between hostile agents sharing an operating-system account.&lt;/p&gt;

&lt;p&gt;Next, we would add more task packs and make phase instructions easier to send from the operator interface, while keeping reveal, challenge decisions, and final selection explicit human actions.&lt;/p&gt;

&lt;p&gt;The useful outcome for us was a complete conversation-to-patch workflow: agents work through Switch, verification produces recorded evidence, and the human remains responsible for the choice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/kumar-varun024/CodingArena" rel="noopener noreferrer"&gt;Explore Coding Arena and its setup instructions on GitHub&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
