paircode 0.13.1__tar.gz → 0.13.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {paircode-0.13.1 → paircode-0.13.2}/.gitignore +4 -0
- {paircode-0.13.1 → paircode-0.13.2}/PKG-INFO +2 -2
- paircode-0.13.2/diary/004-gemini-silent-flash-downgrade.md +44 -0
- {paircode-0.13.1 → paircode-0.13.2}/pyproject.toml +2 -2
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/__init__.py +1 -1
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/cli.py +4 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/handshake.py +6 -1
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/state.py +21 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/templates/peers.yaml +5 -1
- paircode-0.13.2/tests/test_handshake.py +28 -0
- {paircode-0.13.1 → paircode-0.13.2}/LICENSE +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/README.md +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/diary/001-step-a-architecture.md +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/diary/002-v0.10-release-pipeline.md +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/diary/003-arch-b-pivot-grappling.md +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/__main__.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/converge.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/detect.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/installer.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/peerlab.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/runner.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/templates/FOCUS.md +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/templates/JOURNEY.md +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/templates/claude/commands/paircode.md +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/templates/claude/commands/peerlab.md +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/templates/codex/commands/paircode.md +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/templates/gemini/commands/paircode.toml +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/src/paircode/util.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/tests/__init__.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/tests/test_cli_smoke.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/tests/test_converge.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/tests/test_peerlab.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/tests/test_smoke.py +0 -0
- {paircode-0.13.1 → paircode-0.13.2}/tests/test_state.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: paircode
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.2
|
|
4
4
|
Summary: Adversarial journey framework — orchestrate multiple LLM peers through research, plan, and execute stages with file-trace peer review.
|
|
5
5
|
Project-URL: Homepage, https://github.com/starshipagentic/paircode
|
|
6
6
|
Project-URL: Repository, https://github.com/starshipagentic/paircode
|
|
@@ -21,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
21
21
|
Classifier: Topic :: Software Development
|
|
22
22
|
Requires-Python: >=3.10
|
|
23
23
|
Requires-Dist: click>=8.1
|
|
24
|
-
Requires-Dist: cliworker>=0.8.
|
|
24
|
+
Requires-Dist: cliworker>=0.8.5
|
|
25
25
|
Requires-Dist: pyyaml>=6.0
|
|
26
26
|
Requires-Dist: rich>=13.0
|
|
27
27
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Diary 004 — The silent free-flash downgrade: an unpinned peer rubber-stamped a consensus
|
|
2
|
+
|
|
3
|
+
**Stardate:** 2026-06-17
|
|
4
|
+
**Verified state:** `main`, 81 tests passing. Changes this entry: `handshake.py` (add `ProposedPeer.model`, correct the stale gemini note), `templates/peers.yaml` (model-field warning), `tests/test_handshake.py` (new).
|
|
5
|
+
**TL;DR:** paircode *already* supports per-peer model pinning end-to-end. The bug was that pinning is optional and invisible, and a misconfigured CLI fails **silently** — so a `peer-b-gemini` ran `gemini-2.0-flash-001` for an entire plan consensus while masquerading as a real fork peer.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What triggered this
|
|
10
|
+
|
|
11
|
+
During an awali working session, `/paircode` was used to review an implementation plan. The Gemini peer "converged" enthusiastically with alpha — suspiciously agreeable. The maintainer's instinct: *"I don't think it's running Gemini Pro... I needed the best model possible instead of small models that just agree with you."*
|
|
12
|
+
|
|
13
|
+
He was right. Investigation found the peer was running **`gemini-2.0-flash-001`** — the free-tier default — not a Pro model. Its "agreement" was flash-tier noise that polluted the consensus. The only load-bearing peer that session was Codex.
|
|
14
|
+
|
|
15
|
+
## Why it happened — four silent failures stacked
|
|
16
|
+
|
|
17
|
+
1. **gemini-cli auth was `oauth-personal`.** That ignores any API key entirely and uses the free Google login → flash. The paid key in the env was never consulted.
|
|
18
|
+
2. **The account was free tier.** `gemini-2.5-pro` returned `limit: 0` — free tier grants *zero* Pro requests, not "rate-limited," literally none. (Fixed by the maintainer adding $25 credit → tier-1 paid.)
|
|
19
|
+
3. **No model was pinned.** paircode passes no `-m` unless a peer has a `model:` field; the awali roster had none, so the CLI default (flash) won.
|
|
20
|
+
4. **Nothing surfaced any of it.** The file-trace header read `<!-- model: (default) -->` — technically honest, operationally a lie. A weak model rubber-stamping consensus is the worst silent failure for an adversarial-review tool.
|
|
21
|
+
|
|
22
|
+
## Key discoveries (the plumbing was already right)
|
|
23
|
+
|
|
24
|
+
- **paircode supports per-peer model pinning, fully wired:** `peers.yaml model:` → `cli.py:309 peer.get("model")` → `runner.run_peer(model=...)` → `cliworker.get_spec("gemini", model=...)` → `gemini -m <model>`. Proven by `cliworker/tests/test_registry.py:64-67`. No code was missing — only discoverability and a sane default.
|
|
25
|
+
- **cliworker already strips the stale key.** `registry.py` gemini spec: `env_strip=["GOOGLE_API_KEY", "GEMINI_API_KEY"]`. So even with a dead `AIza` key baked into the running Claude Code session, cliworker removes it before invoking gemini, which then falls through to `~/.gemini/.env`. **No shell restart or `~/.zshenv` edit is needed** — an earlier "you must restart" hypothesis was wrong and is retracted here.
|
|
26
|
+
- **gemini-cli env loader has two traps** (`chunk-*.js` `loadEnvironment`/`findEnvFile`): (a) dotenv **never overrides** an existing `process.env` var; (b) discovery returns the **first** `.env` walking up — a Laravel repo root `.env` wins unless `advanced.ignoreLocalEnv: true`. Both matter for getting the key to land.
|
|
27
|
+
- **There is no Gemini 3.5 Pro.** Pro and Flash version independently: Flash reached 3.5 (`gemini-3.5-flash`); the newest *Pro* is `gemini-3.1-pro-preview`. Cost magnitude (paid, /1M tok in/out, ≤200k): 3.1 Pro Preview $2/$12 · 2.5 Pro $1.25/$10 · 3.5 Flash $1.50/$9 (Flash output now near-Pro!) · 2.5 Flash $0.30/$2.50. A paircode peer call ≈ 1–5¢ regardless — cost is not the constraint, quality is.
|
|
28
|
+
|
|
29
|
+
## The fix (this repo)
|
|
30
|
+
|
|
31
|
+
The systemic root cause lived in `handshake.py`: `ProposedPeer` had no `model` field, so every auto-generated roster was born unpinned, and `_PEER_RANK` hardcoded the now-false belief *"gemini = Free tier, not for full forks."*
|
|
32
|
+
|
|
33
|
+
- `ProposedPeer` gains `model: str = ""`. Because `asdict()` includes defaulted fields, **every generated roster now emits `model: ''`** — the lever is visible instead of hidden. Empty stays safely falsy downstream (`cli.py` passes no `-m`).
|
|
34
|
+
- The stale gemini note is corrected to: *"Pin model: to a Pro tier — unpinned + a free/oauth login silently runs weak flash."* No model version is hardcoded (they rot fast — see "no 3.5 Pro").
|
|
35
|
+
- `templates/peers.yaml` documents the `model` field with the silent-downgrade warning.
|
|
36
|
+
- `tests/test_handshake.py` guards the new surface (model key present + pin round-trips).
|
|
37
|
+
|
|
38
|
+
External (not this repo, recorded for trace): the maintainer's gemini-cli was reconfigured — `settings.json` auth → `gemini-api-key`, `advanced.ignoreLocalEnv: true`, `~/.gemini/.env` holding the paid key. The awali `.paircode/peers.yaml` should add `model: gemini-3.1-pro-preview` to its gemini peer — that is the per-peer, paircode-native pin and supersedes any global settings.json model.
|
|
39
|
+
|
|
40
|
+
## Open paper cuts
|
|
41
|
+
|
|
42
|
+
- **Resolved model is still not surfaced.** The header shows `(default)` when unpinned; paircode can't report the model the CLI actually chose because cliworker doesn't return it. A future improvement: have cliworker echo the resolved model back in `CLIResult` so the file-trace records what *ran*, not what was *requested*. That would have caught this in seconds.
|
|
43
|
+
- **No preflight auth/tier check.** paircode can't tell a Pro peer from a free-flash one before spending a fork on it. A `paircode doctor`-style probe (cheap 1-token call asking tier) could warn "peer-b-gemini resolves to flash — pin a model?" at roster time.
|
|
44
|
+
- **`propose_roster()` still emits `model: ''` for all CLIs.** It does not suggest a concrete Pro default per CLI (deliberately, to avoid version rot). If model-name stability ever improves, a per-CLI recommended default could be added behind `_PEER_RANK`.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "paircode"
|
|
7
|
-
version = "0.13.
|
|
7
|
+
version = "0.13.2"
|
|
8
8
|
description = "Adversarial journey framework — orchestrate multiple LLM peers through research, plan, and execute stages with file-trace peer review."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -39,7 +39,7 @@ dependencies = [
|
|
|
39
39
|
"click>=8.1",
|
|
40
40
|
"pyyaml>=6.0",
|
|
41
41
|
"rich>=13.0",
|
|
42
|
-
"cliworker>=0.8.
|
|
42
|
+
"cliworker>=0.8.5",
|
|
43
43
|
]
|
|
44
44
|
|
|
45
45
|
[project.urls]
|
|
@@ -28,6 +28,7 @@ from paircode.handshake import propose_roster, proposed_as_yaml_dicts
|
|
|
28
28
|
from paircode.installer import install_all, uninstall_all
|
|
29
29
|
from paircode.runner import run_peer
|
|
30
30
|
from paircode.state import (
|
|
31
|
+
ensure_gitignore,
|
|
31
32
|
ensure_peer_dirs,
|
|
32
33
|
find_paircode,
|
|
33
34
|
init_paircode,
|
|
@@ -108,6 +109,9 @@ def ensure_scaffold() -> None:
|
|
|
108
109
|
if state is None:
|
|
109
110
|
state = init_paircode()
|
|
110
111
|
did_init = True
|
|
112
|
+
else:
|
|
113
|
+
# Retroactively protect projects whose .paircode/ predates this guard.
|
|
114
|
+
ensure_gitignore(state.project_root)
|
|
111
115
|
|
|
112
116
|
peers = read_peers(state)
|
|
113
117
|
proposed_count = 0
|
|
@@ -16,6 +16,11 @@ class ProposedPeer:
|
|
|
16
16
|
cli: str
|
|
17
17
|
priority: str
|
|
18
18
|
notes: str = ""
|
|
19
|
+
# Empty = let the CLI pick its own default model. Pin a specific model string
|
|
20
|
+
# (e.g. a Pro tier) to avoid the silent free-tier trap: an unpinned peer on a
|
|
21
|
+
# free/oauth login can quietly run a weak flash model and rubber-stamp consensus.
|
|
22
|
+
# Emitted into every generated roster so the field is discoverable, not hidden.
|
|
23
|
+
model: str = ""
|
|
19
24
|
|
|
20
25
|
|
|
21
26
|
# Default ranking of peers when auto-proposing a roster.
|
|
@@ -25,7 +30,7 @@ _PEER_RANK: list[tuple[str, str, str]] = [
|
|
|
25
30
|
# (cli, priority, notes)
|
|
26
31
|
("codex", "high", "Second opinion, good for silent-agreement hunts"),
|
|
27
32
|
("ollama", "medium", "Local unlimited; good if a capable model is pulled"),
|
|
28
|
-
("gemini", "low", "
|
|
33
|
+
("gemini", "low", "Pin model: to a Pro tier — unpinned + a free/oauth login silently runs weak flash"),
|
|
29
34
|
]
|
|
30
35
|
|
|
31
36
|
|
|
@@ -31,6 +31,8 @@ PEERS_FILE = "peers.yaml"
|
|
|
31
31
|
JOURNEY_FILE = "JOURNEY.md"
|
|
32
32
|
FOCUS_FILE = "FOCUS.md"
|
|
33
33
|
|
|
34
|
+
GITIGNORE_BLOCK_HEADER = "# paircode — adversarial multi-LLM peer review state"
|
|
35
|
+
|
|
34
36
|
|
|
35
37
|
def _now_iso() -> str:
|
|
36
38
|
return _dt.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
@@ -127,6 +129,24 @@ def ensure_peer_dirs(state: PaircodeState, proposed: Iterable) -> list[Path]:
|
|
|
127
129
|
return created
|
|
128
130
|
|
|
129
131
|
|
|
132
|
+
def ensure_gitignore(project_root: Path) -> bool:
|
|
133
|
+
"""Append `.paircode/` to outer `.gitignore` if not already present.
|
|
134
|
+
|
|
135
|
+
Mirrors `peerlab.ensure_gitignore`. Idempotent; returns True when a line
|
|
136
|
+
is added, False when `.paircode/` (or `.paircode`) is already listed.
|
|
137
|
+
"""
|
|
138
|
+
gitignore = project_root / ".gitignore"
|
|
139
|
+
existing = gitignore.read_text(encoding="utf-8") if gitignore.exists() else ""
|
|
140
|
+
for line in existing.splitlines():
|
|
141
|
+
s = line.strip()
|
|
142
|
+
if s in (".paircode/", ".paircode"):
|
|
143
|
+
return False
|
|
144
|
+
tail = existing.rstrip()
|
|
145
|
+
new_text = (tail + "\n\n" if tail else "") + GITIGNORE_BLOCK_HEADER + "\n.paircode/\n"
|
|
146
|
+
gitignore.write_text(new_text, encoding="utf-8")
|
|
147
|
+
return True
|
|
148
|
+
|
|
149
|
+
|
|
130
150
|
def init_paircode(project_root: Path | None = None, force: bool = False) -> PaircodeState:
|
|
131
151
|
"""Bootstrap .paircode/ in `project_root` (or cwd). Returns the new state.
|
|
132
152
|
|
|
@@ -143,6 +163,7 @@ def init_paircode(project_root: Path | None = None, force: bool = False) -> Pair
|
|
|
143
163
|
)
|
|
144
164
|
root.mkdir(parents=True, exist_ok=True)
|
|
145
165
|
(root / "sandbox").mkdir(exist_ok=True)
|
|
166
|
+
ensure_gitignore(project_root)
|
|
146
167
|
|
|
147
168
|
journey = _render(
|
|
148
169
|
_read_template("JOURNEY.md"),
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
# Fields:
|
|
11
11
|
# id — peer-a, peer-b, peer-c, ... (unique, immutable)
|
|
12
12
|
# cli — the command-line binary used to invoke this peer (claude/codex/gemini/ollama/aider/...)
|
|
13
|
-
# model — specific model string
|
|
13
|
+
# model — specific model string. Optional but RECOMMENDED. If omitted,
|
|
14
|
+
# the CLI picks its own default — which on a free/misconfigured
|
|
15
|
+
# login can silently be a weak flash-tier model that just agrees
|
|
16
|
+
# with you. Pin a Pro tier for real fork weight (e.g. gemini: a
|
|
17
|
+
# *-pro* model; claude: sonnet/opus). Empty = CLI default.
|
|
14
18
|
# priority — high | medium | low (used when budget is tight)
|
|
15
19
|
# daily_budget — advisory only for now; paircode logs when a peer sits out
|
|
16
20
|
#
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Handshake roster shape — guards the silent free-tier downgrade fix.
|
|
2
|
+
|
|
3
|
+
Diary 004: an unpinned gemini peer on a free/oauth login silently ran a weak
|
|
4
|
+
flash model and rubber-stamped a consensus. The fix makes the `model` field
|
|
5
|
+
present in every generated roster so pinning is discoverable, and keeps an
|
|
6
|
+
empty pin safely falsy downstream (cli.py treats "" as "CLI default").
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from paircode.handshake import ProposedPeer, proposed_as_yaml_dicts
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_generated_roster_exposes_model_key_for_pinning():
|
|
14
|
+
"""Every proposed peer must surface a `model` key, even when unpinned,
|
|
15
|
+
so users see the lever instead of falling into the silent-flash trap."""
|
|
16
|
+
peers = [ProposedPeer(id="peer-a-gemini", cli="gemini", priority="low", notes="x")]
|
|
17
|
+
dicts = proposed_as_yaml_dicts(peers)
|
|
18
|
+
assert "model" in dicts[0]
|
|
19
|
+
assert dicts[0]["model"] == "" # empty = CLI default; falsy, so no -m flag is passed
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_model_pin_round_trips_into_roster_dict():
|
|
23
|
+
"""A pinned model survives into the yaml dict that gets written to peers.yaml."""
|
|
24
|
+
p = ProposedPeer(
|
|
25
|
+
id="peer-a-gemini", cli="gemini", priority="high",
|
|
26
|
+
notes="", model="gemini-3.1-pro-preview",
|
|
27
|
+
)
|
|
28
|
+
assert proposed_as_yaml_dicts([p])[0]["model"] == "gemini-3.1-pro-preview"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|