Commit Graph
74 Commits
Author SHA1 Message Date
agent-exec-transport 8e7e3c9c22 agent-exec transport 0699ed700085214566f19101dc7dab32/f6013519841f 2026-10-20 02:20:36 +00:00
agent-exec-transport a731ef54a3 agent-exec transport 51708f296381a61509ea5f53aa51269b/b4647884f68f 2026-10-19 04:46:49 +00:00
weichen 77fa120827 Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=d9ac28f89159e17781e2a8ef3094965130f29d2f.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-19 01:39:07 +00:00
weichenandCursor 9c7fa2730e Keep service start from downloading the Python base layer
ci / svc-realcombo (pull_request) Successful in 2m2s
ci / test (pull_request) Successful in 5m49s
ci / test-pg (pull_request) Successful in 8m54s
Why: env ensure downloads an interpreter and wheels. The real-combination start test allows 120 seconds, and that download made rc1 start time out.
Evidence: CI job 5184 timed out in test_U3_real_agent_identity_lifecycle_sqlite on scripts/svc.sh rc1 start.
Impact: Start only mounts a base layer that already exists. The first build is an explicit env ensure, run outside start.
Refs: Agent-System-Dev pull 570
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 14:14:48 +00:00
weichenandCursor 3d6de0c4ac Wire the layered Python environment into service startup
Why: The dependency layer already existed in the backend, but service startup never passed it, so the sandbox could not import the packages the host already had.
Evidence: SELF go tests recorded on the backend commit. svc.sh only exports the env root after env ensure leaves a current base layer, and a failed download does not block startup.
Impact: Instances share runtime/envs. Existing exec= lines are left as stored. Proposal, backend, and frontend gitlinks move to this branch.
Refs: .task/feature-layered-python-env.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 13:53:00 +00:00
weichenandCursor 265bcdcbba Warn when a seeded model key does not become active
Why: Settings plaintext loses to secret_keys, so replacing the env key did not change the key a conversation actually sent.
Evidence: python3 -m unittest tests.test_svc.SvcDbRecoveryTests.test_seed_replaces_old_system_secret tests.test_svc.SvcDbRecoveryTests.test_seed_warns_when_old_secret_stays_active tests.test_svc.SvcDbRecoveryTests.test_seed_puts_without_credentials_when_auth_off (SELF).
Impact: Embedded databases now compare the active system secret fingerprint after seeding, and the backend gitlink carries the adoption fix.
Refs: fix/model-key-secret-overlay
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 10:33:28 +00:00
weichenandCursor 196d6f3cfd Merge authoritative main into the task branch
Why: include the current integration baseline before verification.
Evidence: fetched origin/main=692735e91d6a9ab07ddd3686feb60a56b270728a.
Impact: integrate upstream changes without rewriting task history.
Refs: task-sync
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 05:55:51 +00:00
weichenandCursor 8e5b44bc2c Seed the four-model setup on later service starts
Why: The dev service is an rdm build, so startup skipped model seeding and kept the old MiniMax chat model. Later starts need the saved env file applied even without an admin key command.

Evidence: seed and rdm launcher tests passed. The live dev database now uses the four-model chat route and keeps the original MiniMax endpoint as reserve.

Impact: Restart of a service with envfile set rewrites system model settings. HTTP seeding is unchanged for builds that can mint an admin key. MiniMax is stored separately because fallbacks cannot switch gateways.

Refs: .task/feature-four-model-vision.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 04:14:22 +00:00
weichenandCursor 1a5afe219d Point the service at four-model vision routing
Why: Chat, lightweight, fallback and vision settings need a seed path, and the backend now sends current-turn images only to models declared capable of seeing them.

Evidence: The backend change is cfde38d. The seed test covers fallback and vision settings. A local image conversation on each builtin profile returned the pictured content from the expected model, and removing the chat model from the capable list switched that turn to the vision model.

Impact: New runs can use the four builtin profiles and image input. Secrets stay in the ignored env file. The live 8788 process is unchanged.

