DEV Community

Avery Li
Avery Li

Posted on

The Pairing Kept One Decision After Three Dead Ends

The pair should not start a free-tier coding agent until three human artifacts already exist in writing. Those artifacts are the questions already asked, the dead ends already tried, and one decision the pair will keep if the workspace is deleted. Free model access and a free server do not replace that freeze, because agents still reopen paths the humans already rejected. This walkthrough records a reconstructed pairing that reached that freeze rule only after three failed attempts.

Pairing notes decay faster than diffs

Senior engineers often remember the rejected approaches more clearly than they remember the accepted patch itself. Junior partners usually remember only the accepted patch and forget why three other shapes already died. Agents sitting between them remember neither, because they receive a prompt that starts at the current tree. The familiar waste is an agent rediscovering a dead end the pair already closed ten minutes earlier.

Chat transcripts vanish when the window closes, and inline comments inside the working tree pollute the eventual reviewable diff. Prompt preambles look convenient until the agent summarizes them and drops the owners of each answer. The pairing therefore needed a receipt that lives outside the repository and outside the model context window. That pairing receipt becomes the only merge-worthy object, while the agent workspace remains a disposable copy.

Three dead ends the pair actually walked

The walkthrough below is a reconstructed pairing on authorization middleware, labeled as a proposal rather than a production incident report. The junior partner wanted retries around a policy client that timed out after two hundred milliseconds. The senior refused those retries because they amplified tail latency on the shared gateway path. The agent, when invited too early, reopened both retries and a stale allow cache from memory.

Dead end one wrapped the policy client in a three-shot retry with backoff and failed a local load script against the p99 SLO. Dead end two cached the last good policy for thirty seconds and then served a stale allow after a revoke fixture. Dead end three asked an agent to invent a timeout policy from the open tree, which simply rediscovered the first two failures. The kept decision after those three attempts was to fail closed on policy timeout, emit a metric, and never retry.

The senior asked who owned the fail-closed choice, who had measured the p99 script, and who would delete the agent workspace. The junior owned the measurement script, the senior owned the fail-closed rule, and both owned the delete step. Questions without named owners were treated as incomplete, even when the group felt they had already agreed. That rule later became field validation in the receipt checker rather than a social reminder during the next session.

A receipt the agent is forbidden to edit

The JSON document below is a proposal for a pairing receipt, not an executed production record from a live incident. Teams can keep pairing/receipt.json on the operator machine and copy a read-only snapshot into a disposable workspace. The agent may read that snapshot as constraint text, but any write to the receipt invalidates the whole remote session. Verbose receipts survive pairing better than compressed prompts the model is free to summarize away.

{
  "session_id": "2026-09-09-authz-middleware",
  "repo": "payments-gateway",
  "agent_may_edit_receipt": false,
  "questions": [
    {
      "id": "Q1",
      "asked_by": "senior",
      "text": "Does the middleware fail closed when the policy service times out?",
      "answered_by": "junior",
      "answer": "Current code fails open after 200ms; that is the pairing bug."
    },
    {
      "id": "Q2",
      "asked_by": "junior",
      "text": "Can we retry the policy call inside the request path?",
      "answered_by": "senior",
      "answer": "No. Retries amplify tail latency. Fail closed and emit a metric."
    },
    {
      "id": "Q3",
      "asked_by": "senior",
      "text": "Who deletes the free-tier workspace after local replay?",
      "answered_by": "both",
      "answer": "Either partner may delete it; merge requires evidence it was deleted."
    }
  ],
  "dead_ends": [
    {
      "id": "D1",
      "attempt": "Three-shot retry with backoff around the policy client.",
      "symptom": "Local load script pushed p99 past the gateway SLO.",
      "abandoned_because": "Retries were forbidden by Q2."
    },
    {
      "id": "D2",
      "attempt": "Cache the last good policy for thirty seconds.",
      "symptom": "Stale allow survived a revoke in the fixture set.",
      "abandoned_because": "Authorization must not serve a cached allow after revoke."
    },
    {
      "id": "D3",
      "attempt": "Let the agent invent timeout handling from the open tree.",
      "symptom": "The agent reopened D1 and D2 because the prompt omitted them.",
      "abandoned_because": "The agent had no receipt, only current files."
    }
  ],
  "kept_decision": {
    "id": "K1",
    "statement": "On policy timeout, fail closed, record a metric, and do not retry.",
    "agent_must_not_reopen": ["D1", "D2"],
    "success_test": "test_policy_timeout_fails_closed"
  },
  "workspace": {
    "kind": "disposable-free-tier",
    "merge_rule": "keep only diffs that still pass after a clean local replay"
  }
}
Enter fullscreen mode Exit fullscreen mode

Target shape the kept decision required

The application change below is not production code and should be read as a proposal for local replay. It exists so the named success test has a concrete function to call after the agent session ends. The agent is allowed to move toward this shape only after the receipt validates on the operator machine.

# policy_middleware.py — proposal / unexecuted example
class Deny:
    def __init__(self, reason: str) -> None:
        self.reason = reason


class PolicyTimeout(Exception):
    pass


def authorize(request, policy_client, metrics):
    try:
        return policy_client.evaluate(request, timeout_ms=200)
    except PolicyTimeout:
        metrics.increment("policy.timeout.fail_closed")
        return Deny(reason="policy_timeout")
Enter fullscreen mode Exit fullscreen mode
# tests/test_policy_timeout_fails_closed.py — proposal / unexecuted example
from policy_middleware import Deny, PolicyTimeout, authorize


class FakePolicyClient:
    def evaluate(self, request, timeout_ms):
        raise PolicyTimeout()


class FakeMetrics:
    def __init__(self) -> None:
        self.counts = {}

    def increment(self, name: str) -> None:
        self.counts[name] = self.counts.get(name, 0) + 1

    def count(self, name: str) -> int:
        return self.counts.get(name, 0)


def test_policy_timeout_fails_closed():
    metrics = FakeMetrics()
    result = authorize(object(), FakePolicyClient(), metrics)
    assert isinstance(result, Deny)
    assert result.reason == "policy_timeout"
    assert metrics.count("policy.timeout.fail_closed") == 1
Enter fullscreen mode Exit fullscreen mode

The brief the agent may receive is also a proposal, not a captured production prompt. It restates the receipt instead of replacing the receipt with a shorter summary. Summaries were dead end three in prose form, because they dropped owners and abandoned symptoms.

# agent_brief.txt — proposal, not a production prompt dump
You may edit application files only.
You may not edit pairing/receipt.json.
You may not reopen dead ends D1 or D2.
Kept decision K1 is closed.
Run test_policy_timeout_fails_closed before claiming done.
Enter fullscreen mode Exit fullscreen mode

Numbered workflow used after the third dead end

The steps below form a method a pair can run in one sitting with git and Python 3. They assume the disposable workspace can be deleted without losing the only copy of the receipt. The order is the control plane, not a suggestion the agent may reorder. Reversing the order recreates dead end three and spends free-tier capacity on memory the pair already paid for in conversation.

  1. Create pairing/receipt.json on the operator machine, not on the shared server, before anyone types a model prompt.
  2. Record every question already asked, including the owner of each answer, even when that answer remains unknown for now.
  3. Record every dead end already walked, with a symptom a later reader can retest without the original chat history.
  4. Record exactly one kept decision and the test name that would prove that decision on a clean tree.
  5. Run the checker shown below so missing owners, empty symptoms, or extra kept decisions fail closed immediately.
  6. Copy a read-only snapshot of the receipt into a disposable workspace that may use free model access later.
  7. Allow the agent to change application code only, and reject any write against pairing/receipt.json without debate.
  8. Replay the candidate diff in a clean local clone, keep the receipt, and then delete the free-tier workspace.

