feat(scripts): consolidate session-startup checks into a single script#74
feat(scripts): consolidate session-startup checks into a single script#74marcoaperez wants to merge 2 commits into
Conversation
agentic-fm
left a comment
There was a problem hiding this comment.
Thanks for this, @marcoaperez — I ran it and it works well: each check is isolated and fault-tolerant, the summary is clean, and it correctly degrades in a sandboxed/broken-git environment. I want it in.
One gap before merge. session_start.py's companion check hardcodes :8765 (it probes both http://127.0.0.1:8765 and http://local.hub:8765), so it breaks for anyone who runs the companion on a non-default port — and some users do change it. Right now there is no clean config the companion server reads for this: the port lives in a COMPANION_BIND_HOST env var + a --port argument + a hardcoded DEFAULT_PORT, while automation.json carries a separate top-level companion_url that isn't wired to any of it.
We are going to add a proper companion config in agent/config/ as the single source for the companion host/port. Could you update session_start.py to:
- accept an optional
--companion-url(or--port) argument, and - source the address from config — fall back to
automation.json's existingcompanion_url, then to:8765— instead of hardcoding the two URLs?
That makes the check correct for custom ports and forward-compatible with the config we are adding. Everything else looks good; happy to land it once the port is no longer hardcoded. 🙏
|
The canonical companion config this PR was waiting on has landed in acc480e — What changes for this PR: the session-start companion check should stop hardcoding
This unblocks the PR — please rebase onto acc480e, repoint the hardcoded probe, and add the |
|
@marcoaperez Simply point your agent at this PR if you're using |
AGENTS.md's "Session startup" section currently asks the agent to run four separate checks each session (git update, environment/sandbox detection, plug-in detection, PROJECT.md presence), each a separate round-trip before the first useful prompt. session_start.py runs all of them in one call, fault-tolerant (each check returns OK/WARN/FAIL/SKIP and a crash in one check never takes down the rest), with a compact one-line-per-check summary and a --json mode for programmatic use. Adds one more check not currently documented as part of startup: CONTEXT.json presence, age, and task description, so a stale or missing CONTEXT.json is flagged up front instead of surfacing later as a confusing missing-reference error. AGENTS.md gets an additive callout pointing at the script; the existing manual steps are left in place as the reference for what each check means and as a fallback when the script isn't available. stdlib only, no new dependencies. Co-Authored-By: Claude Opus 4.8 <[email protected]>
… chain Per maintainer review on acc480e (single-source companion.json config): session_start.py's companion check no longer probes hardcoded 127.0.0.1:8765 / local.hub:8765. It now reuses deploy.py's _resolve_companion_url()/_load_config() — the same client-reach resolution every other consumer follows — instead of re-deriving it, so all consumers agree on one address. Adds --companion-url and --port flags at the top of the chain (this script's own override, for pointing session_start at a non-default companion during diagnosis): --companion-url (full override) --port (keeps the resolved host, replaces just the port) ↓ COMPANION_URL env ↓ agent/config/companion.json (advertise_host + port) ↓ legacy automation.json companion_url ↓ built-in default Verified end-to-end against a live companion: default fallback, COMPANION_URL env override, and companion.json advertise_host+port all resolve correctly. Co-Authored-By: Claude Opus 4.8 <[email protected]>
d8557ed to
a03f205
Compare
AGENTS.md's "Session startup" section currently asks the agent to run four separate checks each session — git update, environment/sandbox detection, plug-in detection, PROJECT.md presence — each a separate round-trip before the first useful prompt.
What this adds
session_start.pyruns all of them in one call, fault-tolerant (each check returnsOK/WARN/FAIL/SKIPand a crash in one check never takes down the rest), with a compact one-line-per-check summary and a--jsonmode for programmatic use:Adds one more check not currently documented as part of startup: CONTEXT.json presence, age, and task description, so a stale or missing CONTEXT.json is flagged up front instead of surfacing later as a confusing missing-reference error.
AGENTS.mdgets an additive callout pointing at the script; the existing manual steps are left in place as the reference for what each check means and as a fallback when the script isn't available.stdlib only, no new dependencies.
Test plan
--jsonmode produces valid, well-shaped JSON--strictexits 1 only when a check FAILs (not on WARN/SKIP)