Refs: .task/feature-four-model-vision.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-14 17:51:29 +00:00
weichenandCursor 1cf2f533f7 Compile selected plugins into the svc deploy binary
Why: deploy needs to choose registered plugins and ship them inside one agent-system, then refuse the release when they are not active.
Evidence: python3 -m unittest tests.test_svc_plugins tests.test_svc_user_help tests.test_svc tests.test_svc_u2 (SELF, 63 passed, 1 skipped). Real compose build and make test-lifecycle are NOT_RUN.
Impact: --with is mutually exclusive with --from rdm and --from release. Existing non-interactive deploys stay without plugins unless plugins= is already recorded. Changing the plugin id set on a live service requires --allow-source-switch.
Refs: .task/feature-svc-plugin-compose.md modules/documents/docs/proposals/2026-10-14-svc-plugin-compose-deploy.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-14 16:08:13 +00:00
weichen 1d42933aa1 Record U3 implementation candidate and close obsolete account help
Why: Operators need the approved no-password initialization and owner-confirmed recovery contract, and stage 6 reviewers need an exact component/evidence map.

Evidence: SELF task-card precheck and make test-governance receipts; component receipts listed in the task card with separate source identities.

Impact: svc rejects obsolete credential commands before storage binding, help points to protected delivery and recovery proposals, and the task card records stage 6 scope with formal pin/CI dependencies still pending.

Refs: IAM U3 r1 Documents c236d309; Backend 3e01614; RDM 265d33e; Frontend a961b19
2026-10-14 05:05:21 +00:00
weichen 68cb9eb76e Merge origin/main into feature/rdm-increment-settings-duties 2026-10-13 05:20:58 +00:00
weichen e35b210dbf Seed via system settings and fix multi-instance mock toggle
ci / test (pull_request) Successful in 5m25s
ci / svc-realcombo (pull_request) Successful in 2m30s
ci / test-pg (pull_request) Failing after 2m27s
Why: P2 受管落地后的两处消费面适配——svc 播种内容(models/tavily)全为系统受管项须走系统管理面;两进程验收的 runtime.mock 开关同理由 user 层迁至系统面(无认证档本机即管理员)。
Evidence: bash -n 通过;受管拦截与系统面行为由 Backend PR #188 测试覆盖(已合入 76c75ce5);multi-instance 于 CI test-pg 档验证。
Impact: svc 认证档播种改为仅 admin(无管理员明确跳过);验收脚本断言语义不变。
Refs: modules/documents/docs/proposals/2026-10-13-rdm-settings-members-duties-perms-increment.md P2
2026-10-13 04:46:53 +00:00
weichenandCursor 7331323df4 Give pin materialize the CI git channel and a private database
Why: test-pg has no SSH known_hosts, and the shared agent_test database already holds another instance identity.
Evidence: SELF python3 -m unittest tests.test_ci_credentials.CheckoutTests.test_rdm_pin_fetch_is_three_shas_on_the_allowlist tests.integration.lifecycle.test_lifecycle_real (1 pass, 24 skip).
Impact: lifecycle children forward GIT_CONFIG_* only; serve stays env -i. Login and rdm.ping stay NOT_RUN.
Refs: .task/feature-svc-d3-real-scenarios.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 04:03:55 +00:00
weichen c1e82872ff Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=3fb8210f6495a78e70a67af3661bdfe9c00fb9de.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-13 03:04:15 +00:00
weichenandCursor f0e1e3f254 Add real mixed-batch, manifest-loss, and PG cross-bind tests
Why: A static dev deploy deleted the worktree before copying dist, so a mixed batch could not update the workbench. Missing manifests and a second instance on the same Postgres database must fail closed the same way on real artifacts.
Evidence: SELF unittest of the mixed batch, the three-entry manifest-loss case, and the PG cross-instance case exited 0. The PG case used a temporary cluster.
Impact: static dev deploys copy dist before recycling the worktree. Login and rdm.ping stay NOT_RUN.
Refs: tests/integration/lifecycle/test_lifecycle_real.py
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 02:54:05 +00:00
weichen d1a7de09dd Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=5aebedebeb963b5c01f39fd9122ec60dbe6d34d3.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-13 01:42:28 +00:00
weichen 7719e807b8 Add svc.sh rdm-admin ledger inspection and trusted transfer
Why: U7 acceptance bootstrapped u7-admin into the shared dev runtime's
singleton rdm_admins ledger, locking the operator out of RDM admin pages
(rdm.role.list 400); recovery required forensics. KTD4 keeps base isAdmin
to audit-view only, so an operator-side trusted channel is needed.
Evidence: python3 -m unittest tests.test_svc_rdm_admin -v (25 OK, SELF);
live smoke on runtime/dev: show/status/typo-guard outputs verified.
Impact: new svc.sh <env> rdm-admin [show|transfer --to x] command, help
topic, status ledger line with stale-owner warning; no behavior change
for existing commands.
Refs: task card .task/feature-rdm-admin-lockout-recovery.md R1/R2
2026-10-13 01:27:26 +00:00
weichenandCursor 67d6fd81cd Require the real lifecycle gate and fault rollback
ci / svc-realcombo (pull_request) Successful in 1m45s
ci / test-pg (pull_request) Successful in 2m53s
ci / test (pull_request) Successful in 4m45s
Why: The live deploy journal never called fault injection, and test-lifecycle failed closed on login so CI could not require the real combination cases.
Evidence: SELF python3 -m unittest tests.test_svc_u2.U2ReleaseTests -q exit 0 (35 ok, 1 skipped) on 3602a87; receipt sha256 9b5785577751e8e9e7947cf9700fb8854b1c80142f34273ae25f3097ee4c9aa8.
Impact: test-pg builds the Dev binary and runs make test-lifecycle. Login and full-track deploy without SVC_RDM_ORIGIN stay NOT_RUN. No live data move and no account CLI.
Refs: recovery plan D2/D3; Dev #485
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-13 01:14:27 +00:00
weichen e7b969a905 Retain existing-store lifecycle tests during main synchronization
Why: Main D1 now shares the same explicit fixture initialization contract.

