Bob 2.0.2 awareness: trust preflight + approval-wedge fast-abort (2.3.0) - #50
Merged
Conversation
…fast-abort Bob 2.0.2 runs an untrusted workspace on pristine defaults (auto-approve off, command security on, workspace custom modes hidden), ignoring ~/.bob/settings/settings.json - so a headless dispatch there wedges on its first tool prompt or throws "Mode not found". Dispatch now preflights vscode.workspace.isTrusted (new optional host seam; absent = unknown = proceed, so older extension builds keep the pre-2.0.2 behavior) and fails fast naming the folder to trust, before the settings.json auto-approve write. 2.0.2 also persists un-auto-approved tool requests to bob.db (task_pending_approvals) while the task sits frozen on them. The completion watch probes that table: a pending approval older than approvalWedgeMs (default 5s) aborts the dispatch immediately with the tool named, instead of burning the dispatch timeout. Real settle is checked first so a finished turn reports its true outcome past a stale approval row; a pre-2.0.2 store (no table) is a no-op. Every other 2.0.x contract the driver relies on (startTask, tasks/messages schema, lifecycle, mode resolution, settings keys) verified unchanged against the 2.0.2 bundle.
Review follow-ups (board task #141): - The wedge predicate required Date.now() - (created_at ?? 0) >= margin, so a null created_at (impossible per the DDL's NOT NULL, but Bob owns the column) read as infinitely old and instantly aborted a healthy dispatch. It now requires a non-null timestamp - schema drift falls back to the plain dispatch timeout instead of a false abort. Regression test pins it. - The isSettled closure narrowed `store` with a non-null assertion; use a post-guard alias instead so the invariant stays type-checked. - quietMs feeds both the awaitTurnSettled option and the closure's turnSettled from one local, so the two settle paths can't diverge. - The pendingApprovals oldest-first test now builds its store over the complete 2.0.2 schema rather than probing a table created after the store existed. Declined: narrowing Bob2PendingApproval.created_at to number - row types stay wide for Bob-owned columns (the Bob2TaskRow convention); the predicate fix removes the hazard without breaking that.
The npm side of a release was manual (2.1.0/2.2.0 were published by hand), so the package could lag the tagged extension + GitHub release. The Release workflow now carries a publish-npm job: same v* trigger, its own tag-vs-package.json drift gate, idempotent when the version is already on the registry, and a clear failure when the NPM_TOKEN secret is missing. Manual (workflow_dispatch) runs npm publish --dry-run instead of touching the registry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bob 2.0.2 (staged 2026-08-06, applies on the editor's next restart) leaves every contract the in-process driver relies on intact —
startTask, thetasks/messagesschema, the status lifecycle, mode resolution, and the settings keys were all verified unchanged against the 2.0.2 bundle — but it changes two things a headless dispatcher must handle:allowed_permissionsdown to["read"], and workspace-scoped custom modes hidden — with~/.bob/settings/settings.jsonignored entirely. On 2.0.1 our auto-approve config applied regardless of trust; on 2.0.2 a dispatch into an untrusted folder (a fresh worktree is the likely case) wedges on its first tool prompt or throws "Mode not found" onreview/refactor/devsecops.task_pending_approvals) while the task sits frozen on them — previously invisible to a sibling process.Changes
Bob2Hostgains an optionalworkspaceTrusted()seam fed live fromvscode.workspace.isTrusted; the dispatch fails fast — before the settings.json auto-approve write — when it reportsfalse, naming the folder to trust. Absent/null(an older extension build) reads as unknown and proceeds, preserving pre-2.0.2 behavior.turnSettled) with a probe over the task'stask_pending_approvalsrows: a persisted approval older thanapprovalWedgeMs(default 5s — margin so a just-raised request Bob is still resolving can't abort a healthy turn) aborts the dispatch immediately with the tool named, e.g.execute_command (execute), instead of burning the dispatch timeout (default 5 min). Real settle is checked first so a finished turn reports its true outcome past a stale approval row; on a pre-2.0.2 store the table probe memoizes to a no-op.Compatibility
isTrusteddep → trust unknown → no preflight (pre-2.0.2 behavior).task_pending_approvalstable → the probe returns[]; behavior identical to 2.2.0.Release train
The
v*tag now ships everything at once:release.ymlgained apublish-npmjob alongside the VSIX packaging — same trigger, its own tag-vs-package.jsondrift gate, idempotent when the version is already on the registry, and an explicit failure (with the fix named) when theNPM_TOKENsecret is absent. Manual workflow runsnpm publish --dry-runinstead of touching the registry.After merge: tag
v2.3.0on main → the workflow publishes the GitHub release + .vsix +@pounceai/bob-control@2.3.0. One-time setup: add an npm automation token as theNPM_TOKENrepo secret. The LobeHub listing refresh (stale-scan fix) follows the npm publish.