Skip to content

Land verified WI-4942 dispatcher release chain - #44

Open
mike-remakerdigital wants to merge 9 commits into
mainfrom
codex/dispatcher-release-chain-main-20260701
Open

Land verified WI-4942 dispatcher release chain#44
mike-remakerdigital wants to merge 9 commits into
mainfrom
codex/dispatcher-release-chain-main-20260701

Conversation

@mike-remakerdigital

Copy link
Copy Markdown
Contributor

Summary

  • Land the clean dispatcher release-health dependency chain ending at WI-4942 dispatcher drain live-worker parity.
  • Include only the verified predecessor chain needed for WI-4942: dispatch report/config transactions, reset-drain, stale dispatch-run pruning, release-readiness hardening, Cursor bridge route repair, and WI-4942 bridge evidence.
  • Supersede the broad research-branch approach by excluding WI-4944 and later unresolved daemon/runtime/topology work.

Verification

  • python -m pytest groundtruth-kb/tests/test_bridge_dispatch_reset.py platform_tests/scripts/test_bridge_dispatch_config.py platform_tests/groundtruth_kb/cli/test_bridge_config_cli.py -q --tb=short
    • 21 passed, 1 warning
  • Broader dispatcher/dashboard/wiki-adjacent lane:
    • 189 passed, 1 warning
  • scripts/update_wiki_pages.py compare --project-root ... --wiki-dir .tmp/groundtruth-kb.wiki --json
    • drift_count=0; Release-Health.md current
  • scripts/gtkb_dashboard/refresh_dashboard_db.py --db-path .tmp/gtkb-dashboard-health-full.sqlite --project-root ...
    • completed successfully; dashboard DB latest refresh status completed

Notes

  • This PR intentionally avoids the over-broad research approach and does not include WI-4944 or later unresolved daemon/runtime/topology changes.
  • git diff --check origin/main..HEAD reports CRLF/trailing-whitespace noise in committed cherry-picked files; the branch is otherwise clean and functionally verified.

mike-remakerdigital and others added 9 commits June 30, 2026 17:42
soft_reset now prunes stale/orphaned dispatch-runs sidecars (workers with
an exit_code present, or dead/unparseable PIDs) so the live-worker count
is accurate after a soft reset and cannot spuriously saturate the per-cycle
LO ceiling. Genuinely-live workers (PID alive, no exit_code) are preserved
- a soft reset must not drop a live worker. Adds DISPATCH_RUNS_DIR_NAME,
_dispatch_run_pid_alive (local liveness probe, preserving module dep
direction), _prune_stale_dispatch_runs, and ResetResult.stale_dispatch_runs_pruned.
Purely additive; hard_reset inherits via soft_reset. 4 spec-derived tests
pass; ruff check + format clean.

Bundles proposal -001, Cursor GO -002, report -003.

Project: PROJECT-GTKB-DISPATCHER-RELIABILITY / WI-4861
PAUTH: PAUTH-PROJECT-GTKB-DISPATCHER-RELIABILITY-DAEMON-RESIDUE-CLEANUP-2026-06-27
DELIB-20266268 (owner AUQ S20260627)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 174e8c5f15

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +145 to +148
with contextlib.suppress(Exception):
import signal

os.killpg(os.getpgid(pid_int), signal.SIGKILL)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid killing the inherited process group

On POSIX, a drain timeout calls os.killpg(os.getpgid(pid_int), SIGKILL) for a dispatched worker, but the trigger launches workers without creating a new session/process group on non-Windows, so the wrapper inherits the caller's process group. In that environment, draining one stuck worker can SIGKILL unrelated processes in the same group, including the invoking shell/harness, rather than just the worker tree; use a PID-scoped tree kill or ensure dispatched workers are started in their own process group before using killpg.

Useful? React with 👍 / 👎.

Comment on lines +2835 to +2847
pid_create_time = _pid_create_time_epoch(process.pid)
meta.update({"launched": True, "pid": process.pid})
if pid_create_time is not None:
meta[PID_CREATE_TIME_META_KEY] = pid_create_time
# WI-4472: live-process accounting sidecar. Written only for a
# successful launch; consumed by _count_live_dispatched_processes.
try:
(runs_dir / f"{dispatch_id}.pid").write_text(str(process.pid), encoding="utf-8")
if pid_create_time is not None:
(runs_dir / f"{dispatch_id}{PID_CREATE_TIME_SUFFIX}").write_text(
f"{pid_create_time:.6f}",
encoding="utf-8",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Declare psutil before requiring PID provenance

In environments without psutil installed (it is not declared in groundtruth-kb/pyproject.toml or the test requirements), _pid_create_time_epoch() returns None here, so successful launches omit the .create_time_epoch sidecar. The new live-worker accounting and drain paths now require that sidecar to count or terminate a worker, which means fresh dispatches are immediately treated as non-live/stale and the concurrency cap/drain protection is effectively disabled on clean installs.

Useful? React with 👍 / 👎.

try:
if tmp.exists():
tmp.unlink()
except OSError:
Comment thread scripts/cursor_harness.py
json.dumps(list(merged.values()), sort_keys=True),
encoding="utf-8",
)
except OSError:
import pytest
from click.testing import CliRunner

import groundtruth_kb.bridge_dispatch_reset as reset_module
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

🧪 Test & Coverage Report

Coverage

Metric Value
Tests 0
Failures 0
Coverage 76.8%
Statements 40058
Missed lines 9285

Lowest Coverage

Module Cover
agents/containers/analytics_collector_app.py 0%
agents/containers/co_pilot_app.py 0%
agents/containers/critic_supervisor_app.py 0%
agents/containers/escalation_handler_app.py 0%
agents/containers/intent_classifier_app.py 0%

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