Skip to content

feat(loop): default-detached run + #451 design audit fixes - #459

Merged
huichen merged 5 commits into
mainfrom
claude/loop-design-sync
Sep 2, 2026
Merged

huichen merged 5 commits into
mainfrom
claude/loop-design-sync

Conversation

@huichen

@huichen huichen commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #457, four review-driven items:

1. #451 design audit (every claim checked against code)
All major claims verified: floors/gauges thresholds (monitor stall=3, zombie=2, repair=1, oscillation window), manual todo complete bypasses --verify (confirmed, no validator call in todo_complete), push dedup keyed on transitions, ui GET-only, succession auto-promotion (made real in #457), envelope signals/upstream-evidence (#455). Two doc-vs-code gaps found and left documented (not silently changed): 'no global priority queue' vs sorted_runnable's priority sort (priority orders the offer, not the board — wording kept, meaning holds); 'retire before the token ceiling with a handoff' has no pre-emptive mechanism (CTX_LIMIT → HardError → fresh covers it; already mapped in #457's lifecycle section).

2. Default-detached run (the headline)
future loop run now re-executes itself detached by default: parent prints the child pid and exits immediately; the child runs the turn loop with its own log under <root>/detached/<goal>/<agent>-<ts>.log. Platform-neutral detachment (POSIX process_group(0) / Windows CREATE_NEW_PROCESS_GROUP|DETACHED_PROCESS). Opt-outs: --detach (foreground child), FUTURE_LOOP_NO_DETACH=1 (tests/embedders); auto-skipped under test harnesses (exe-stem check). E2E-verified: parent returns in ~10ms, child executes the turn, writeback lands, goal reaches terminal. The orchestrator no longer needs nohup — and can no longer accidentally block on a todo.

3. Complex-graph E2E (information-flow validation)
Fan-out×3 → synthesis → fan-out → multi-hop chain exercised against the live agent: upstream evidence injects into the synthesis envelope only after predecessors complete (correct), fan-in acceptance contracts gate completion, mid-graph supersede+re-split works, terminal judgement derives over the messy graph. Known thin spot (not fixed here, by design): the goal-memory history block caps at 5 events — multi-hop insight beyond the immediate predecessor flows through artifact files, not the envelope.

4. CLI surface audit (41 commands)
Help/usage spot-checked against real flag rejection (all consistent); one inaccuracy fixed: run's summary said 'requires --agent-id' while --anonymous exists.

Scoped verification: cargo test -p future-loop 64 suites green, clippy --all-targets -D warnings, fmt.

chenhui added 5 commits September 2, 2026 16:49
Envelope (turn_envelope.rs):
- stop embedding the kernel's scheduling internals (should-run verdict /
  mode / arbitration) in the worker prompt — they are addressed to the
  orchestrator, not the worker (ARCHITECTURE.md 'Not in the envelope');
  'future loop turn' now prints the decision summary separately so the
  operator keeps that visibility
- inject upstream evidence for fan-in (synthesis) todos: each done/
  superseded --blocks predecessor contributes an evidence snippet
  (capped), per 'its envelope injects their evidence and artifact paths'
- carry the advisory signals (failure count / outcome floor / oscillation /
  no-progress) as a signals: block in the context layer, recomputed from
  the ledger through the SAME kernel detectors that render the delivery
  reason advisories (stall::todo_signals is now the single shared text) —
  resolving the architecture's own contradiction between principle 1
  (signals surface in the turn envelope) and the old envelope section
  (which banned the reason that carried them)

Succession auto-promotion (multi_agent.rs):
- backup_for edges auto-promote when the primary's lease expires or its
  heartbeat goes silent: scheduler_tick drives auto_promote_successions
  (idempotent record_succession) at both dead-holder check sites —
  'agent succession show|apply' keeps its manual semantics

Docs (ARCHITECTURE.{md,zh-CN.md}):
- split the envelope rule into 'not in the envelope: scheduling internals'
  vs 'in the envelope: observable signals' so principle 1's advisory
  channel is stated without contradiction

Tests: envelope no-leak + signals-parity + fan-in evidence + succession
auto-promote cases; execute_turn signature loses the packet parameter.
…; skill v3.9.3

- run loop: an open user gate pushes its decision report and KEEPS RUNNING
  the decision kernel's gate-independent fallback instead of breaking —
  'escalate, not freeze' (ARCHITECTURE.md 'Workers escalate'); fallback-less
  gates still stop, gated dependents stay frozen
- ARCHITECTURE.md/zh-CN: detached-run is a caller-side contract (never
  block on run); lifecycle state->surface mapping (PARKED/RETIRE are
  effects, not states)
- skills -> future-skills ea5b032 (v3.9.3): never-block rule + gate
  semantics corrections
- 'future loop run' now re-executes itself as a detached child (own process
  group on POSIX/Windows, log under <root>/detached/<goal>/, stdio rerouted)
  and the parent exits immediately printing the child pid — the orchestrating
  agent no longer needs nohup/& and can never accidentally block on a todo
  (ARCHITECTURE.md 'Runs are detached' becomes the enforced default rather
  than a caller-side convention). '--detach' marks the foreground child;
  'FUTURE_LOOP_NO_DETACH=1' opts out for tests/embedders; detach also skips
  when current_exe is not the CLI binary (test harnesses).
- parse_pairs: --detach/--force-workspace are value-less boolean flags
- run registry summary: 'requires --agent-id' was inaccurate (--anonymous
  exists); reworded
- verified against #451: floors/gauges thresholds, manual-complete verify
  bypass, push dedup, ui read-only, succession auto-promotion (now real),
  envelope signals/upstream-evidence — all consistent post-#455/#457
@huichen
huichen enabled auto-merge (squash) September 2, 2026 10:07
@huichen
huichen merged commit 6c68f46 into main Sep 2, 2026
12 checks passed
@huichen
huichen deleted the claude/loop-design-sync branch September 2, 2026 10:12
huichen added a commit that referenced this pull request Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant