A periodical about version control, git, and the future of agentic version control.

Trunk-Based Development vs Gitflow for Agent-Written Code

Trunk-based development lets agent PRs get behavioral checks sooner.

· 8 min read
Cover illustration for “Trunk-Based Development vs Gitflow for Agent-Written Code”
Branching Model Tradeoffs · November 20, 2026 · 8 min read · 1,871 words

Trunk-based development and Gitflow put agent-written code on different paths to verification. When agents write pull requests at machine speed, trunk-based development’s short-lived branches and single merge target make it easier to run continuous behavioral checks on every change. Gitflow’s staged merge path delays that confirmation. In either model, passing unit tests alone cannot prove that a user journey still works.

How branching models determine when verification can happen

A branching model sets the timing of verification by determining where changes meet the code they must work with. A check can run against an isolated branch, but its result depends on the integration context it exercises. The merge target is therefore where the change needs to be checked. Checking a change against an intermediate target does not establish that it works in the context that will reach users.

Agent-generated PRs make this distinction harder to ignore. As writing time shrinks, the delay between implementation and meaningful verification increasingly comes from waiting to reach that target. trunkbaseddevelopment.com describes trunk-based development as “a key enabler of Continuous Integration and by extension Continuous Delivery”. Frequent merges provide the structural basis for frequent verification, rather than leaving checks to a later integration event.

What trunk-based development and Gitflow each prescribe

Trunk-based development has one shared branch, main, where short-lived working branches merge and from which releases are deployed. Every merge is potentially deployable. Incomplete features remain hidden behind feature flags. DORA’s trunk-based development page specifies three or fewer active branches, daily merges, no code freezes, and branch lifetimes under 2 days maximum. DORA research correlates the model with higher deployment frequency and shorter lead time for changes.

Gitflow separates production on main from integration on develop. Feature branches start from and return to develop, while release branches start from develop and merge into both main and develop. Hotfix branches start from main and merge into both. The release path is deliberately staged. This structure suits scheduled releases and multiple supported versions, but a feature verified on develop has not yet been verified in the main-branch context from which it will reach users.

What agents do to branching models when left without explicit rules

A coding agent’s default work pattern is task-shaped. It implements a task, creates a branch, commits changes, and opens a PR, giving each task an isolated workspace and a handoff point. That way of working fits trunk-based development because it has a single target. The branching instruction is correspondingly simple, namely to branch from main and merge back to main.

Gitflow requires more explicit routing. For a feature, the agent must start from develop, use the feature/ prefix, and target develop. Without those instructions, its default path can bypass the intended integration branch. The mismatch is mechanical. Its rules can be encoded, but selecting the starting branch, destination, and branch name creates more configuration work and more opportunities for a misrouted PR. A correctly implemented feature can therefore enter the wrong verification context before anyone evaluates its behavior.

Why Gitflow's ceremony delays the moment you can confirm a user journey works

Gitflow’s first integration check tests a feature against develop, where the configuration, data state, and other features may differ from those in production. That result has a limited scope. A release branch adds another stage in which code stabilizes before reaching main, so a behavioral regression may become visible in release-cut checks only after further changes have accumulated on develop. Confirmation in the production-equivalent context can consequently arrive days or weeks after implementation.

Long-lived branches also accumulate semantic drift. Code can still compile even if it relies on something that is no longer true on main, so it can pass its own tests but fail in integration. Qodo’s trunk-based glossary warns that “a branch that waits a day for review becomes a long-lived branch”. Gitflow’s develop-to-release-to-main path adds further wait points. The Poppendiecks’ framing of an open branch as inventory explains the cost, since work accumulates before delivering value.

Those delays can serve a legitimate release policy. Mobile releases that wait for app store review, enterprise software that needs formal compliance sign-offs, and teams that support multiple shipped versions have reasons to keep staged release control. In those settings, the ceremony is intentional. The conflict arises when a team needs agent-speed implementation and continuous confirmation of each change’s user-facing behavior, but retains a path designed to defer final integration.

Why trunk-based development's short-lived branches make continuous verification structurally easier

With every branch targeting main, a per-PR preview or staging deployment can test the change against the code line used for releases. There is no intermediate integration branch to traverse. This lets the behavioral check test sooner how the change will work when released, as long as the deployment has the production-equivalent context the check needs. The behavioral check can reveal a regression within hours, while the change and its reproduction context remain narrow.

Feature flags keep that integration cycle short even when work is unfinished. They let agent-written features merge daily without exposing incomplete behavior to users, keeping trunk releasable and the verification surface current. Qodo’s glossary reports DORA’s recommendation for AI-volume teams as small batches, automated testing, and CI. Together, those practices make per-PR behavioral verification feasible by keeping each candidate change close to the shared code it must work with.

The real costs trunk-based development imposes when agents drive volume

