Fix WorkBuddy travel and first-Buddy onboarding - #24
Conversation
Accept empty successful write receipts, select current upstream locations, and verify travel state after writes without replaying uncertain POSTs. Expose safe diagnostics in the management UI and document partial outcomes. Keep handwritten comments and docstrings concise and English without changing unrelated executable code or configuration semantics. Validated: 55 targeted backend tests and 86 subtests; 17 frontend tests; frontend formatting, lint, type checks and build; 80-file comment-only AST comparison. No version changes or live account actions.
Persist account-scoped consent and one-shot onboarding conversations, then verify official task completion before adoption and travel. Support default-off environment preauthorization, daily warnings and safe audit details. Handle first_buddy without the generic task-acceptance endpoint and resume legacy acceptance-only records without replaying conversations. Synchronize confirmation UI, bilingual docs and deployment examples. Validation: all CI-style backend test scripts, 122 WebUI tests, frontend checks/build, and live onboarding through confirmed departure.
There was a problem hiding this comment.
Sorry @maiphucgiang, your pull request is larger than the review limit of 500,000 diff characters
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 26bf1667fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b7f144933
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not can_write(): | ||
| return stop("buddy_task_changed") | ||
| if not selector(model["id"]): | ||
| return stop("buddy_task_no_model") |
There was a problem hiding this comment.
Release unsent chat reservations when final checks fail
If the account/travel setting or selected model becomes unavailable between reserve_buddy_task() and these final checks, the function returns without calling _chat, but the reservation has already persisted chat_started=1. Every later sweep then takes the previous["chat_started"] path and reports buddy_task_unconfirmed forever, so re-enabling the account or restoring the model cannot resume onboarding even though no conversation was sent. Record this as definitely unsent or release the reservation before returning from either check.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a822c2dd61
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| result = travel.perform(gateway._bearer_token(headers), gateway.profile_for_headers(headers), | ||
| read_only=action == "travel-status", can_write=can_write) | ||
| read_only=action == "travel-status", can_write=can_write, | ||
| buddy_context=gateway._buddy_context(entry, headers, consent_revision)) |
There was a problem hiding this comment.
Recheck account enablement during onboarding
Passing this can_write callback into the new onboarding flow does not actually detect an account being disabled after the action starts: for manual actions not automatic short-circuits the policy check, while the automatic branch checks only auto_travel, not credential_enabled. If an administrator disables the account while task verification or another upstream request is in progress, subsequent agreement, first-Buddy, and departure writes can still run; include the current enabled state in every can_write evaluation.
Useful? React with 👍 / 👎.
| result.update(_status(_request(client, token, "status"))) | ||
| if result["state"] == "idle": | ||
| result.update(message=prefix + "派遣已确认,但状态仍为空闲;请先查询核验,勿重复派出") | ||
| return result |
There was a problem hiding this comment.
Reserve confirmed departures before permitting another dispatch
When the departure POST succeeds but the immediate read still reports idle, this path returns departed=true and ok=false without creating any reservation that a later invocation consults. An immediate manual retry or the next automatic sweep will again see idle/limit-false and send another /depart POST, despite the message saying not to repeat the confirmed write. Persist and check the uncertain confirmed departure until a read reconciles it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a84c3d4c82
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return stop("buddy_retry_later") | ||
| if not event("authorization_used", "success"): | ||
| return stop("buddy_storage_error") | ||
| if not agreed: |
There was a problem hiding this comment.
Record agreements that were already accepted
When the agreement read returns agreed=true—for example, because the user accepted it previously—this branch is skipped while result["agreement_accepted"] remains false. A successful first-Buddy claim is therefore checkpointed with agreed=0, and both the immediate response and any later reconciliation incorrectly report that the confirmed official agreement was not accepted. Initialize agreement_accepted from the validated agreed value before conditionally posting the agreement.
Useful? React with 👍 / 👎.
Summary
first_buddyperforms a real bounded conversation without the generic task-acceptance endpoint.Validation
Awaiting CI and current-head review; no merge requested.