Checker the pair ran before the first agent call

The checker below is a proposal and is not claimed as a production merge gate. It fails when a question lacks an owner, when a dead end lacks a symptom, or when the kept decision is missing a test name. A failing checker is a successful pairing outcome, because it keeps the free-tier session from starting. The humans are not finished until this process exits zero.

# pairing_check.py — proposal / unexecuted example
from __future__ import annotations

import json
import sys
from pathlib import Path

ALLOWED_KINDS = {"disposable-free-tier", "local-throwaway"}


def load_receipt(path: Path) -> dict:
    data = json.loads(path.read_text(encoding="utf-8"))
    if not isinstance(data, dict):
        raise ValueError("pairing receipt must be a JSON object")
    return data


def require(cond: bool, message: str, errors: list[str]) -> None:
    if not cond:
        errors.append(message)


def check(data: dict) -> list[str]:
    errors: list[str] = []
    questions = data.get("questions") or []
    dead_ends = data.get("dead_ends") or []
    kept = data.get("kept_decision") or {}
    workspace = data.get("workspace") or {}

    require(isinstance(questions, list) and questions, "at least one question is required", errors)
    for item in questions:
        qid = item.get("id", "?")
        require(bool(item.get("asked_by")), f"{qid}: asked_by is required", errors)
        require(bool(item.get("answered_by")), f"{qid}: answered_by is required", errors)
        require(bool(item.get("answer")), f"{qid}: answer is required", errors)

    require(isinstance(dead_ends, list) and dead_ends, "at least one dead end is required", errors)
    for item in dead_ends:
        did = item.get("id", "?")
        require(bool(item.get("symptom")), f"{did}: symptom is required", errors)
        require(bool(item.get("abandoned_because")), f"{did}: abandoned_because is required", errors)

    require(isinstance(kept, dict), "kept_decision must be a single object", errors)
    require(bool(kept.get("statement")), "kept_decision.statement is required", errors)
    require(bool(kept.get("success_test")), "kept_decision.success_test is required", errors)
    require(workspace.get("kind") in ALLOWED_KINDS, "workspace.kind must be disposable", errors)
    require(data.get("agent_may_edit_receipt") is False, "agent_may_edit_receipt must be false", errors)
    return errors


def main() -> int:
    path = Path(sys.argv[1] if len(sys.argv) > 1 else "pairing/receipt.json")
    errors = check(load_receipt(path))
    if errors:
        print("pairing receipt rejected:")
        for err in errors:
            print(f"- {err}")
        return 1
    print(f"pairing receipt accepted: {path}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
Enter fullscreen mode Exit fullscreen mode

Commands the pair can run on the operator machine before any remote session starts are listed next. They are a proposed operator sequence, not a claim that a particular cloud account was used. The chmod 0444 line is the pairing's real enforcement, not a comment hidden inside the model prompt.

mkdir -p pairing /tmp/agent-workspace
python3 pairing_check.py pairing/receipt.json
install -m 0444 pairing/receipt.json /tmp/agent-workspace/PAIRING_RECEIPT.json
test ! -w /tmp/agent-workspace/PAIRING_RECEIPT.json
git clone --no-local . /tmp/clean-replay
git -C /tmp/clean-replay status --short
python3 -m pytest /tmp/clean-replay/tests/test_policy_timeout_fails_closed.py
rm -rf /tmp/agent-workspace
Enter fullscreen mode Exit fullscreen mode

If the remote workspace can rewrite the receipt, the session is already contaminated and should be discarded at once. Local replay still happens on the operator clone, which never mounted the free-tier disk as an authority. That split keeps the laptop as the source of truth for both the receipt and the eventual merge. The deleted workspace is a successful ending, not a lost experiment.

Decision table left on the whiteboard

Signal in the pairing Human action Agent allowed What gets kept
Questions exist, no owners Stop and name owners No Nothing
Dead ends exist only in chat Copy them into the receipt No Nothing
More than one kept decision Split the pairing into two sessions No Nothing
Receipt validates, test missing Write the success test first No The receipt only
Receipt validates, test named Start a disposable workspace Yes, application files only Diff that replays locally
Agent edits the pairing receipt Discard the workspace After discard, no Previous receipt

The table is the pairing's control plane, and the agent is a worker behind that plane. The worker does not vote on dead ends, owners, or the kept decision. If a later prompt tries to reopen D1 or D2, the pair discards the workspace instead of negotiating with the model. Negotiation was how dead end three entered the original session.

Test plan the pair can rerun without a model

The cases below are a reproducible test plan for the method, not a vendor benchmark and not a claim about model quality. Each case names an input, an expected checker result, and whether an agent session may start. Pairs can run the same cases on a laptop without any remote server and still learn whether the freeze is real.

  1. A receipt with an unanswered question must exit nonzero, and the disposable agent session must not start afterward.
  2. A receipt that omits success_test must exit nonzero, because the kept decision is not yet falsifiable on a clean tree.
  3. A receipt that sets agent_may_edit_receipt to true must exit nonzero, even when every question already has an owner.
  4. A writable snapshot in /tmp/agent-workspace must fail the test ! -w check, and that workspace must be deleted.
  5. A clean clone must run test_policy_timeout_fails_closed after the candidate diff lands, before anyone discusses merge.

Where free model access and a free server actually help

Disclosure: This article was prepared as part of MonkeyCode's product outreach. MonkeyCode is cited here only as a coding-agent project that currently offers free model access and a free server option. Those two options make a burn-after-use pairing sandbox cheap enough for a pair to delete without budget theater. They do not create pairing memory, and they should not start until the receipt already validates on the operator machine.

After the receipt validates, a disposable workspace becomes rational rather than decorative for this kind of pairing. Free model access lowers the cost of a session the pair has already agreed to delete after local replay. A free server option keeps that session off the laptop that must stay clean for the replay clone. Neither benefit appears if the pair skips the receipt, because the agent will spend the free tier rewalking D1 and D2.

No model names, quotas, hardware, duration, or permanence are claimed here, because those details were not verified for this article. The method still works against any throwaway directory the pair can delete, including a local folder with no remote server. Vendor availability can change, so the receipt and the local replay remain the durable parts of the workflow. The remote session is a rented whiteboard, not a source of record.

Limitations and who should skip this

This workflow is slow on purpose, and that slowness is a poor fit for some real work. Pairs debugging a one-line typo should not write a receipt novel before fixing the obvious typo in front of them. Pairs without a shared definition of fail-closed versus fail-open will produce logs that look complete and still ship the wrong decision. The checker cannot see whether a dead-end symptom is true; it only sees whether the field is empty.

Do not use this approach for incident response under a hard clock, where writing owners would delay a needed rollback. Do not place credentials, production dumps, or customer records on a shared free server in the name of pairing convenience. Do not treat a free-tier workspace as the branch that will be merged, even when the generated diff looks tidy in the remote editor. Do not ask an agent to summarize the receipt into a shorter prompt if that summary drops owners or abandoned symptoms.

The kept decision is a human object, and it has to survive after the workspace is gone. If the pair cannot defend fail-closed timeout handling without the agent in the room, the pairing is not finished. In that case the next step is another human question, not another free-tier run. The receipt exists to make that pause visible instead of polite.

The pairing described here kept one decision after three dead ends: fail closed on policy timeout, never retry, and throw away every free-tier workspace that cannot replay that decision on a clean local tree. The questions and the dead ends outlived the agent session, which was the point of writing them down first. Readers who already have a free-tier coding-agent server can snapshot this receipt into a throwaway session, replay locally, and then delete the remote copy. The decision that remains should still make sense when nobody is paired and the model is not running.

Top comments (0)