Commit Graph
52 Commits
Author SHA1 Message Date
weichen d5eab6f998 Record the owner's live acceptance confirmation in the contract
ci / svc-realcombo (pull_request) Successful in 1m58s
ci / test (pull_request) Successful in 5m6s
ci / test-pg (pull_request) Successful in 7m54s
Why: The login recovery contract reserved the owner browser login step
for the user (passwords never pass through the agent); the user
confirmed the test passed on 2026-10-13, closing the final acceptance
loop.

Evidence: User session confirmation 2026-10-13; deploy and prior
verifiable acceptance under receipt 5396054b.

Impact: Doc-only status update in the leftover section.

Refs: docs/svc-deploy/2026-10-13-login-recovery-contract.md.
2026-10-13 07:14:01 +00:00
weichen d518b3eab2 Close the login recovery contract leftovers in Dev
Why: The remaining open items (API-key SSE closure, cross-instance
redeem backoff, U7 atomic bootstrap/create, CLI credential delivery)
landed in Backend #192; Dev pins it and closes the contract leftovers.

Evidence: Backend #192 CI success at head bc1e0a3 (GATE); composite CI
on this PR re-runs the suite incl. test-pg (GATE).

Impact: backend pin cfb8308; contract leftover section now records all
items closed; task card H1-H6 requirement table.

Refs: Backend #192; docs/svc-deploy/2026-10-13-login-recovery-contract.md.
2026-10-13 06:07:57 +00:00
weichen 15861a0713 Wire login recovery follow-up: SSE close, browser e2e, proposal r3
ci / svc-realcombo (pull_request) Successful in 1m57s
ci / test-pg (pull_request) Failing after 2m29s
ci / test (pull_request) Failing after 3m32s
Why: The completion audit flagged four gaps over the merged login
recovery implementation: real-browser acceptance, the login-key e2e
spec, SSE stream invalidation, and the Documents write-back.

Evidence: Browser acceptance receipts be7ae9a2/b3a9e691 (SELF, bound to
Dev HEAD 268ef29); Backend #189 CI success at head 8b73afe (GATE);
Documents #94 merged; this PR's composite CI is the GATE for frontend
pin 44b9646.

Impact: Pins backend=349a47d (SSE close) and frontend=44b9646 (e2e
spec); contract doc leftovers updated; task card carries the follow-up
record for closure.

Refs: docs/svc-deploy/2026-10-13-login-recovery-contract.md; Documents
proposal r3; Backend #189; Frontend #77.
2026-10-13 04:38:16 +00:00
weichen 62ecdb694c Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=268ef2999ca2ff3481c6bebd588cae51d6b90709.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-13 04:10:38 +00:00
weichen f35c3bfdad Add login recovery contract and task card baseline
Why: The 2026-10-13 login flow plan requires a frozen contract record
(three adjudications against the r2 proposal) and a traceable task card
before implementation merges.

Evidence: doc-only commit; acceptance matrix cites backend/frontend test
files added in companion commits (SELF).

Impact: docs/svc-deploy/2026-10-13-login-recovery-contract.md becomes
the authoritative login-recovery contract; task card records user
authorization and requirement table L1-L9.