Agent output can overwhelm the review process that keeps branches short-lived. A plausible change may take an agent minutes to produce and a person much longer to evaluate. Review then becomes the integration bottleneck. PRs waiting days drift from trunk, defeating the model’s premise even when every branch targets main. The glossary describes risk-based review as a way to handle this that is taking shape for 2027, with automated checks handling low-risk changes while people focus on high-risk ones.

Feature flags impose a separate maintenance burden. Flags accumulate, dead code paths persist, and testing must account for flag combinations while deployment systems support fast rollbacks. These costs require active flag discipline. Fast, reliable automated tests are also a prerequisite, so adopting trunk-based development may initially slow delivery while the necessary automation is built. Neither branch naming nor frequent merging substitutes for that work.

Human review is not an unambiguous quality signal either. Research presented at EASE 2026 found that a material fraction of human comments on agent-authored PRs directed the agent without evaluating the change. A merged PR may therefore tell less about whether someone checked the architecture and failure cases. Risk-based routing helps allocate scarce review time, but it still needs verification capable of detecting failures that instructions to an agent do not expose.

Why passing unit tests on a merged PR does not confirm a user journey still works

Passing unit tests establish results for isolated functions and known inputs, leaving a user journey across services, session states, and permission boundaries unverified. An agent-written change can pass linting and achieve 90%+ line coverage while breaking an untested journey. The missing check requires a distinct category of verification.

Agent-written tests introduce another failure mode when buggy code steers the model toward assertions that preserve the error. The practical guard is independent end-to-end testing against a preview or staging deployment on every PR, with test files outside the coding agent’s reach. Mature checks should become required status checks. Individual previews are still insufficient for changes that fail only when combined, so integration-level behavioral checks must also cover cross-PR regressions.

What a behavioral gate on every agent PR looks like in practice

A behavioral gate needs to navigate real flows, respond to application state, and return evidence that supports a fix. Fixed selector replay cannot cover every exploratory question. An AI browser agent can find a login button by intent rather than a particular selector, making the check less dependent on cosmetic or DOM changes. It can also explore the main navigation for errors, empty states, or console exceptions, covering scenarios that nobody has scripted.

The result must be actionable within the coding session. A recording, logs, and reproduction steps give the coding agent evidence it can inspect without a human translating the failure. Timing is part of the gate’s design. If feedback arrives after the agent has moved on, it becomes a later bug report outside the coding session’s fix loop.

Some AI browser agent tools run through a live web app, using the team’s specs, docs, and product discussions to learn how the app should behave, and explore flows, roles, permissions, and edge cases in parallel. Each failure can come with a recording, logs, and reproduction steps. Findings can flow directly to the coding agent, separating verification from the agent that wrote the code and addressing the risk of self-grading. Humans retain ownership of requirements and the final ship decision.

Where deterministic tests still belong alongside agent-based behavioral checks

Deterministic tests and AI browser agents cover different failure modes. Playwright and Cypress validate known state transitions through fixed steps and assertions, providing repeatable regression checks for critical, well-understood flows. Browser agents are better suited to finding unscripted anomalies. They are less suited to guaranteeing that a particular sequence produces a particular outcome on every run.

That distinction also controls cost and latency. Each step in an agent-based test involves an LLM call, so a journey replayed by a script in seconds can take substantially longer and cost more at suite scale. The practical division reserves agents for exploratory sweeps, permission boundaries, and high-judgment edge cases, leaving large volumes of simple CRUD assertions to deterministic tests. New agent checks should initially run as a separate, nonblocking signal until pass-rate history establishes confidence. Moving trusted checks to blocking status then creates a hybrid gate by design, where deterministic regression and agent exploration each have their own job.

How QA coverage scales with agent output for teams without a dedicated QA engineer

For teams without a dedicated QA engineer, agent-generated code shifts the constraint from implementation capacity to confidence in the result. Unit tests and human review alone leave behavior unexamined faster than people can investigate it. More code is not the scarce resource. Agent-based QA that learns from specs, docs, and product discussions offers a way for behavioral coverage to expand with the application rather than depend on equivalent growth in QA headcount.

A team starting without automated coverage can begin with three staging scenarios, namely a login journey, a data-creation journey, and a “find anything broken” sweep. Teams need scope constraints and exact-string assertions before they can trust a green result. Pass rates come before blocking status.

exe.dev provides a production example of the responsibility placed on that layer. Described in the research as agent-first on August 27, 2026, it removed human peer code review and replaced it with agentic review, with each agent running in its own checkout and branch. Its conclusion was explicit. “Behavior, contract, and property tests matter so much more now”.

Continuous Agent Validation addresses this growing need for independent behavioral evidence without dedicated QA headcount. Engineers and product leaders still define the requirements and decide what ships, using evidence supplied by automation. The branching model sets the cadence at which changes reach verification, while the behavioral gate sets the confidence available at that point.

More in Branching Model Tradeoffs