Skip to content

fix(agents): preserve configured workspaces after setup migration - #125435

Merged
steipete merged 1 commit into
mainfrom
fix/workspace-setup-survival
Aug 17, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/workspace-setup-survival

Conversation

@steipete

@steipete steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users upgrading from the latest stable release could complete Doctor's JSON-to-SQLite setup-state migration, then have a customized workspace rejected as vanished before the first provider turn when only an onboarding profile file such as IDENTITY.md proved that the workspace was configured.

Why This Change Was Made

The setup-only survival check now uses the existing configured-profile predicate. That predicate is a strict superset of the former user-content evidence: it keeps memory, skills, and other existing signals while also recognizing customized IDENTITY.md, USER.md, and related onboarding profiles. Empty or generated-only workspaces remain protected by the existing disappearance checks.

Root cause was introduced by #109147: setup state moved into SQLite, but its no-attestation survival path retained the narrower evidence helper. Doctor then removed the retired JSON state marker after migration, exposing the mismatch.

Production LOC: +1/-1 (net 0). Tests: +15/-0.

User Impact

Configured workspaces survive stable-to-current upgrades and can reach the provider normally after Doctor migrates setup state into SQLite. The fix does not weaken wiped-workspace detection or recreate bootstrap files.

Evidence

  • Pre-fix owner-boundary regression failed with WorkspaceVanishedError; fixed head passes through bootstrap-enabled ensureAgentWorkspace() while preserving customized IDENTITY.md.
  • Focused SQLite workspace safety suite: 8/8 passed. Relevant workspace suites: 73 passed before the final rebase.
  • Full changed-file gate passed; final-rebase formatting, Oxlint, and git diff --check passed.
  • Fresh Codex autoreview on the pushed code: clean, no actionable findings, correctness 0.99.
  • Packaged survivor upgraded [email protected] to packed [email protected] with 4,800 sessions, 23,890 transcript events, 2,200 cron jobs, installed plugins, nested Discord config, and repaired legacy Telegram runtime dependencies. Doctor completed in 22s, idempotence Doctor in 21s, gateway startup in 14s; all 32 phases passed.
  • A real openai/gpt-5.5 turn returned the exact expected marker after migration. Artifact scan found zero inherited-key bytes and zero channel-request markers; the only sk-* lexical matches were static Emacs Lisp syntax strings in bundled highlighting code.
  • Final exact-head packaged rerun on top of perf(doctor): snapshot SQLite migration validation #125361 passed the same 4,800-session/23,890-event/2,200-cron-job upgrade: Doctor 22s, idempotence 21s, gateway 15s, all 32 phases passed, and the live OpenAI turn returned the exact marker. Packed tarball SHA-256: 3c8a807f55352b565a0112732128fa787cf6e36ade2f7200c5e5a92c7ffdb675.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Aug 17, 2026
@steipete steipete self-assigned this Aug 17, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 6:42 PM ET / 22:42 UTC.

ClawSweeper review

What this changes

The PR lets a SQLite-migrated workspace with a customized onboarding profile survive setup rather than being treated as vanished.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: current main still has the narrow survival predicate, while this patch aligns it with the established configured-profile check and adds focused coverage. No blocking correctness findings.

Likely related people: @steipete (high confidence; authored the SQLite migration and recent adjacent Doctor work).

Priority: P1
Reviewed head: fb537d562f684a1dcd8fe6c8b82fe7e22487eedf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) This is a focused, net-neutral owner-boundary repair with credible packaged-upgrade evidence and no identified correctness defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body reports an after-fix packaged stable-to-current migration and a successful real provider turn, with a further exact-head rerun pending before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body reports an after-fix packaged stable-to-current migration and a successful real provider turn, with a further exact-head rerun pending before merge.
Evidence reviewed 5 items Current-main gap and changed owner: Current main uses only user-content evidence in the setup-only survival path; the PR replaces it with the existing configured-profile predicate.
Canonical sibling behavior: The configured-profile predicate recognizes customized SOUL.md, IDENTITY.md, and USER.md plus existing content signals, and the attestation survival path already uses it.
Focused regression coverage: The added test persists migrated setup state, preserves a customized IDENTITY.md, and the adjacent test continues rejecting generated-only remnants.
Findings None None.
Security None None.

How this fits together

Agent workspace setup combines SQLite migration state with files in the workspace to decide whether bootstrap may proceed safely. This decision runs before agent initialization and either preserves the configured workspace or emits a workspace-vanished error.

flowchart LR
  A[Doctor migration] --> B[SQLite setup state]
  C[Workspace profile files] --> D[Survival evidence check]
  B --> D
  D --> E{Configured workspace?}
  E -->|yes| F[Bootstrap and agent run]
  E -->|no| G[Workspace vanished error]