Refs: modules/documents/docs/proposals/2026-10-12-svc-unified-deploy-and-login-key.md r2
2026-10-13 03:43:49 +00:00
weichenandCursor 03c306af68 Record the U7 release-gate specs
Why: Second-instance writes stay closed until an independent replay or an admitted CI gate, plus a second host. Those remaining steps needed a durable spec.
Evidence: Task-card evidence rows read the merged PRs, tree equality, CI runs 2783/2810/2816, and Dev main branch protection. Source SELF. Drills were not run.
Impact: Docs and the task card only. Checklist grades stay SELF or not started. The collaboration proposal body stays r2.3.
Refs: docs/release-multi-instance.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 03:06:05 +00:00
weichenandCursor b35d9946bc Pin the merged artifact-store and plan commits
Why: Dev has to follow the commits that landed on Backend and Documents main, which share trees with the drilled objects.
Evidence: Backend dc736e339d01 tree 498f61947564 equals 46073d30. Documents 05c13a42b14d tree equals 5335499. GATE run 2794 on 6d8b746 succeeded before this pin.
Impact: gitlinks move to the merge commits. Second-instance writes stay closed.
Refs: #186 #92 #497
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 01:54:24 +00:00
weichenandCursor f7053f393b Record the K4 retest and pin the plan revision
Why: the restored drill passed artifact recovery, and the handbook, checklist, and collaboration plan have to say so without opening write traffic.
Evidence: backup-20261013-013354 on Dev a83588dd and backend 46073d30; K1-K7 true, RPO 65s, RTO 3s, five artifacts matched, cross-user access 404. SELF. Documents 5335499 is PR #92.
Impact: C5 is marked SELF-pass. Second-instance writes stay closed until REPLAY or CI and a second host exist.
Refs: docs/svc.md docs/release-multi-instance.md modules/documents
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 01:45:33 +00:00
weichenandCursor 6101e8c330 Document the B6, C4, and C5 drill results
Why: The measured backup, PITR, and disconnect steps were only in the drill scripts, and the checklist still said those rows were not run.
Evidence: Results pgbench-20261012-131948, fault-20261012-142734, and backup-20261012-153441 (SELF). K4 stays failed.
Impact: Second-instance write traffic stays closed. The handbook records the upload panic and the short socket path.
Refs: feature/u7-ops-drills
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 15:45:43 +00:00
weichen 9bbb72bd63 Merge pull request 'Add accounts help topic and pin durability plan docs' (#469) from feature/svc-account-durability-plan into main
ci / test-pg (push) Successful in 2m10s
ci / test (push) Successful in 4m10s
Reviewed-on: https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/469
2026-10-12 12:24:14 +00:00
weichen 8fbd9520ff Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=b4b042630a352eca2a399a7a64931c74978bca7f.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 12:14:05 +00:00
weichenandCursor bec1176692 Add accounts help topic and pin durability plan docs
ci / test-pg (pull_request) Successful in 1m47s
ci / test (pull_request) Successful in 3m50s
Why: make the six instance-bound user commands discoverable (T5-1) and pin Documents r2/r3.
Evidence: python3 -m unittest tests.test_svc_user_help; existing test_svc_user_binding still green.
Impact: scripts/svc.sh help accounts|user; docs/svc.md topic list; documents gitlink to plan branch tip.
Refs: Documents #87; feature/svc-account-durability-plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 12:13:54 +00:00
weichen 696a23a8ed Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=b4b042630a352eca2a399a7a64931c74978bca7f.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 12:07:36 +00:00
weichenandCursor 784954a52f Record U7 capacity SELF window and pin documents r2.1
Why: Ladder/60m/2h dual-instance contract windows passed; checklist
and planning progress must match measured SELF facts without claiming
GATE release.
Evidence: task-card make evidence for s2h verify; Documents #86
merge b8319d2; results dirs 20261012-064730/070510/081025.
Impact: B2/B3/B4/B5/B7/C2 marked SELF-pass; second-instance write
still blocked pending REPLAY/C3.
Refs: Documents #86; capacity report; feature/u7-capacity-wrap-measure

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 12:07:34 +00:00
weichen 9084e995e1 Save the final planning observations and review state
Why: preserve current source and service snapshots before final verification.

Evidence: SELF task-sync and read-only runtime receipts in the task card.

Impact: planning metadata only; no runtime or account changes.

Refs: account r2; recovery r3
2026-10-12 10:18:44 +00:00
weichen 8a29e40d0d Record the account and recovery plan review
Why: preserve evidence, current contracts and the next review scope without changing the running system.

Evidence: SELF startup, sync and document validation receipts in the task card; runtime and fault acceptance NOT_RUN.

Impact: task metadata, planning index and account specifications only; component pins and business code unchanged.

Refs: feature/svc-account-durability-plan; Documents account r2 and recovery r3
2026-10-12 10:10:29 +00:00
weichenandCursor 1032bb4bc9 Require RDM companion UI and source-switch gate in svc.sh
Why: RDM agent deploy left workbench htdocs unserved (prompt-only), so
environments like dev silently offered API-only 404 pages after a source
switch; static first-start also misclassified http.server as dead when
pidcheck was unset.
Evidence: CMD="make test-governance" make evidence (200 ok, 1 skipped; SELF).
Impact: rdm deploy auto-starts <name>web and asserts UI 200; cross-kind
redeploy needs --allow-source-switch; list/info flag missing workbench.
Refs: .task/feature-svc-rdm-ui-gate.md; docs/svc.md §5.4

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 08:00:35 +00:00
weichenandCursor 81b7d60be5 Document RDM combo cutover for audit capability
Why: After capability gate hid 追溯审计 on plain base, the shared dev
entry needs a pinned RDM combo and a candidate-then-cutover runbook.
Evidence: RDM #250 (310c3fe) pins to Dev main; candidate+cutover R1–R5
SELF receipts imported; FE preview showed audit entry on :8788.
Impact: docs/svc.md §5.4.1; local runtime/dev is rdm@310c3fe (ops, not
in git). Owner password was reset via recover key during verification.
Refs: feature/rdm-audit-combo-integration; RDM pulls/250

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 06:58:53 +00:00
weichenandCursor 060b152d38 Pin backend to origin/main after #175
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 05:44:44 +00:00
weichen ee7903344f Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=673e687c5c85b9af3ce13ca30845d5e68de5dfa0.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 05:27:29 +00:00
weichen 875a72b8af Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=673e687c5c85b9af3ce13ca30845d5e68de5dfa0.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 05:27:25 +00:00
weichenandCursor b6d57b9f8e Add B5 load seed tool and C2 dual-instance load entry
Why: U7 release checklist B5/C2 needed volume seed and dual-serve load wiring before capacity windows.
Evidence: tiny single/dual smoke (skip-k6) SSE p95≈4ms, dup_seq=0; seed COPY 1k msgs/chunks in ~30ms.
Impact: run_load.sh --seed/--instances; docs/release-multi-instance B5/C2 → ready; no backend product change.
Refs: docs/proposals/2026-10-11-collaboration-storage-and-distribution.md §3/§5 U7; docs/release-multi-instance.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 05:27:19 +00:00
weichenandCursor d0e29b7a22 Merge origin/main after #428; resolve docs/svc-deploy add/add
ci / test-pg (pull_request) Failing after 1m6s
ci / test (pull_request) Failing after 1m30s
Why: #428 landed the same svc-deploy specs; U1 branch still had parallel copies causing add/add conflicts.
Evidence: U1 docs kept branch「已启动」; U4 docs took main (#428) versions
Impact: PR #429 should become mergeable.
Refs: Dev pulls/429; merged #428
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 05:16:59 +00:00
weichenandCursor aef689f9e7 Note identity migration is v27 after login_keys took v26
ci / test-pg (pull_request) Failing after 1m23s
ci / test (pull_request) Successful in 3m9s
Why: Backend #170 rebased; design doc still said v26.
Evidence: local unittest identity+backup OK after task-sync.
Impact: docs/recovery/u1-identity-manifest.md §5.2 version note.
Refs: Backend PR #170; Dev PR #426
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 05:07:25 +00:00
weichen 904a8351c7 Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=b431777c9fa9c74f096d7f14fce40d1beba53fe2.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 05:06:11 +00:00
weichenandCursor 4713d5953c Merge origin/main into U1 account-binding; keep user+backup actions
Why: Dev #429 conflicted on scripts/svc.sh (U1 user vs main backup) and Backend gitlink.
Evidence: conflict hunks resolved; actions include init|user|backup|backups
Impact: PR #429 should become mergeable after push; both U1 binding and agent backup entrypoints preserved.
Refs: Dev pulls/429; main backup #417; Backend #171
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 05:06:09 +00:00
weichen a918d8c181 Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=b431777c9fa9c74f096d7f14fce40d1beba53fe2.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 05:04:14 +00:00
weichenandCursor bad29e09da Merge origin/main into recovery-u1-db-identity and retarget backend pin
ci / test-pg (pull_request) Successful in 1m38s
ci / test (pull_request) Successful in 3m7s
Why: task-sync hit a submodule conflict; pin must track Backend #170
HEAD after rebase onto main (copyOrder fix).
Evidence: backend 0c79618; origin/main merge completed in worktree.
Impact: modules/backend gitlink; sync with main.
Refs: Backend #170; Dev #426

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 04:04:47 +00:00
weichen 79f50493dd Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=ae465d24441ab349c961a55e9b04f8c4ccaf6de8.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 03:56:41 +00:00
weichen e83c60b21b Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=ae465d24441ab349c961a55e9b04f8c4ccaf6de8.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 03:55:34 +00:00
weichenandCursor 2a03dd58f9 Bind svc user CLI to instance storage and reject lock bypass
Why: U1 requires account ops to hit manifest data_root/DSN with OpenExisting and refuse missing flock or default ./data.
Evidence: python3 -m unittest tests.test_svc_user_binding (T1–T5) + test_svc_identity
Impact: svc <env> user … calls ENV_BIN with --open-existing; deploy/user fail closed without flock.
Refs: docs/svc-deploy/u1-instance-account-binding.md; Backend OpenExisting (PR #171)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 03:55:24 +00:00
weichenandCursor 33a6e046dc Bump Backend pin after U4 e2e gate alignment
Why: Backend #171 HEAD advanced with must_change e2e fix; keep Dev gitlink in sync and mark U4 specs started.
Evidence: Backend go test store/server/app green at 47463a9
Impact: Dev U4 branch tracks Backend PR #171 tip.
Refs: docs/svc-deploy/u4-one-time-login-key.md; Backend pulls/171
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 03:55:24 +00:00
weichenandCursor feccf26b90 Wire U1 I3 DB identity into svc start and tests
Why: after #415 file markers, startup must also bind
manifest.instance_id to agent_system_identity (I4).
Evidence: python3 -m unittest tests.test_svc_identity
tests.test_svc_recover (OK, 1 skipped NOT_RUN for real PG);
Backend pin b92eaca (PR #170).
Impact: svc ensure/verify + AGENT_SYSTEM_* env; stub identity;
I3 SQLite tests; design doc status; modules/backend gitlink.
Refs: docs/recovery/u1-identity-manifest.md §5.2; Backend #170

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 03:52:48 +00:00
weichen 8abebff33f Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=3e4a79e4133202b537c888a8beeb7c10d82595f4.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 03:48:54 +00:00
weichenandCursor dba8508807 Pin Backend U4 login-key implementation and record specs
Why: wire Dev to the Backend feature that delivers OpenExisting and
one-time login keys for the approved deploy proposal.
Evidence: SELF Backend tests; gitlink 1ba7225.
Impact: Backend gitlink + docs; runtime via new binary.
Refs: .task/feature-svc-deploy-u4-login-key.md

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 03:44:26 +00:00
weichen 67da726e7f Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=af9c2de663be5ff102dcab7698464a645832f569.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 03:29:59 +00:00
weichen d41b3ef7b0 Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=af9c2de663be5ff102dcab7698464a645832f569.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 03:28:34 +00:00
weichen 3ca4f3bc35 Add svc.sh agent data-dir snapshots with SQLite-consistent backup
Why: the 2026-10-11 runtime/ deletion lost all agent SQLite data with no
backup; the svc-autorecover closing report left "agent SQLite backup" as
a follow-up and the user asked to land it (recovery plan U2 residue).
Evidence: tests/test_svc_backup.py 11/11 green locally (live WAL writer,
manifest sha, retention, guards); make test-governance full suite green
(159 tests, rerun twice after one unreproduced flake).
Impact: new service-level actions backup/backups; snapshots live in
runtime-backups/<name>/ outside runtime/; rm --purge removes them; pg
backup and other flows unchanged.
Refs: modules/documents/docs/proposals/2026-10-12-service-restart-data-recovery.md r2 (sec 6, U2 residue); task card .task/feature-svc-agent-backup.md.
2026-10-12 03:06:04 +00:00
weichen c170939bb7 Implement the U1 identity manifest layer with startup verification and tests
Why: approved design (2026-10-12) - persistent manifest becomes the startup authority, closing the param-rebuild drift, non-atomic per-key writes, and missing-config-creates-empty-system recovery gaps (plan r2 U1 / KTD1-KTD2).

Evidence: SELF - python3 tests/test_svc_identity.py 21 tests OK (1 skip = real-PG identity NOT_RUN by design); make test-governance 169 OK incl. existing svc db-binding and autorecover suites; receipts appended via make evidence.

Impact: scripts/svc.sh gains manifest-aware set/del/record_state/autostart plus lock-held migrate, pre-launch identity verify and an init action; new scripts/svc_manifest.py (atomic temp-fsync-rename, identity anchors, derived svc.env); unmigrated instances keep the exact legacy path (regressions green).

Refs: docs/recovery/u1-identity-manifest.md; plan r2 section 7 U1
2026-10-12 02:50:32 +00:00
weichen f705f99b8f Add U7 two-process acceptance, k6 load harness and release checklist
Why: collaboration storage U7 (proposal sections 3/5/7) requires two-process
HTTP-level acceptance over shared PG, a reproducible load-test entry honoring
the load contract, and an auditable pre-release checklist; capacity windows and
dual-host runs need user-scheduled resources, so the deliverable here is the
verifiable entry, not capacity claims.
Evidence: make test green (composite); make test-multi-instance green locally
against an isolated PG (five scenarios incl. crash-takeover and restart
invariants); run_load.sh --profile smoke end-to-end green (SSE probe p95~18ms,
zero seq duplicates, stack auto-recycled); backend pinned to feature branch
with the three cross-instance fixes.
Impact: new tests/integration/multi-instance (CI test-pg job step), new
tests/load/collaboration (k6 + SSE probe + run_load.sh), release checklist at
docs/release-multi-instance.md; no runtime behavior change in Dev repo itself.
Refs: backend PR #164; task card feature/u7-load-fault-release.
2026-10-12 02:31:35 +00:00
weichen c43ccd7481 Draft the U1 identity manifest contract, data ownership inventory and card
Why: U1 starts per the approved recovery plan r2 - a reviewed design contract must exist before touching scripts/svc.sh, and R3 needs an enumerable data-ownership baseline.

Evidence: SELF - doc-check receipt via make evidence. First run FAILED (exit 1: proposal r2 not present in this worktree because it sits unmerged on feature/service-restart-recovery-plan); references reworded to cite the path with a pending-merge note and the check re-run PASS (exit 0). Both receipts are in the card; grounding facts verified at baseline 89174a0.

Impact: docs/recovery/ additions and task card only; no behavior change; implementation gated on design review.

Refs: modules/documents/docs/proposals/2026-10-12-service-restart-data-recovery.md r2 U1
2026-10-12 01:39:20 +00:00
weichen c514bc4f4d Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=3de5791e0841e9c7c40c3dc236be6d95b3969827.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-11 21:56:13 +00:00
weichen 419380187d Add an rdm deploy source to svc (downstream composite binary)
Why: RDM capabilities (two-trees-one-net, rdm.* trace-audit command face)
only exist in the downstream Agent-System-RDM composite binary; svc's three
existing sources all produce the Dev binary, so none of it could be deployed
or lifecycle-managed. This adds --from rdm[@<sha>] with the same isolated
source-repo semantics as the dev source.

Evidence: make test-governance 138/138 (two new stub cases: deploy E2E and
commits/update track); real deployment rdm@2aef3fc recorded in the task card
(pins materialized, pure-Go build, web workbench to htdocs, serve health OK,
rdm.ping/rdm.inspect.capabilities committed, update --check reports latest);
make test full suite exit=0. All segments written by make evidence.

Impact: scripts/svc.sh (rdm source resolution/materialization/deploy/update/
commits, probe timeouts, rdm seed skip, ELF env-DSN evidence fallback),
docs/svc.md 5.4, tests/test_svc.py. RDM-side CLI alignment landed as RDM
PR #228; no base submodules touched.

Refs: task card .task/feature-svc-rdm-source.md; RDM PR #228/#229.
2026-10-11 20:46:03 +00:00
weichen eda942523c Add svc auto-recovery: autostart desired-state, recover, watchdog
Why: svc services are bare nohup'd processes with persisted registration
but no supervision -- a crash, an OOM kill, or a reboot left them dead
until manual restart (2026-10-11 outage: dev service lost, runtime/ also
wiped by hand, nothing brought services back).

Evidence: tests/test_svc_recover.py 10 cases green (start records
autostart, stop clears it incl. dead-process stop, SIGKILL then recover
revives with persisted exec=, lock-held skips, port-stolen fails with
recover fail event, watchdog unit text via --print); make test-governance
146/146 OK locally; real-machine watchdog install + kill -9 revival to be
recorded on the task card.

Impact: svc.sh gains autostart key in svc.env, `recover [name]
[--quiet]` (postgres-first, per-service .start.lock, recover history
events), `watchdog install|remove|status` (systemd user timer, cron
fallback hint), lifecycle lock across start/stop/restart/deploy/update;
spawned services no longer inherit the lock fd (9>&-), and lock release
no longer clobbers script stderr. Makefile adds svc-recover/svc-watchdog;
docs/svc.md documents semantics and boundaries.

Refs: task card .task/feature-svc-autorecover.md; docs/svc.md 6.5/6.6;
parallel planning card feature/service-restart-recovery-plan (same
problem space, plan-stage).
2026-10-11 20:20:27 +00:00
weichen 3b8fef7fad Recover svc.sh database config across restarts and refuse on invalid binding
Why: the exec= reuse path stripped --dsn into the process environment (G1-7)
and record_state then persisted a DSN-less exec=, while the dbref fallback only
existed in the explicit-rebuild branch - the second bare restart after a
rebind silently dropped the database (SQLite fallback on loopback). Auth
preflight also matched --dsn on the command line only, so env-delivered DSN
with auth=auto was misjudged as unauthenticated.
Evidence: bash -n OK; make test-governance 115 tests OK (new tests/test_svc.py
11 cases; 10/11 fail against the pre-fix script); make test green; make build
OK; isolated real PostgreSQL 18.6 + real binary validation 27/27 (consecutive
restarts/deploy keep binding, psql-verified database identity, DB-down restart
fails without SQLite fallback or config loss, no credential leakage) - all
recorded via make evidence in the task card.
Impact: svc.env gains db=/dbref=/dsn= recovery keys (atomic 0600 writes);
start/restart/deploy/update/db share one resolver; invalid bindings, config
conflicts, mock coexistence and env-DSN-incapable binaries now refuse to
start instead of silently downgrading; legacy exec= DSN migrates idempotently;
docs/svc.md and script help updated.
Refs: task card .task/feature-svc-db-config-recover.md; user-approved plan
(2026-10-11 session message); AGENTS.md evidence gates.
2026-10-11 09:16:54 +00:00
weichenandCursor f8e06090e6 Pin the SillyTavern borrow across the linked repositories
Why: The research record, HTML cleaning, listen guard, secret store, and context controls land together, and the parent pointers have to name those commits.
Evidence: Child commits are core bd63223, agent-native 3a110a7, ui d76a8e6, frontend 36b92ed, documents f3f823e, backend 42cca8f. svc.sh forwards the listen switches and info prints them.
Impact: A reverse proxy or a LAN hostname needs allowedHosts or an unauthenticated host check returns 403. Startup moves raw API keys into the secret table after a settings snapshot.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-04 18:21:17 +00:00
weichen ecfed7be31 Add service config-file switching with schema validation to svc.sh
Why: beyond database binding, services needed a way to switch the JSON config
file they run with and have the new config take effect promptly; hand-editing
exec= risks restarting a service into an invalid config.

Evidence: in the task worktree with a real agent binary -- a config with an
unknown key is rejected by the binary's strict schema check before any state
change; a valid file binds via --config in exec= + conffile= (survives
record_state rewrites), restarts the running service, and the config's dsn
verifiably drives the process (wrong-password variant failed PG auth in the
log; correct variant connected and created 21 tables); editing the file and
re-running 'config <same file>' re-validates and restarts (pid changes);
'--clear' removes both the flag and conffile; db and config coexist in exec=;
view mode shows masked JSON content plus 'config explain' effective values
with masked dsn; list DB column also resolves dsns that live only inside the
config file. Full log in the task card.

Impact: new service-level action 'svc.sh <name> config [file | --clear]
[--no-restart]' for agent services; config-file content snapshots (masked,
--reveal to show) in info; a config-file line in status; conffile persisted
in svc.env. No agent binary changes.

Refs: task card .task/feature-svc-db-bind.md (same doc as PR #182);
docs/svc.md sections 2/4.5/4.6/6/10.1
2026-10-04 13:42:51 +00:00
weichen 843495e0d0 Add per-service database binding and fix single-dash flag detection in svc.sh
Why: info showed services and postgres instances but no service-to-database
correspondence, and switching an agent service to another database required
redeploying with a hand-built DSN. While wiring this up, adjust_args_for_bin
was found matching Go flag help with '--dsn' although Go prints '-dsn', so
deploy-built --dsn/--auth args were silently dropped on current binaries.

Evidence: full E2E in the task worktree with a real agent binary and a real
PostgreSQL 18 instance -- 't-app db bpg' persisted exec=/dbref, auto-restarted
(dbref survives record_state rewrites), and the agent created 21 tables in the
bound database; 'db bpg --db t2' auto-created and switched databases (21
tables in t2); '--clear' returned the service to embedded SQLite; --no-restart
and error paths behave; list gains a DB column, status a database line, info a
reverse bound-services line; legacy deployments without dbref resolve by DSN
host:port; single-dash detection proven with positive and negative cases;
regressions list/db dsn/db ls/info/history/--help pass; make test exit 0.
Full log in the task card.

Impact: new service-level action 'svc.sh <name> db [pg [--db X] | --clear]
[--no-restart]' for agent services (bind/switch/unbind/view), DB column in
list, binding lines in status/info, dbref persisted in svc.env, auto database
creation when the instance runs, and the adjust_args_for_bin fix restoring
deploy --dsn/--auth on current binaries. No agent binary changes.

Refs: task card .task/feature-svc-db-bind.md (same doc as the PR); docs/svc.md
sections 4.5/6.1/6.2/10.1
2026-10-04 13:30:50 +00:00
weichen 106ef07ef0 Add read-only svc.sh info report for services, databases, and config snapshots
Why: svc.sh could show a service table (list), per-instance DB names one at a
time (db ls), and per-service status, but had no single view answering "what
is running, which databases exist, and what is configured" -- the questions
asked when inspecting or handing over a machine.

Evidence: exercised in the task worktree runtime -- empty-state report; fake
agent/static/postgres registrations proving masking (exec DSN password,
password=, SVC_TAVILY_KEYS -> ***, non-secret values verbatim; --reveal shows
plaintext); a real postgres instance (db create r-pg --port 18901, start,
extra orders db, one backup) whose info section lists inner databases with
sizes, pgdata size and backup stats; regressions list/history/--help/help
lifecycle/make svc-info; info stdout carries the full report (stderr 0 bytes)
so it can be redirected as a snapshot. Full log in the task card.

Impact: new read-only `scripts/svc.sh info [name] [--tag T] [--reveal]`
command (also `make svc-info`): service table + running summary, postgres
instances incl. inner databases, per-service svc.env content snapshots plus
global .svc.env / --config / exported SVC_* vars, and recent events. Secrets
are masked by default. No deploy/lifecycle/db-ops behavior changes; `info`
becomes a reserved service name; docs/svc.md gains section 6.2 (former
6.2-6.4 shifted to 6.3-6.5).

Refs: task card .task/feature-svc-info.md (same doc as the PR); docs/svc.md
2026-10-04 12:42:49 +00:00
weichen a42fff69e4 Deploy svc updates from an isolated remote source clone
Why: svc.sh update skipped services with a local@<sha> source whenever the
main checkout was dirty, and bare deploy built the current workspace. The
owner requires updates/deploys to be independent of the working tree
state, defaulting to the latest remote commit built outside the checkout.

Evidence: bash -n passes; commits dev lists from the source clone; bare
deploy --dry-run plans dev@<origin/main>; end-to-end "svc.sh update
svc-selftest" with a dirty tree updated a local@d64742c service to
dev@0be23f9 (built in runtime/.worktrees from
~/.cache/agent-system-svc/src, started healthy), then stopped and purged.
Full make test output recorded on the task card.

Impact: deploy now defaults to dev@<origin/main> resolved in the
script-owned clone (SVC_SRC_DIR, default ~/.cache/agent-system-svc/src);
--from local stays the only workspace-dependent source; update no longer
pulls the main checkout - local@/dev@ services redeploy from remote
latest, ahead/diverged/missing-on-remote still decline to act.
docs/svc.md and in-script help updated to match.

Refs: .task/svc-remote-source.md
2026-09-30 18:39:25 +00:00