Evidence: Both real SQLite and temporary PostgreSQL initialization paths
were independently replayed; capabilities JSON assertions are preserved.

Impact: Resolve duplicate PG setup through the tested helper; preserve
all main lifecycle changes and the rollback directory protection.

Refs: Dev #483/#485; D1 existing-store identity contract
2026-10-12 15:57:05 +00:00
weichenandCursor 0a56150d01 Pass the exec-tool kill switch into the clean serve process
ci / svc-realcombo (pull_request) Successful in 1m42s
ci / test-pg (pull_request) Failing after 3m21s
ci / test (pull_request) Successful in 4m16s
Why: env -i dropped RDM_DISABLE_EXEC_TOOLS, so the real RDM binary exited immediately on runners without bwrap, and the capability probe now prints the JSON document.
Evidence: SELF bash -n scripts/svc.sh; python3 -m py_compile tests/test_svc_realcombo.py. GATE run 2656 job 3831 failed on the previous head before this fix.
Impact: serve and the lifecycle child forward that one switch; identity capabilities is checked as protocol 1 JSON.
Refs: #485
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 15:31:27 +00:00
weichenandCursor b10406a58f Merge origin/main into feature/svc-d1-identity-flow
ci / svc-realcombo (pull_request) Failing after 1m55s
ci / test (pull_request) Failing after 2m49s
ci / test-pg (pull_request) Failing after 4m9s
Why: main gained the real-combination CI gate after the previous sync, and this branch still has to carry that gate with the isolated identity calls.
Evidence: SELF python3 -m unittest recovery/identity/u2/deploy/pin/isolation — 100 tests OK (2 skipped); bash -n scripts/svc.sh.
Impact: identity ensure/verify still pass DSN only through the environment; stop waits for the port and can keep the desired state. CI keeps the lifecycle pin step and the svc-realcombo job.
Refs: #485
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 15:26:57 +00:00
weichenandCursor 797d3248f0 Forward stub trace variables into the clean serve process
ci / test-pg (pull_request) Successful in 1m49s
ci / test (pull_request) Successful in 4m11s
Why: env -i dropped SVC_STUB_*, so recovery tests saw an empty serve record even though the bound DSN was still passed.
Evidence: SELF python3 -m unittest tests.test_svc.SvcDbRecoveryTests tests.test_svc_lifecycle_isolation — 34 tests OK.
Impact: only SVC_STUB_* is added at launch; serve.env still omits them, and caller AGENT_SYSTEM_* stays out of the process.
Refs: #485
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 15:13:36 +00:00
weichen d4a83318b1 Merge authoritative main into the task branch
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=99048dda1f48bccb3d5d798050d7beeea2907177.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
2026-10-12 15:07:47 +00:00
weichenandCursor 7cc553d5a3 Merge origin/main into feature/svc-d1-identity-flow
ci / test-pg (pull_request) Successful in 1m52s
ci / test (pull_request) Failing after 2m51s
Why: main already has one release transaction, so this branch keeps that path and only isolates update and recover in a clean child.
Evidence: SELF bash -n scripts/svc.sh; python3 -m unittest identity/recover/deploy/u2/lifecycle pin 92 tests OK (2 skipped), then 66 tests OK after dropping the obsolete journal hook.
Impact: deploy uses releases/ and deploy.journal; the lifecycle child reconciles that journal before deploy or recover. Backend pin is 0f192a4.
Refs: #485
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 15:06:55 +00:00
weichen e9673cad88 Wait for port release after stopping a service
ci / svc-realcombo (pull_request) Successful in 2m1s
ci / test-pg (pull_request) Successful in 4m2s
ci / test (pull_request) Successful in 4m55s
Why: on slow runners the orphaned http child of a stopped stub lingers
a few hundred milliseconds past the parent's exit (ppid-watch suicide),
and the immediately following start - notably the U2 rollback restart -
classified the unparented listener as a foreign occupant and refused to
start (CI run 3774).
Evidence: test_svc_u2/identity/svc suites 82 OK locally with the wait
in both stop paths.
Impact: adds <=3s bounded wait in do_stop/do_stop_quiet after SIGTERM
cleanup; no behavior change when the port is already free.
2026-10-12 14:56:00 +00:00
weichen 9f7b11675e Preserve rollback artifacts across same-second deployments
Why: Second-resolution release IDs let staging delete a previous release
when a same-source deployment ran within the same clock tick.

