Commit Graph

93 Commits

Author SHA1 Message Date
Codex
2259471b66 Carry forward the arbiter verdict too, not just the owner final
When a paired task ends on an arbiter ESCALATE (asking the user to choose), the
user's next reply was carried into the fresh task with the owner's earlier final
as context — not the arbiter message they were actually responding to. Generalize
the carry-forward to the latest user-facing final (owner final OR arbiter
verdict, whichever the task ended on), so the user can choose based on the last
arbiter message without the new turn re-reading the whole prior conversation.
The carried-forward guidance marker is now matched by a shared prefix so it
triggers for both. Adds tests for the arbiter-escalation carry and the prefix
guidance.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-28 20:44:22 +09:00
Codex
03e6f8bcc6 Self-heal tribunal rooms with no work_dir so the owner never goes silent
A tribunal room whose work_dir was never provisioned (null) made
resolveOwnerTaskForHumanMessage return a null task, so the owner never ran and
the room went completely silent — the user's messages got no reply at all (seen
in the tts_site room, where days of requests were dropped). ensurePairedProject
now provisions the canonical workspace on demand when work_dir is missing,
guarded to tribunal rooms so a single-mode room never gets a spurious paired
workspace. Idempotent via ensurePairedWorkspaceProvisioned. Adds tests for both
the tribunal self-heal and the single-mode no-op.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-25 20:47:00 +09:00
Codex
712664ca00 Fix owner context loss after finalize; green the test suite
Owner continuity:
- Seed a freshly created owner task with the previous task's latest owner
  final on a cold start after the previous task already closed, so a user
  reply to a finalized TASK_DONE no longer produces a "no context" answer.
  Activated for this deployment via PAIRED_CARRY_FORWARD_LATEST_OWNER_FINAL
  (.env); carried text is injected as clearly-marked background only.
- Skip intermediate STEP_DONE outputs when picking the carry-forward anchor.

Single-mode routing:
- enforceRoomModeOnLease strips a stale reviewer/arbiter lease from a room
  switched back to single, preventing single-mode messages from stalling in
  the paired path on a stuck execution lease.

Session auth / credentials:
- Pre-sync Claude credentials into each session dir before the agent spawns.
- Honor CLAUDE_CREDENTIALS_PATH in setup/login.ts (per-service isolation).
- Add a relogin-required gate so a permanently logged-out claude-code room
  asks the user to re-login instead of spawning a doomed agent.

Other:
- Arbiter verdicts written in the user's language (verdict keyword stays EN).
- status-dashboard chatName field; runtime-inventory credential path resolver.

Tests (make suite fully green: 1595 pass / 3 skip):
- service-routing: default owner is now the claude service and reviewer is
  codex-review; update the 7 failover/default expectations accordingly.
- migrate-room-registrations: owner inferred as claude-code (configured
  OWNER_AGENT_TYPE) for a dual legacy room; reviewer becomes codex.
- register: mock paired-workspace provisioning + reload signal (registration
  now provisions a workspace and hot-reloads); assert RELOADED status.
- paired-execution-context: force a claude-code reviewer to exercise the
  Claude read-only branch regardless of the deployment default.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-25 18:40:14 +09:00
Codex
e14ac3dfca Merge remote-tracking branch 'gitea/main'
# Conflicts:
#	prompts/owner-common-paired-room.md
#	src/channels/discord.ts
#	src/codex-warmup.ts
#	src/db/bootstrap.test.ts
#	src/db/migrations/index.ts
#	src/paired-execution-context-reviewer.ts
#	src/usage-primer.test.ts
#	src/usage-primer.ts
2026-06-18 05:41:07 +09:00
Codex
de54f13469 fix(paired): bound arbiter interventions to stop infinite arbiter loop
The owner↔reviewer↔arbiter loop could repeat forever: when the arbiter
ruled PROCEED/REVISE/RESET it reset round_trip_count to 0, and nothing
tracked how many times the arbiter had already intervened. A re-deadlock
re-invoked the arbiter without bound.

