#!/usr/bin/env bash # Seed the LangGraph store after a (re)start. # # The stock `langgraph dev` server uses an IN-MEMORY store, so anything written # to it (team model settings, user mappings) is lost on every restart. This # script idempotently re-PUTs that state and is wired as a systemd # ExecStartPost on the open-swe.service unit so it runs after each start. # # Replace this with Postgres-backed durability (Aegra / `langgraph up`) to make # the store survive restarts and drop this script. # # Configuration comes from the environment (set these in the service env or a # sourced file alongside the app .env) — no real values are committed here: # OPENSWE_BASE_URL default http://127.0.0.1:2024 # OPENSWE_AGENT_MODEL default anthropic:claude-opus-4-8 # OPENSWE_AGENT_EFFORT default high # OPENSWE_REVIEWER_MODEL default openai:gpt-5.5 # OPENSWE_REVIEWER_EFFORT default high # OPENSWE_DEFAULT_REPO e.g. your-org/your-pilot-repo (required) # OPENSWE_OWNER_LOGIN GitHub login of the triggering owner (required) # OPENSWE_OWNER_EMAIL work email mapped to that login (required) set -euo pipefail BASE="${OPENSWE_BASE_URL:-http://127.0.0.1:2024}" AGENT_MODEL="${OPENSWE_AGENT_MODEL:-anthropic:claude-opus-4-8}" AGENT_EFFORT="${OPENSWE_AGENT_EFFORT:-high}" REVIEWER_MODEL="${OPENSWE_REVIEWER_MODEL:-openai:gpt-5.5}" REVIEWER_EFFORT="${OPENSWE_REVIEWER_EFFORT:-high}" DEFAULT_REPO="${OPENSWE_DEFAULT_REPO:?set OPENSWE_DEFAULT_REPO=owner/repo}" OWNER_LOGIN="${OPENSWE_OWNER_LOGIN:?set OPENSWE_OWNER_LOGIN=github-login}" OWNER_EMAIL="${OPENSWE_OWNER_EMAIL:?set OPENSWE_OWNER_EMAIL=work-email}" NOW="$(date -u +%Y-%m-%dT%H:%M:%S+00:00)" # Wait for the server to accept requests (up to ~60s). for _ in $(seq 1 30); do [ "$(curl -s -o /dev/null -w '%{http_code}' "$BASE/ok" || true)" = "200" ] && break sleep 2 done # 1) team_settings/default — builder + reviewer models (NOT read from env by the # app; the store value wins over LLM_MODEL_ID). gpt-4.1 is NOT in this fork's # SUPPORTED_MODELS, so the reviewer uses gpt-5.5 (cross-family vs the builder). curl -s -X PUT "$BASE/store/items" -H "Content-Type: application/json" -d @- < — required, or the @openswe trigger ignores the commenter. curl -s -X PUT "$BASE/store/items" -H "Content-Type: application/json" -d @- <