AI-native engineering in open source
Sierra is piloting an interview where engineers improve a draft pull request in an existing codebase with coding agents. Five of my merged open-source fixes show how I do that work, from finding a broken invariant to proving the fix.
On 22 April 2026, Sierra published The AI-native interview. They removed their coding and algorithm interviews and replaced them with an AI-native onsite: candidates plan a product, build it with the AI tools of their choice, then review it with the interviewers. Because that onsite tests building from zero, Sierra also began piloting a debugging interview for taking a feature “from 1->N in an existing, messy codebase”: candidates get a medium-sized codebase and a colleague's draft pull request, then review and improve it while iterating with coding agents.
Much of that pilot looks like my working days. From 16 September to 4 December 2026, upstream maintainers merged 223 of my pull requests across 12 public Ruby and AI repositories, part of the 241 merged pull requests across 20 projects on my open-source page. Most are reliability fixes in code I did not write: concurrency races, savepoint rollbacks, stale background jobs and stream shutdown order. One difference matters, though. In open source I choose the problem and cut its scope myself. A candidate in Sierra's round inherits a colleague's draft of a cross-cutting feature with the scope already set, and has to work out what the author intended before deciding whether to repair the approach or replace it.
Sierra is piloting a debugging interview: improve a colleague's draft pull request in an existing codebase while working with coding agents. Five of my 223 recently merged open-source pull requests, in Rails, ActiveAgent, RubyLLM, Lewsnetter and MCP Ruby SDK, show the workflow I use for that kind of work: find the broken invariant, pivot when the first design fails, judge AI review suggestions, and prove the fix.
This post follows those four steps in order. If you only have a minute, this image summarizes it:
What the debugging round is looking for
Sierra wants interviews to capture initiative, ownership, judgment and system understanding. In an existing codebase with coding agents in the editor, I read that as four habits: find the rule that breaks, change course when the first design fails, keep judgment over AI output, and prove the fix.
Sierra lists what it wants its interviews to capture: “initiative, ownership, judgment, system understanding, and product thinking.” It also explains why the old screen no longer fit: “vibe-coding an app is easy. The harder, more relevant, problem is getting it into production in a scalable way.” In the onsite, agency comes down to one question: “do they pivot when they get stuck?” For the debugging round, Sierra says the level of AI allowed is still undecided, because new models can zero-shot many fixes.
In an existing codebase with coding agents in the editor, I read that as four habits:
- Problem framing and system understanding: finding where a rule breaks across layers instead of patching the symptom at the surface.
- Agency: changing course as soon as a database, protocol or CI matrix rejects the first approach.
- Judgment over AI output: using agents to map code, draft tests and critique a diff, then deciding which suggestion is right.
- Ownership through verification: backing a small change with reproductions, mutation checks and a plain list of what was not tested.
Working in 12 codebases I did not write over 80 days pushed me to make those habits repeatable. Each pull request goes through the same loop, with a clear line between what I hand to an AI tool and what I check myself.
Find the broken invariant Rails #59442 · Lewsnetter #80
Pick one rule the project already promises and follow it across a boundary where time, concurrency or another process can change it. In Rails the boundary was a connection proxy; in Lewsnetter it was the queue between the scheduler and the worker.
People ask how to find bugs worth fixing in a repository you cloned ten minutes ago. I don't hunt for style cleanups or speculative refactors. I pick one rule the project already promises and follow the state across a boundary where time, concurrency or another process can change it.
In Active Record, a savepoint lets an inner transaction roll back while the outer one keeps its writes. While working on a separate Rails pull request (#59440), I found a case in the then-unreleased Ractor connection handler. When a before_commit callback raised while a savepoint committed, the proxy left that savepoint open on the main connection. TransactionManager#commit_transaction had already popped the savepoint, so rollback_savepoint_transaction no longer saw it as current_transaction and skipped the main-side rollback. The savepoint's writes stayed visible, and the main side ended up one transaction deeper than the proxy.
I kept it out of #59440: I opened issue #59441 and a focused pull request, rails/rails#59442. The hard part was deciding whether the main connection still owed a rollback, because after a failed savepoint release it has already rolled back. Comparing transaction depths tells the two cases apart. I chose depths over savepoint names because the main side can use a RestartParentTransaction, which has no savepoint name. The fix added 6 lines and deleted 5 in abstract_proxy_adapter.rb, and both new tests fail on main. Ryuta Kamizono of the Rails core team merged it two days later, without review comments.
The same habit works in application code. In bborn/lewsnetter#80, the boundary was the queue between scheduling a newsletter and sending it. ScheduledCampaignDispatchJob checked that a campaign was due and had an audience, then enqueued SendCampaignJob. By the time a worker picked the job up, an editor could have moved the campaign back to draft, postponed it, or removed its segment. SendCampaignJob only checked sendable?, so it sent anyway; with the segment gone, it could mail the whole list.
The fix carries the scheduler's intent across the queue. The dispatcher passes from_scheduler: true, and under the existing claim lock the worker rechecks all three rules before sending. Manual sends and resumes don't pass the flag and behave as before. A job queued before the deploy has no flag either, so it keeps the old check: the change doesn't break jobs already in the queue, but it doesn't protect them. Bruno Bornsztein merged it the same day, after adding a test and simplifying the claim branch on the PR, and wrote:
Reproduced #79 on master: a queued send still went out after cancel or postpone, and mailed the whole list once the segment was removed. All three skip with this. I added a test for the next-tick unschedule and folded the duplicated claim branch. Manual sends had the same stale-queue gap, so master now re-checks the audience on every claim (d3ab5be). Merged, thanks.
The last part matters: once the rule was written down, the maintainer saw the same gap in manual sends and closed it on main in a separate commit.
Pivot when the first design fails ActiveAgent #664 · MCP Ruby SDK #709
A pattern copied from a nearby file is a hypothesis, not a fix. When Rails 7.2 CI broke a row-lock claim in ActiveAgent #664, I switched to one conditional UPDATE. In MCP Ruby SDK #709, I reordered teardown and wrote the new trade-off into the PR.
Sierra's question about agency is “do they pivot when they get stuck?” In an existing codebase, being stuck rarely means you can't write the Ruby. It means your first plausible fix runs into a database engine, an older framework version, or an ordering constraint you didn't see on the first pass.
When copying the local pattern broke on Rails 7.2
In activeagents/activeagent#664, AgentExecutionJob read a run's status and then wrote running as two separate steps. Two workers that both loaded the same run as pending each started a generation: a second billed provider call and repeated tool effects.
My first commit (56b3fb56) claimed the run under run.with_lock, the way AgentResumeJob#claim_pause already claimed paused runs. CI's rails7.gemfile job showed why that wasn't enough. SQLite under Rails 7.2 opens deferred transactions, so when two claims overlap, the loser's write after its locked read is refused once the winner commits. The duplicate started no generation, but instead of declining it raised SQLite3::BusyException (“database is locked”).
Thirty minutes later, commit b3e7406a replaced the lock with one conditional update_all, the way CodeSessionJob#start already claims a session elsewhere in the repository. The database decides at the write, and the affected-row count tells the worker whether it won. Because update_all skips callbacks, the winner reloads the run and broadcasts the status change itself:
# actionagent/app/jobs/action_agent/agent_execution_job.rb (#664)
def claim_pending(run)
now = Time.current
claimed = AgentRun.where(id: run.id, status: AgentRun.statuses[:pending])
.update_all(status: AgentRun.statuses[:running], started_at: now, updated_at: now)
return false if claimed.zero?
run.reload
run.broadcast_update
true
end
Two tests pin the race down. In the first, two threads on their own connections are held at AgentRun.find by a barrier until both have loaded the run, so the race happens on every run without sleeps: two executions before the fix, one after. In the second, a forked process claims the run, signals through an IO.pipe that it holds the claim, and keeps it uncommitted for 0.3 seconds while the job tries to claim. That test fails with the with_lock version on Rails 7.2 with CI's database is locked error and passes with the conditional update on Rails 7.2 and 8. The PR reports both concurrency tests stable over 20 runs on each version.
For PostgreSQL, the app's test schema doesn't load, so a standalone probe of the same statement on PostgreSQL 17 stood in: one winner in each of 50 forced races. One gap stays open on purpose. A worker that dies after winning its claim leaves the run running, and recovering it needs a lease. I named that in the PR as a separate decision instead of folding it in.
Naming the trade-off when reordering teardown
Sometimes the pivot is about order rather than data access. In modelcontextprotocol/ruby-sdk#709 (a follow-up to #692 and #698), ending a stateful HTTP session ran teardown in the wrong order. cleanup_session_unsafe woke threads waiting on nested server-to-client requests with :session_closed before their requests were cancelled, and release_session closed the GET and POST streams before calling cancel_all_incoming. Closing a stream on a stalled peer can take up to stream_write_timeout: (10 seconds by default), and in-flight requests kept running behind it.
I reordered teardown: cancel the session's requests first, wake the remaining waits second, close the streams last, all still outside @mutex. The PR measured main (00868f7) against the branch with a GET stream whose close blocked until released:
| During session DELETE | Before #709 | With #709 |
|---|---|---|
| Incoming SSE request while stream close blocks | The tool ran (cancelled? false) and its result was written to the POST stream |
The tool never ran; nothing was written |
| Request waiting on nested elicitation | RuntimeError (cancelled? false), recorded as error: :internal_error |
MCP::CancelledError (cancelled? true), recorded as cancelled: true |
Every ordering change moves the risk somewhere. Here, a blocking on_cancel hook can now delay the stream closes, where before a stalled close left requests running. I wrote that trade-off into the PR's Breaking Changes section and said where the PR could be split in two if the maintainer preferred. Koichi ITO merged it the next day.
Use AI review without outsourcing judgment RubyLLM #1676
Coding agents and AI reviewers are good at mapping code, drafting tests and finding edge cases. In RubyLLM #1676, two AI reviewers found the same real gap in my first commit and proposed different fixes. The work left to me was choosing one, and proving the choice.
Coding agents such as Claude Code, Codex and Antigravity do real work in every repository I touch. They are strongest in three places:
- Cold-start mapping: tracing call paths across an unfamiliar repository and finding sibling sites once one bug pattern shows up. Once check-then-act appeared in
AgentExecutionJob(#664), the same check found it inAgentRun#cancel!(#672) andScenarioEvaluationRunner#call(#713). - Mechanical scaffolding: drafting test harnesses and reproduction scripts, and checking PR descriptions against the actual diff.
- Adversarial critique: a second agent, or an automated reviewer such as CodeRabbit or Greptile, attacking my first commit to look for races I missed.
Where AI use goes wrong is treating a suggestion, or a passing patch, as the end of the thinking. crmne/ruby_llm#1676 is a small example of the decision that remains.
In RubyLLM, FileStore::Directory#list walked a chat's folder with Ruby's Find and called File.lstat on each path. The store's own #write writes a hidden temporary file and renames it into place, and #list doesn't take the store's lock. In a loop of writes on one thread and listings on another, about 4% of listings hit Errno::ENOENT between Find reading the folder and File.lstat. The outer rescue turned the whole listing into [], telling the model the chat had no files.
My first commit (ed046017) skipped a name that raised Errno::ENOENT or Errno::ENOTDIR and carried on. Within four minutes of the PR opening, two AI reviewers found the same gap in it. If a hidden folder vanished at File.lstat and was recreated before Find checked it again, skipping with next also skipped Find.prune, so Find could descend into the folder and list its visible children. They proposed different fixes: Greptile suggested moving the hidden-name check before File.lstat, and CodeRabbit suggested calling Find.prune inside the rescue.
Both suggestions fixed the reported case, so the question was which one needed less. A hidden name decides by itself that a path should be pruned; no File.lstat call is needed. Checking the name first fixes the recreated-folder case, and it also means the hidden temporary files that #write creates, the source of the original race, are never read at all. Pruning inside the rescue acts only after the lookup has already failed. Minutes after the reviews, commit 2b74112f moved the check, kept the narrow rescue for visible paths, and added a spec for the hidden-folder case. CodeRabbit then approved.
# lib/ruby_llm/file_store/directory.rb (#1676)
Find.find(start) do |path|
next if path == root
Find.prune if File.basename(path).start_with?('.')
stat = File.lstat(path)
files << stored_file(path, stat) if stat.file?
rescue Errno::ENOENT, Errno::ENOTDIR
next
end
The production change is three added lines and one deleted. The 49 lines of specs change the folder from inside a File.lstat stub, once, right before the walk reaches a name: a deleted file, a temporary file renamed into place, a folder replaced by a file, and a hidden folder that vanishes and comes back. None of them depends on timing, and all four fail on main.
Make verification the deliverable
Across the five PRs, 103 changed lines were production code and 466 were tests and changelog. Tests that force the bug, mutation checks and plain statements of what wasn't tested are what earn a maintainer's trust.
When a coding agent can draft a 15-line patch in seconds, the patch alone proves little. What convinces a maintainer who doesn't know you is the evidence around it.
Across the five pull requests, counting additions plus deletions from GitHub (including the maintainer's commits on Lewsnetter #80), 103 changed lines were production code and 466 were tests and changelog: 453 test lines and 13 changelog lines. My earlier posts found the same pattern: 130 library lines against 534 of tests and docs in RubyLLM's MCP client, and 854 code lines against 2,170 of tests and docs in ActiveAgent and Lewsnetter.
Show the numbers as a table
| Pull request | Repository | Production lines | Test & changelog lines | Merged |
|---|---|---|---|---|
| #59442 | rails/rails | 11 (+6/-5) | 31 tests | 1 Nov 2026 |
| #664 | activeagents/activeagent | 32 (+26/-6) | 167 tests + 13 changelog | 31 Oct 2026 |
| #1676 | crmne/ruby_llm | 4 (+3/-1) | 49 tests | 16 Nov 2026 |
| #80 | bborn/lewsnetter | 21 (+16/-5) | 118 tests | 22 Nov 2026 |
| #709 | modelcontextprotocol/ruby-sdk | 35 (+21/-14) | 88 tests | 23 Nov 2026 |
The ratio is a side effect of five habits I run before opening a pull request:
- Make the bug happen on every run. Force the bad interleaving with a synchronization point or a stub instead of hoping a sleep lines it up: a
Concurrent::CyclicBarrieratAgentRun.findin ActiveAgent#664, aFile.lstatstub in RubyLLM#1676, a stream whosecloseblocks until released in MCP Ruby SDK#709. Where a second process needs a timing window, as the forked worker in#664does, keep it short and rerun it: that PR reports 20 stable runs on each Rails version. - Mutation-check every piece of the fix. Before calling a PR done, I revert each condition, guard, reload or ordering change in turn and confirm a test fails. In ActiveAgent
#664, reverting the status condition failed 7 tests, the reload 1, the broadcast 1 andstarted_at2. In Rails#59442, forcing the depth to either value, ignoring it or dropping the nil default each failed a test. In Lewsnetter#80, disabling the scheduler branch or any one of its three checks failed a test. In MCP Ruby SDK#709, closing the streams before cancelling failed both new tests. In RubyLLM#1676, removing the rescue, dropping either error class or moving the name check back afterFile.lstateach failed a spec. - Say what must stay the same, and test it where you can. Lewsnetter
#80tests that a manual send of a due campaign still sends. In MCP Ruby SDK#709, an existing test still checks that a pending request unblocks when its session is cleaned up. RubyLLM#1676states that a permission error still ends the listing. - Report exact test runs and honest gaps. In Rails
#59442, I listed 10,195 runs onsqlite3and 9,460 onsqlite3_ractor, named the one local error in each that needed thepggem, and wrote that PostgreSQL and MySQL were not run locally. In ActiveAgent#664, I noted that the test schema did not load on PostgreSQL and ran the standalone probe on PostgreSQL 17 instead. - Write for a reviewer who has five minutes. Lead with the broken invariant, show measured before-and-after output, state any ordering or scope trade-off up front, and keep one pull request to one change.
Six habits to steal for your own codebase
Whether you maintain a company Rails app, review a colleague's draft PR, or sit in an AI-native debugging round, the same six habits apply.
You don't need to contribute to open source to practice this. Each habit carries over to reviewing a teammate's pull request or hardening a production service:
- Start from one invariant, not a symptom. Ask what promise breaks across a queue, lock, transaction or process boundary. (Rails #59442, Lewsnetter #80)
- Reproduce deterministically before editing production code. Replace sleeps with barriers, pipes or targeted stubs so the test fails on
mainevery run. (ActiveAgent #664, RubyLLM #1676) - Pivot fast when real constraints push back. When CI, another database engine or an older Rails version cracks your first design, keep the failing test and swap the mechanism. (ActiveAgent #664)
- Use AI as mapper and critic, and keep the decision. Let agents find sibling call sites and attack your diff. When their suggestions differ, ask what each fix needs to know, and test the one you pick. (RubyLLM #1676)
- Mutation-test every guard you add. Revert each condition and side effect one by one; if nothing fails, strengthen the test or delete the code. (All five PRs)
- State trade-offs and untested gaps in the PR description. Honest limits speed up review more than a claim of total coverage. (Rails #59442, MCP Ruby SDK #709)
Sierra's redesign reflects what teams now need from senior engineers: someone who can drop into an existing system, use AI tools with discipline, change course when reality disagrees with the first plan, and leave changes that are smaller, clearer and better tested than what was there. My open-source page breaks down all 241 merged pull requests by project. If you're hiring for that kind of role, start with my hire-me page; if you want this kind of review on your own codebase, see AI & codebase audits.
Limits worth knowing
Five selected pull requests illustrate a repeatable workflow for existing codebases. They are not a controlled study, they don't cover building a product from zero, and in each one I chose the problem instead of inheriting someone else's draft.
- Selected examples, not a study: I chose these five from the 223 merged in that period because each shows a decision you can inspect in a diff, a review thread or a test. They don't measure merge rates, the time AI tools saved, or how often these bugs occur in deployed apps, and they don't mean every fix needs a 4.5-to-1 test ratio.
- Choosing the problem is not inheriting it: In open source I pick bugs with a clear boundary, an explicit invariant and an observable result, and split side issues into separate pull requests. Sierra's round hands you a colleague's draft with its scope already set. Recovering another person's intent and deciding whether to repair or rewrite their approach is a different skill, and these examples show it only in part: the pivot in ActiveAgent
#664replaced my own first design, not someone else's. - 1-to-N debugging is only half of Sierra's process: Open-source bug fixes exercise system understanding, debugging, scoping and verification well. They don't replace 0-to-1 product framing, customer conversations or owning a product roadmap over years.
- Local environments still have blind spots: Rails
#59442was not run on PostgreSQL or MySQL locally, and ActiveAgent#664covered PostgreSQL with a standalone probe of one statement. CI matrices and targeted probes close part of that gap, not all of it. - AI capabilities keep moving: Sierra says the level of AI allowed in its debugging interview is still undecided, because new models can zero-shot many fixes. The durable skill is not a particular prompt or tool; it is framing the invariant, checking constraints and proving the fix.
Read this with an AI
This post is structured so you can walk through it with a chat assistant or apply its checklist in your own repository with a coding agent. A plain Markdown copy, without the page around it, lives at /blog/ai-native-engineering-in-open-source.md. Chat assistants and coding agents such as Claude Code or Codex can read it straight from that address.
A Markdown copy of this post, made for chat assistants and coding agents, is at /blog/ai-native-engineering-in-open-source.md. The full post has ready-made prompts for learning the workflow and reviewing a draft PR.
Or start from one of these prompts. The first works in any chat. Run the other two inside a coding agent such as Claude Code or Codex in your own repository.
-
Walk through the workflow (chat)
Read https://www.wangyaodi.com/blog/ai-native-engineering-in-open-source.md and walk me through its four steps using the five open-source pull requests: one section at a time, in plain words, with one question for me after each section before you move on.
-
Review a draft PR like a maintainer (coding agent)
Read https://www.wangyaodi.com/blog/ai-native-engineering-in-open-source.md and review the current git diff against its six habits. Check: (1) which invariant the change touches and where the code acts on it, (2) whether a check-then-act race, an ordering bug or a database-adapter constraint can break it, (3) whether a sibling call site has the same gap, and (4) whether a simpler fix sits one step earlier. Give me one failing case and one ordinary case that should keep working, and cite exact file paths and lines before editing anything.
-
Mutation-check our fix (coding agent)
Read https://www.wangyaodi.com/blog/ai-native-engineering-in-open-source.md. Inspect the tests for our current branch and list every condition, guard, reload, or ordering change in the production diff. For each one, tell me which test would fail if that line were reverted, flag any timing-dependent sleep, and propose deterministic barriers or stubs where coverage is missing. Do not modify production code until I review the plan.
How this post was made
I wrote this post with AI, and every post here says how it was made. The pull requests, code, tests and commit histories behind it are my own public work on GitHub, together with the reviewers' suggestions and maintainers' commits that went into them. Here is who did what:
- Sources
- Sierra's The AI-native interview (22 April 2026), my open-source record (
/oss, 241 merged PRs across 20 projects), and the five merged GitHub pull requests listed under References, with their review threads. - Draft
- Antigravity drafted the text, the four inline SVG diagrams, the share card and the one-image summary from those sources.
- Checks
- On 5 December 2026, Codex reviewed the draft against GitHub and caught three errors: the early hidden-name check in RubyLLM #1676 was Greptile's suggestion, the forked-process test in ActiveAgent #664 holds its claim with a short sleep, and jobs queued before the Lewsnetter #80 deploy keep the old check. Claude Code then rechecked every PR description, commit time, review comment, merge record, per-file line count, quote and code excerpt against GitHub and Sierra's post the same day, and the totals against
data/oss.yml. Test results are as reported in the PRs. - Review
- I reviewed the first draft, asked Codex to review and revise it, and gave Claude Code the final editorial decision. I read the final version and approved it for publication on 5 December 2026.
If you find a mistake, tell me on X and I'll fix it here.
References
All five pull requests are merged and public on GitHub, alongside my open-source record and Sierra's The AI-native interview.
My merged pull requests examined in this post:
- rails/rails#59442 Fix Ractor proxy savepoint rollback after before_commit (merged 1 Nov 2026 by Ryuta Kamizono)
- activeagents/activeagent#664 Claim a pending run before executing it (merged 31 Oct 2026 by Justin Bowen)
- crmne/ruby_llm#1676 Keep listing a folder when one of its files vanishes (merged 16 Nov 2026 by Carmine Paolino)
- bborn/lewsnetter#80 fix(campaigns): revalidate scheduled sends when claiming queued jobs (merged 22 Nov 2026 by Bruno Bornsztein)
- modelcontextprotocol/ruby-sdk#709 fix: cancel a terminated session's requests before closing its streams (merged 23 Nov 2026 by Koichi ITO)
External reference and related pages on this site:
- Sierra: The AI-native interview (published 22 Apr 2026, updated 12 May 2026)
- Open-source record: counts by project, selected pull requests and GitHub links for 241 merged upstream pull requests across 20 projects
- Learning MCP by fixing it: nine RubyLLM MCP pull requests and the five-step runtime bug method
- Production AI in Rails is mostly background-job engineering: twelve ActiveAgent and Lewsnetter pull requests on claims, leases, and server-side tool guardrails
- Hire me: target roles, remote logistics from UTC+8, and evaluation links