Add a persistent arbiter_intervention_count (new column + migration 020)
that survives the round-trip reset, and a configurable cap
ARBITER_MAX_INTERVENTIONS (default 1). Once the arbiter has intervened
that many times and the loop still deadlocks, requestArbiterOrEscalate
escalates straight to the user instead of re-invoking the arbiter.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-09 02:15:21 +09:00
Eyejoker
ac0cd3e41d fix: preserve owner retry failure counts 2026-06-04 22:25:00 +08:00
Eyejoker
0cbb7e3b9c fix: preserve paired completion errors without leases (#217) 2026-06-03 08:59:51 +08:00
ejclaw
03d4c81192 fix: recover Codex rotation auth failures
- mark Codex bearer/refresh failures as terminal auth-expired states

- sync refreshed session auth back to rotation slots and revive refreshed dead_auth slots

- stop paired arbiter retry loops when Codex accounts are unavailable

- add regression coverage for rotation leases, follow-up suppression, and arbiter closure
2026-06-02 00:21:53 +09:00
claude-bot
ccc747ae1c fix(paired): cap consecutive reviewer silent-failure retries 2026-06-01 17:38:35 +09:00
Eyejoker
239c7ff1e6 fix: make paired evidence loss visible (#202) 2026-05-31 16:20:09 +09:00
ejclaw
4dcd4037f1 chore: clear low-risk lint warnings 2026-04-29 13:31:11 +09:00
ejclaw
b774dcaae5 Extract paired task status helpers 2026-04-29 10:44:28 +09:00
ejclaw
34b0ee8f4c Extract paired arbiter request helper 2026-04-29 10:32:36 +09:00
ejclaw
247a710ae7 Extract paired source ref helpers 2026-04-29 10:22:33 +09:00
Eyejoker
a74ea4bad0 fix: preserve paired owner workspace branch invariant
Safely re-anchor drifted paired owner workspaces, guard owner completion handling, and tighten generated attachment temp-dir allowlisting.
2026-04-25 12:02:02 +09:00
ejclaw
9ef79e3828 Add STEP_DONE guards, verdict storage, and stale delivery suppression 2026-04-23 15:28:42 +09:00
ejclaw
1122ace363 paired: disable latest owner final carry-forward by default 2026-04-22 05:51:43 +09:00
ejclaw
be7383d68c style: format paired execution carry-forward changes 2026-04-20 08:20:17 +09:00
ejclaw
b6a24ad9fb paired: carry forward latest owner final across superseded tasks 2026-04-20 08:19:31 +09:00
ejclaw
a59813dee6 feat: support room-level reviewer and arbiter agent selection 2026-04-15 23:47:46 +09:00
ejclaw
1846d59d2f Format owner failure recovery changes 2026-04-15 03:11:47 +09:00
ejclaw
2ab3bddc0e Recover Codex compaction failures in paired owner flow 2026-04-15 03:11:14 +09:00
ejclaw
533d0fbd18 Format supersession follow-up changes 2026-04-15 01:22:20 +09:00
ejclaw
0a6782f5c2 Fix merge-ready task supersession handling 2026-04-15 01:21:00 +09:00
ejclaw
fe9d265c66 paired: repair safe owner workspace branch mismatches 2026-04-11 08:45:47 +09:00
ejclaw
2b8f55deb6 runtime: centralize unsafe paired mode checks 2026-04-11 08:20:05 +09:00
ejclaw
f5c3393c32 runners: share protocol and reviewer policy 2026-04-11 05:07:05 +09:00
ejclaw
4e05f60400 refactor: land approved runtime cleanup and room binding cutover 2026-04-10 21:04:23 +09:00
ejclaw
2e62e125ae Audit outbound delivery and fix reviewer turn routing 2026-04-10 15:22:45 +09:00
ejclaw
0f994ab2ce fix: harden paired runtime turn coordination 2026-04-09 13:52:42 +09:00
ejclaw
10e10b499c Complete paired-room SSOT cleanup and logger singleton 2026-04-07 05:12:22 +09:00
ejclaw
b8e8c9dabf Unify paired status transitions and retry handling 2026-04-07 02:49:02 +09:00
ejclaw
cbb6bc97c7 Refactor paired execution flow boundaries 2026-04-07 00:45:17 +09:00
ejclaw
5b832042da Format files touched by executor refactor 2026-04-06 19:40:36 +09:00
ejclaw
24ffa3d2f1 Refactor paired turn transitions and scheduling 2026-04-06 19:32:36 +09:00
ejclaw
d75d26c23d Stabilize paired reviewer recovery and owner follow-up 2026-04-06 07:49:26 +09:00
ejclaw
994e957767 Enable unsafe host paired runtime 2026-04-06 02:40:15 +09:00
ejclaw
2983e0501c Serialize merge-ready owner finalize handoff 2026-04-05 20:11:14 +09:00
Eyejoker
bf3ed696fe Preserve paired review state after infra failures 2026-04-05 07:43:40 +09:00
Eyejoker
3dd772c229 Refactor local memory and role-fixed runtime routing 2026-04-04 03:50:28 +09:00
Eyejoker
60f360b5ea fix: preserve handoff roles during failover 2026-04-01 02:54:35 +09:00
Eyejoker
757e33c58e fix: prevent DONE↔DONE infinite loop and add AGENT_LANGUAGE setting
- Fix source_ref mismatch: update to workspace HEAD on first owner run
  so change detection compares against the correct repo
- Treat hasNewChanges === null as "no changes" at finalize to prevent
  infinite re-review when source_ref is unresolvable
- Add AGENT_LANGUAGE env var: when set, appends language instruction to
  all paired room prompts (owner, reviewer, arbiter)
2026-03-31 13:55:41 +09:00
Eyejoker
dd28ac6223 fix: fallback to proceed on unrecognized arbiter verdict
Previously unknown verdicts caused arbiter_escalated (task terminated).
Now falls back to proceed so the loop continues — a parse failure
should not kill the task.
2026-03-31 09:03:20 +09:00
Eyejoker
94184c137d fix: parse arbiter verdict with optional VERDICT: prefix
Codex arbiter sometimes outputs "VERDICT: PROCEED" instead of
"PROCEED". The regex now handles optional "VERDICT:" prefix,
preventing unknown verdict → false arbiter_escalated.
2026-03-31 08:51:01 +09:00
Eyejoker
196c453ccf fix: skip enqueueMessageCheck when task is already completed (ESCALATE/done) 2026-03-31 04:59:27 +09:00
Eyejoker
636c54702a fix: prevent ESCALATE → new task loop (only create tasks on human messages) 2026-03-31 04:58:26 +09:00
Eyejoker
2753849343 chore: update Claude Agent SDK 0.2.87, Codex SDK 0.117.0 2026-03-31 04:47:42 +09:00
Eyejoker
d0416489c5 fix: escalate finalize blockers without reviewer bounce 2026-03-31 04:32:10 +09:00
Eyejoker
af550a2aab fix: prevent infinite loops in paired review (merge_ready oscillation, arbiter re-invocation)
- Owner finalize with concerns now checks deadlock threshold before
  looping back — prevents merge_ready ↔ active infinite oscillation
- Arbiter verdict resets round_trip to threshold-1 instead of 0,
  giving agents one round before re-triggering arbiter
2026-03-31 04:13:26 +09:00
Eyejoker
e1b9501e87 feat: add completion_reason to paired_tasks (done/escalated/stopped/arbiter_escalated)
- owner can summon arbiter via BLOCKED/NEEDS_CONTEXT verdict
- completion_reason tracks why task ended: done (success), escalated
  (reviewer gave up), stopped (/stop), arbiter_escalated
2026-03-31 04:10:33 +09:00