Evidence: Fixed-clock rollback regression fails before and passes after;
250 governance checks pass. Independent review replays collision and
copy-failure protection; receipts are in the primary task card.

Impact: Add invocation identity and exclusive directory creation; keep
old artifacts intact. Also retain the latest compatible frontend pointer.

Refs: User-approved I2; Dev #483; Frontend #71/#72
2026-10-12 14:50:09 +00:00
weichenandCursor e8f84b8cf1 Add a reversible release switch and a lifecycle pin
Why: an update that stops the old process and overwrites the binary cannot
get the previous version back, and a migration the old binary cannot read
must be refused before that stop. CI also had no fixed RDM SHA to build from.
Evidence: python3 -m unittest tests.test_svc_identity tests.test_svc_recover tests.test_svc_deploy_txn tests.test_lifecycle_pin passed. make test-lifecycle exits 2 when AGENT_PG_TEST_DSN is unset.
Impact: installs land in releases/<rid> and current switches with mv -T.
Deploy keeps the desired state and rolls back a non-terminal journal.
Schema compatFloor above the installed target is refused unless
--migrate-schema --confirm is paired with a backup. test-lifecycle fails
closed without PostgreSQL and an RDM checkout. Login stays NOT_RUN.
Refs: recovery plan r3.1 D2 and D3; Backend feature/d1-identity-open

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 14:43:27 +00:00
weichen 99bbbc089e Gate svc lifecycles on real Dev and RDM artifacts in CI
Why: stub suites proved the script logic but not real artifact
behavior (the 2026-10-12 incidents passed all stub tests); the report's
U3 requires real-combination gates, and realcombo dry-runs exposed two
real gaps: fresh deploys closed identity governance one lifecycle late,
and pg-bound identity calls put the DSN on the command line.
Evidence: make test exit 0; local realcombo dry-run 16 OK (rows in the
task card); CI adds svc-realcombo (SQLite, both real binaries, full RDM
track) and a real-PG identity step on test-pg with env-delivered DSN.
Impact: tests/test_svc_realcombo.py (SVC_TEST_REAL gate, explicit
NOT_RUN otherwise); ci.yaml new job + test-pg step (RDM clone via
trusted-base URL-scoped token header, allowlist addition reviewed in
this PR); svc.sh delivers identity DSN via AGENT_SYSTEM_DSN and runs
manifest adoption in the same deploy that first registers svc.env;
modules/backend pinned to main (env fallback, backend #182).
Refs: .task/feature-svc-u3-realcombo.md; user goal directive 2026-10-12
(U3); backend #182; RDM #285.
2026-10-12 14:27:59 +00:00
weichenandCursor 451c95be70 Gate deploys on versioned identity capabilities
Why: probing identity by running the subcommand still launched old RDM
builds, and ensure on a missing database created an empty one. A batch
update also inherited the caller's AGENT_SYSTEM_* variables.
Evidence: python3 -m unittest tests.test_svc_identity tests.test_svc_recover passed (41 tests, 1 skipped). tests.test_svc_lifecycle_isolation caller-env and restart cases passed.
Impact: capability probes use version --json only. Established instances
refuse a missing identity row until adopt --confirm. update and recover
run each service in a clean environment. serve reads a 0600 serve.env
and does not inherit the caller environment. Backend and documents pins
move to the D1 identity and recovery-plan commits.
Refs: recovery plan r3.1 D1; Backend feature/d1-identity-open; RDM feature/d1-version-json

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 14:09:36 +00:00
weichen 241bea6ce7 Add immutable release dirs with switch journal and failure rollback
Why: deploy overwrote live artifacts after stopping the old service, so
a failed start or workbench check left instances in a mixed
registration-vs-artifact state with no recovery path (2026-10-12
rdm1/rdmcand); the report's U2 requires restorable updates.
Evidence: make test-governance 250 OK; five svc suites 105 OK (rows in
the task card); new tests cover layout/pidcheck stability, rollback on
start failure with desired-state restore, build failure keeping the old
service running, interrupted-switch journal resolution, and schema-
advance blocking rollback without touching the database.
Impact: agent deploys stage immutable releases/<id>/ and switch the
current symlink atomically; deploy.journal persists the switch and is
resolved at start/restart/deploy/update/recover entries; legacy layouts
are adopted on first deploy and remain readable; release/rdm tracks
verify sha256 before staging.
Refs: .task/feature-svc-u2-release-recovery.md; user goal directive
2026-10-12; Dev #474 (U1 gate); Documents unified-deploy plan r2.
2026-10-12 13:52:29 +00:00
weichen 55ed5899fb Harden svc.sh identity isolation and deploy candidate gate
Why: batch update leaked AGENT_SYSTEM_INSTANCE_ID/DBREF from one service
to the next, and RDM artifacts without the identity CLI were stopped and
overwritten before their startup identity refusal surfaced, leaving
rdm1/rdmcand in a mixed registration-vs-artifact state (2026-10-12).
Evidence: make test-governance 217 OK; tests.test_svc_identity and
tests.test_svc_precheck green; rows recorded in the task card.
Impact: env_config resets identity env per service; capability probe is
timeout-guarded and rejects serve-shaped output; identity ensure moves
to adoption/init (bare start is verify-only); deploy builds and gates
candidates before stopping the old service (refuses identityless
candidates, completes missing identity rows via the candidate); update
runs svc_manifest_migrate like every other lifecycle entry.
Refs: .task/feature-svc-identity-u1.md; user root-cause report 2026-10-12.
2026-10-12 12:56:37 +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 7e5cf55311 Merge authoritative main into the task branch
ci / test-pg (pull_request) Successful in 1m25s
ci / test (pull_request) Successful in 3m21s
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=c6fefa3435dc5d9524fc35483f1d34fa1a6e0d59.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync

# Conflicts:
#	tests/test_svc.py
2026-10-12 11:15:11 +00:00
weichenandCursor 442251c35e Reset per-service runtime state in svc.sh env_config
Why: Batch update --all left SVC_PIDCHECK from the prior service in
memory, so pid_alive/reclaim_own_port misclassified the next service's
process as dead/foreign, deleted svc.pid, and failed start on a still-
occupied port (genui/rdm1/rdmcand after successful dev).

Evidence: make test-governance (SELF; receipt /tmp/svc-pidcheck-gov.json);
new test_batch_update_stops_second_service_despite_prior_pidcheck +
SVC_PIDCHECK ratchet in test_svc_precheck.

Impact: env_config clears SVC_PIDCHECK/EXEC/VERSION/SOURCE per service;
batch update correctly stops and restarts each agent. After merge:
restore genui/rdm1/rdmcand and move rdmcand to its own data dir.

Refs: .task/feature-svc-pidcheck-leak.md; complements #456 reclaim_own_port
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 09:25:33 +00:00
weichenandCursor 7c608b6afe Reclaim own port holders before agent start and install
Why: genui update cleared svc.pid without killing the process, then
overwrote the binary and failed start with a false "non-ours" port error.
Evidence: make test-governance (receipt /tmp/svc-reclaim-governance.json)
Impact: reclaim_own_port walks ss listener ancestry; stop/check_port/install
wire it; orphans matching pidcheck are stopped, foreign occupants still refused
Refs: fix/svc-reclaim-own-port

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 08:57:04 +00:00
weichenandCursor 6056838b48 Fix static fresh-start pidcheck so health loop stays alive
Why: write_static_reg omitted pidcheck and pid_alive ignored in-memory
SVC_PIDCHECK, so first-boot curl probes fell back to agent-system and
misread python http.server as exited.
Evidence: python3 -m unittest tests.test_svc -v (17/17, new static case)
Impact: Static --dir deploy survives the pre-record_state health loop.
Refs: fix/svc-static-pidcheck-fresh-start

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 08:35:44 +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
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 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
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 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 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 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 5e9083cff4 Keep recovered services alive when the watchdog oneshot exits
ci / test-pg (pull_request) Successful in 1m1s
ci / test (pull_request) Successful in 2m34s
Why: systemd's default KillMode=control-group kills every process in
the unit's cgroup when the oneshot finishes -- the daemon recover just
started died seconds after the recover ok event (observed live on the
host: revived at 22:13:40, gone by 22:13:42).

Evidence: unit text now carries KillMode=process (asserted in
test_watchdog_print_plan); suite 10/10 and make test-governance rerun
recorded on the card; live re-demo on the host after merge.

Impact: scripts/svc.sh wd_service_text only.

Refs: .task/feature-svc-autorecover.md
2026-10-11 22:15:31 +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 e08ceebb95 Guard start paths with the ss-free port probe too
ci / test-pg (pull_request) Successful in 1m1s
ci / test (pull_request) Successful in 2m34s
Why: check_port_free consulted port_owner (ss -ltnp) only, so the
/dev/tcp fallback added to port_listening never ran on the start path;
CI (no iproute2) still started onto a thief-held port.

Evidence: no-ss simulation refuses a bound port and passes a free one;
full suite 10/10 and make test-governance rerun recorded on the card;
CI on the new head is authoritative.

Impact: scripts/svc.sh check_port_free only.

Refs: .task/feature-svc-autorecover.md
2026-10-11 21:34:12 +00:00