You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b2ddb4c
Browse filesBrowse the repository at this point in the historyBrowse files
schedules: a schedule copied to another Bot loses the reach it was set with (#2954)
Fixes#2951
Owner: Dev-1
Written-by: Dev-1
Reviewer: Reviewer
Claim-Id: 4d118d616cfe431581c30141ce255969
Base: 2d81af3
Verified commit: d4f1e8d95927ce5ae77d8693060a63ca2f6a11cc (tree
367f26f)
Pushed head: 62660a1
Risk tier: T2 (`risk-gate (report only): PR #2954 tier T2`; path-based,
no content or size hit)
## What was wrong
A schedule copied to another Bot never recorded the reach it was set
with, so its card could never say `changed since it was set` — the thing
`#2942` landed for created and edited tasks.
`copyRow` in `core/src/host/schedules.js` answered `undefined`: its
`return id` sat inside the `service.serialize(async () => { … })`
callback, not outside it. `copySchedule` hands that answer to
`noteTargetReach(createdId, body.target)` at `:424`; `noteReachAtSet`
refuses a non-string id at `:268`, so nothing was written to
`state.scheduleCarriedAtSet` and `rt.save()` never ran. The row itself
was written — the copy appeared — only its reach-at-set was missing.
The client (`core/src/client/schedules.js` `reachMoved`) reads a
non-array `carriedAtSet` as unchanged, so the hint never appended
`changed since it was set`. The paused-source branch goes through
`service.create` and was already fine; only the active-source copy path
was broken. Nothing about the shape of `state.scheduleCarriedAtSet`
changes.
## What changed
- `core/src/host/schedules.js`: `copyRow` now `return await
service.serialize(…)`, so the new row's id leaves the write and reaches
`noteTargetReach`. A short comment names why the id has to leave.
- `core/test/schedules.test.js`: one new case, `#2951`. Composio is off
for `w1` when the source is created (its own set is `['github']`),
turned on before the copy, and the copy to `m1` asserts `carriedAtSet
=== ['github', 'composio']` — the target's reach at the copy, never the
source's stored set — and `carried` equal to it. Then Composio is turned
off for `m1`: the stored set must stay and only `carried` move, which
proves the set reached the saved state and not only the reply.
- `docs/subsystems/core-host.md`: the `schedules.js` row now says a copy
is set at the copy, with the target's reach, and that the write happens
only when `copyRow` answers the new row's id.
- `changelog.d/2951-schedules-copy-reach.fixed.md`: one fragment.
- `patches/ds-bot/0001-core-fixes.patch`: regenerated once, after the
edit, from the committed tree. `core/src/client/**`, `core/client.js`
and `patches/ds-bot/0008-client-bundle.patch` are untouched.
## Red first, on base `2d81af3658e9` (test in the tree, fix not yet
written)
`TMPDIR=/tmp TZ=UTC node --test --import ./test/harness-resolve.mjs
--test-name-pattern='#2951' test/schedules.test.js`:
```
not ok 1 - \#2951: a copy stores the reach the target has when it is copied, so the card can say it moved
error: |-
the copy is set with the reach the target has now
+ actual - expected
+ undefined
- [
- 'github',
- 'composio'
- ]
expected: [ 'github', 'composio' ]
actual: undefined
```
The whole file at the same base: `# tests 42 / # pass 41 / # fail 1`,
the one red being this case.
## Mutations
- Without the fix (the base tree): the new case fails as quoted above —
the reply's `carriedAtSet` is `undefined`.
- With the fix, but `noteTargetReach` given the source's id
(`body.copyFrom?.id`) instead of the new row's: the same case fails 1/1
— the assertion is pinned to the id the copy actually writes, not to the
mere presence of a save.
- With the fix and the assertion intact: `#2951` passes 1/1 and the
whole file is `# tests 42 / # pass 42 / # fail 0`.
## What I ran, at `d4f1e8d95927ce5ae77d8693060a63ca2f6a11cc` (tree
`367f26fdbe6ecdb6e11e5e023f6fa47e1f64469c`)
- `TZ=UTC npm run verify` (`TMPDIR=/tmp`, `DSH_HARNESS=…`,
`ARCH_DOCS_BASE=2d81af3658e9`): core lint `Found 88 warnings and 0
errors`, `arch-docs: OK (5 changed file(s))`, plugin lint `0 errors` for
every package, `build-client.mjs --check` ok, `ds-bot-patches check` `ok
10 patches apply cleanly in order` and `ok core/ equals ds-bot/ +
patches/ds-bot/`, `canonical` `ok patches/ds-bot/ is what generate
writes (generate is a no-op)`, then core `# tests 3179 / # pass 3177 / #
fail 2`.
- The two core reds are `bench.sh refuses before writing the profile
when pnpm is missing` and `bench.sh shows a failed pnpm install and
leaves no half-built profile` in `core/test/bench-preflight.test.js`.
They are this box, not this change: a clean detached worktree at base
`2d81af3658e9` runs the same file `# tests 7 / # pass 5 / # fail 2` with
the same two names, and this diff does not touch that file.
- Because `npm run verify` stops at that suite, its later steps ran
separately at the same commit: `plugins/social` 626/626, `plugins/tree`
149/149, `plugins/timeline` 172/172, `plugins/workflow` 531/531,
`plugins/project` 147/147, `.github/scripts` + `policy` 675/675,
`changelog.mjs check` `21 fragment(s) … well formed`, `lint:interop`
exit 0, `test:interop` exit 0, `lint:live-e2e` exit 0, `test:live-e2e`
exit 0 — all exit 0.
- `core/test/schedules.test.js` on its own after the fix: `# tests 42 /
# pass 42 / # fail 0`.
## Not run
- The smoke bench (`dev/bench.sh smoke`) — this box's bench preflight is
the known red above (`pnpm` missing), so a bench run would report the
environment, not this card; nothing here changes start-up.
- No browser/client build: `core/src/client/**` is untouched and
`build-client.mjs --check` confirms `client.js` still is the build of
`src/client`.
## Checkpoint
<!-- flybot:checkpoint -->
```json
{
"pr": 2954,
"claim": "Dev-1",
"issue": 2951,
"summary": "copyRow answered undefined because its `return id` sat inside the serialize callback, so the copy path handed noteTargetReach a non-string, the reach-at-set was never written and rt.save() never ran: a copied schedule could never say the reach moved since it was set. Returning the id out of serialize fixes it; one test pins the copy to the target's reach at the copy (not the source's stored set) and to the stored set surviving a later roster change. No client change, no bundle.",
"files": [
"core/src/host/schedules.js",
"core/test/schedules.test.js",
"docs/subsystems/core-host.md",
"changelog.d/2951-schedules-copy-reach.fixed.md",
"patches/ds-bot/0001-core-fixes.patch"
],
"checks": {
"ran": "TZ=UTC npm run verify (ARCH_DOCS_BASE=2d81af3658e9); plugins/social|tree|timeline|workflow|project test; node --test .github/scripts/*.test.mjs policy/*.test.mjs; lint:interop test:interop lint:live-e2e test:live-e2e; changelog check; schedules file 42/42",
"result": "green",
"at": "62660a1357008f8a40b44a44dd3b5d02da444130"
},
"next": "waiting for a Verdict naming the pushed head"
}
```
<!-- /flybot:checkpoint -->
A task copied to another Bot now records the reach that Bot had when it was copied, so its card can say `changed since it was set` once the roster moves. The copy path lost the new task's id on its way out of the write, so the reach-at-set was never stored and the copy looked as if it had always had today's reach. See [#2951](https://github.com/ThinkFlowLab/FlyBot/issues/2951).
Copy file name to clipboardExpand all lines: docs/subsystems/core-host.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ The server side of the patched `ds-bot` core (`core/`): the part of [ds-bot-core
46
46
|`core/src/host/face-mentions.js`| Who "@" calls in a face-to-face room (#287): every alias of a participant (`faceAliases`, kept in `shared/remote-label.js` so the bubble chips the same names, #305; bare name, the picker label `<owner>'s Chief` / `<name> · <owner>'s Bot`, `<name> · <owner>`, handle), local and friend's Bots told apart. `faceMentions().handles` is the handle of every Bot a line names (the explicit mention list a sender attaches, #293) and `mentionedByHandle` resolves a received list to my Bots (`known` counts handles the room has). |
47
47
|`core/src/shared/look-image.js`| The image a Bot's look may carry (#2646): `safeLookImage` keeps a plain `https?://` URL or a `data:image/(png|jpeg|webp|gif);base64,` string and answers `null` for a value carrying a quote, a paren, a backslash, whitespace or a control character; `cssImageUrl` writes the kept value as `url("…")` for the page-wide mention stylesheet. It is read at the entries — hooks.js `cleanRemoteLook` and remote-chat.js `applyPublishedLook` — and again at that sink (`client/mention-style.js`), so a friend's Bot cannot close the declaration or add a rule; a dropped image draws the colour/mask look. `plugins/social/src/look.js` carries the same test (the same formats, gif included since #2649) and `plugins/social/test/look.test.js` keeps the two in step. Tests: `core/test/mention-style.test.js`. |
48
48
| `core/src/host/reach.js` | Per-Bot grants and the owner-policy `reach()` check that hooks.js runs outside the plugin chain (#90); `rt.setGrants`, `rt.hasGrant`, `rt.hasAnyGrant`. A local Bot refused toward a friend's Bot is told that it is not shared with that friend and where to share it (Sharing, #273). `rt.reach` also reads the room a send already belongs to when the caller names none (#948): `sharedRoom` applies only to the `roomOnly` identity — the Bot holds no grant at all and came into that **face-to-face** room by its number (`isCodeJoined`) — and looks for the one such room where the **exact** target is still seated; a Bot that holds a grant, or a room of this home, is judged as it always was and keeps asking for an explicit `roomId`, so a Bot that joined a room by number — a `roomOnly` identity with no person-grant — may line that seat, which is the same allowance `reach()` already applies to an explicit `roomId`; the room itself is named outbound by the transport, never assumed here. A `user-mention` with no named room is also judged under `mentionRoom` (#1126): one live local or inbound group where that Bot is a member and the exact target is still a remote seat, including a seat a group invite admitted (`admittedBy: 'ticket'`). A plain line, `message_bot`, a seat that has left, and a stranger outside every such room stay on the grant rule. Face-to-face stays on `sharedRoom`. Tests: `core/test/reach-policy.test.js`, `core/test/flybot.test.js`. |
49
-
| `core/src/host/schedules.js` | Scheduled tasks through DSH's schedule service: list, create, edit, copy, pause/resume, retry and delete for Settings → Scheduled tasks, each task's last run, and moving a Bot's tasks to its fresh part, which rewrites the stored row in place so the task keeps its id, its delivery history and the instant it was already due (#354, #473, #1245, #1287, see **Scheduled tasks: edit, pause, missed runs**, **Scheduled tasks: copy** and **Scheduled tasks: last run and Retry**). Also the `bot_schedules` tool: the Bot-wide list DSH's own `schedule_list` cannot give, group chats' own Sessions included (#628, see **Scheduled tasks: the Bot-wide list**). Tests: `core/test/schedules.test.js`. Tests for team quiet hours, its refusals and the settings write: `core/test/quiet-hours.test.js`; the rule itself is in `core/src/shared/quiet-hours.js` (#1166). The reach the reader set a task with is kept in `state.scheduleCarriedAtSet` and answered as `carriedAtSet` beside `carried` (#2930, see **Scheduled tasks: edit, pause, missed runs**). The `every` selector takes `seconds` (60 to 604800) as well as the older `minutes` form, so a 90-second repeat survives an edit; a value below 60s or above 7 days is refused with the same sentence (#1651). A task name is at most 120 code points (#1895), so 120 emoji is a valid name and one more is refused. The list is a read of the caller's own rows: `schedulesView(actor)` reads each row's Session through the module's own `sourceOf(sessionId, actor)` (the rule #1321 uses for a copy's source and an edit's own Session), so another owner's task stays out and an actor-less call under scoping answers no rows, while an unenforced one-person install answers the whole host; the `schedule-*` writes keep their Session and target gates. A narrowed view also carries `someHidden: true` when a known row was dropped for the caller — the active and the paused loop set it alike — so an empty answer from a narrow caller is not read as a host with nothing scheduled; a row with no known owner hides nothing and sets no flag, and an unenforced install (no actor narrowing anything) never sets it either. |
49
+
| `core/src/host/schedules.js` | Scheduled tasks through DSH's schedule service: list, create, edit, copy, pause/resume, retry and delete for Settings → Scheduled tasks, each task's last run, and moving a Bot's tasks to its fresh part, which rewrites the stored row in place so the task keeps its id, its delivery history and the instant it was already due (#354, #473, #1245, #1287, see **Scheduled tasks: edit, pause, missed runs**, **Scheduled tasks: copy** and **Scheduled tasks: last run and Retry**). Also the `bot_schedules` tool: the Bot-wide list DSH's own `schedule_list` cannot give, group chats' own Sessions included (#628, see **Scheduled tasks: the Bot-wide list**). Tests: `core/test/schedules.test.js`. Tests for team quiet hours, its refusals and the settings write: `core/test/quiet-hours.test.js`; the rule itself is in `core/src/shared/quiet-hours.js` (#1166). The reach the reader set a task with is kept in `state.scheduleCarriedAtSet` and answered as `carriedAtSet` beside `carried` (#2930, see **Scheduled tasks: edit, pause, missed runs**). A copy is a new task, so it is set at the copy: its `carriedAtSet` is the target Bot's reach at that moment, never the source's stored set, and the write happens only when `copyRow` answers the new row's id (`#2951`). The `every` selector takes `seconds` (60 to 604800) as well as the older `minutes` form, so a 90-second repeat survives an edit; a value below 60s or above 7 days is refused with the same sentence (#1651). A task name is at most 120 code points (#1895), so 120 emoji is a valid name and one more is refused. The list is a read of the caller's own rows: `schedulesView(actor)` reads each row's Session through the module's own `sourceOf(sessionId, actor)` (the rule #1321 uses for a copy's source and an edit's own Session), so another owner's task stays out and an actor-less call under scoping answers no rows, while an unenforced one-person install answers the whole host; the `schedule-*` writes keep their Session and target gates. A narrowed view also carries `someHidden: true` when a known row was dropped for the caller — the active and the paused loop set it alike — so an empty answer from a narrow caller is not read as a host with nothing scheduled; a row with no known owner hides nothing and sets no flag, and an unenforced install (no actor narrowing anything) never sets it either. |
50
50
|`core/src/host/automation-default.js`| Automation tasks on by default (#378): once per profile, `offerBundle` asks DSH's plugin manager to switch on `@deepseek-ai/dsh-experimental-schedule-bundle` and writes the offer to `dsh-defaults.json` next to the team. Tests: `core/test/automation-default.test.js`. |
51
51
|`core/src/host/notify.js`| Out-of-app delivery, first half (#355): a transport-agnostic adapter with Slack's `chat.postMessage` shape, one key per reminder so a retried send cannot duplicate, exponential backoff that honours `Retry-After`, three attempts at most, a structural failure not retried, and zero transport calls while the channel is off. Ships `fakeSlack` for tests; nothing calls it until the real Slack transport lands (see **Out-of-app delivery, first half**). Sent and permanently refused keys are each capped at 1 000 process-local entries, oldest dropped first (#2808). Tests: `core/test/notify.test.js`, `core/test/notify-refused-bound.test.js`. |
52
52
|`core/src/host/harness.js`| Declarative harness (#874 Option B). Step 0 (#903): `default` names today's prompt / tools / model / step·retry / verifiers (`rt.harness`, `rt.resolveHarness`); behavior-neutral. Step 1: `lite` / `medium` / `heavy` load through the same resolver with distinct declared budgets; `rt.routeHarness` reads one triage label (`harness:lite`, `harness:medium`, `harness:heavy`). `applied` stays false, so the named modules are not rewritten. `harnessPro` checks a config offline against CI, `core/dev/eval`, and `rsi-baseline` and does not call a model. Step 2: `rt.harnessExperience` reads the experience library and does not attach it to a tier. Tree prompt exception: `@flybot/tree` keeps its marked prompt under `plugins/tree` (outside the three mirrors); listed on the harness, injection stays outside this file. Installed in `MODULES` right after `store`. Tests: `core/test/harness.test.js`, `core/test/experience.test.js`. |
0 commit comments