Loading

Before merge

  • Resolve merge risk (P1) - This is upgrade-sensitive: it broadens setup-only survival evidence for migrated workspaces, so the promised exact-head packaged upgrade rerun and required CI should complete before merge.
Agent review details

Security

None.

PR surface

Source 0, Tests +15. Total +15 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 15 0 +15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 16 1 +15

Review metrics

Metric Value Why it matters
Production and test delta production +1/-1 (net 0); tests +15/-0 The repair changes an upgrade-safety predicate without increasing production code and adds an owner-boundary regression.
Setup survival policy 1 predicate aligned across 3 onboarding profiles The setup-only SQLite path now shares the configured-profile policy already used by attestation survival.

Stored data model

Persistent data-model change detected: serialized state: src/agents/workspace-sqlite-safety.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Finish exact-head upgrade validation (recommended)
    Complete the packaged stable-to-current migration rerun and required CI on the current head while retaining both configured-profile acceptance and generated-only rejection coverage.

Technical review

Best possible solution:

Use the one configured-profile predicate for both attested and setup-only SQLite state, while retaining generated-only workspace rejection, then merge with exact-head upgrade evidence.

Do we have a high-confidence way to reproduce the issue?

Yes—source-reproducible: on current main, migrated setup state plus a customized IDENTITY.md and no BOOTSTRAP.md reaches the narrow user-content check and is rejected; the proposed predicate recognizes that profile.

Is this the best way to solve the issue?

Yes. Reusing the established configured-profile predicate is the narrow owner-level fix and avoids adding a one-off IDENTITY.md exception.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 27cb5d021fd1.

Labels

Label changes:

  • add P1: A stable-to-current upgrade can otherwise block a configured workspace before its first provider turn.
  • add merge-risk: 🚨 compatibility: The patch changes how persisted SQLite setup state and existing customized workspace files are interpreted during upgrade.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports an after-fix packaged stable-to-current migration and a successful real provider turn, with a further exact-head rerun pending before merge.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports an after-fix packaged stable-to-current migration and a successful real provider turn, with a further exact-head rerun pending before merge.

Label justifications:

  • P1: A stable-to-current upgrade can otherwise block a configured workspace before its first provider turn.
  • merge-risk: 🚨 compatibility: The patch changes how persisted SQLite setup state and existing customized workspace files are interpreted during upgrade.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports an after-fix packaged stable-to-current migration and a successful real provider turn, with a further exact-head rerun pending before merge.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports an after-fix packaged stable-to-current migration and a successful real provider turn, with a further exact-head rerun pending before merge.

Evidence

What I checked:

  • Current-main gap and changed owner: Current main uses only user-content evidence in the setup-only survival path; the PR replaces it with the existing configured-profile predicate. (src/agents/workspace.ts:658, 27cb5d021fd1)
  • Canonical sibling behavior: The configured-profile predicate recognizes customized SOUL.md, IDENTITY.md, and USER.md plus existing content signals, and the attestation survival path already uses it. (src/agents/workspace.ts:431, fb537d562f68)
  • Focused regression coverage: The added test persists migrated setup state, preserves a customized IDENTITY.md, and the adjacent test continues rejecting generated-only remnants. (src/agents/workspace-sqlite-safety.test.ts:118, fb537d562f68)
  • Migration provenance: The prior SQLite workspace-state migration is the merged change identified in the PR context; its commit metadata is present locally. (src/agents/workspace.ts:650, 2cd3ee43ee73)
  • Diff hygiene: The patch is production net-neutral and adds only the focused regression test; no whitespace errors were found. (src/agents/workspace.ts:658, fb537d562f68)

Likely related people:

  • steipete: Authored the merged SQLite workspace-state migration and the current-main Doctor migration-validation work connected to this upgrade path. (role: migration author and recent adjacent contributor; confidence: high; commits: 2cd3ee43ee73, 27cb5d021fd1; files: src/agents/workspace.ts, src/agents/workspace-state-store.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add the promised packaged rerun evidence against current main after the Doctor snapshot optimization.
  • Wait for the exact-head required checks to complete successfully before merging.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Copy link
Copy Markdown
Contributor Author

Completed both ClawSweeper rank-up moves on exact head fb537d562f684a1dcd8fe6c8b82fe7e22487eedf:

Fresh Codex autoreview is clean at 0.99 confidence; focused workspace SQLite safety is 8/8; production LOC remains +1/-1 (net 0), tests +15/-0.

@steipete
steipete merged commit daafb2b into main Aug 17, 2026
231 checks passed

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants