Repository navigation
desk-hub: a machine POST's answer names the frames it refused (MAWS #88) - #91
Conversation
A frame the hub refused whole -- a session-plane frame or an upload for a
project the stream has not opened (`not-open`), or one it cannot read
(`bad-shape`, a frame naming no project id among them) -- was counted as
applied and the POST answered 200 with nothing to say so; the machine
learned of it only from the stream's `refused`, later, if at all. The
answer now names them: `200 {ok, frames, refused: [{index, reason}]}`,
`index` the frame's place among the POST's frames in the numbering
`frames` counts (a part set joined in the POST named by its last part),
`refused` always present (`[]` when none), and carried by the 409 and 503
answers that count `frames` too. Each project returns the refusals of its
run with its applied count; the Machine maps them to POST indices.
Compatible: the status and `frames` are unchanged, and every refusal still
goes down the stream as before (a session-plane frame's on the control
lane), so a daemon that ignores the field behaves as today. No storage
change. DX2's answer paragraph in the desk design states the shape.
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
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: 6136527722
ℹ️ 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 ('run' in item) { | ||
| const result = await results.get(item.run)!; | ||
| applied += item.run.weights.slice(0, result.applied).reduce((sum, weight) => sum + weight, 0); | ||
| for (const { index, reason } of result.refused) refused.push({ index: item.run.indices[index], reason }); |
There was a problem hiding this comment.
Handle project results that omit the refusal list
In the stalled-stream scenario in test/machine-end.test.ts, the project stub still returns { applied, stale, failed }, so result.refused is undefined. Iterating it throws before the result.failed branch can produce the expected 503 delivery-failed, causing that test—and any mixed-version or alternate fromMachine implementation using the previous contract—to reject the request instead. Default this field to an empty list or update every implementation atomically.
Useful? React with 👍 / 👎.
| await this.send({ t: 'refused', project: String(project), refusal: { reason: 'bad-shape', message: 'the frame names no .smns project id' } }, stream.generation); | ||
| refused.push({ index, reason: 'bad-shape' }); |
There was a problem hiding this comment.
Refuse non-heartbeat frames that omit the project
When a non-session project frame omits project (for example {t: "pending", raised: []}), projectOf returns null, so this code takes the heartbeat-only branch and never reaches the newly added refused.push. The POST therefore returns refused: [] and no stream refusal even though the documented contract says a frame naming no .smns project is refused as bad-shape; reserve null handling for hb-ack and classify every other such frame as refused.
Useful? React with 👍 / 👎.
…e's contract now has it The suite's hand-written Project (cast `as never`, so the typecheck did not reach it) answered fromMachine without `refused`, and the Machine's answer loop read it. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
…#91's test, MAWS #88) The mixed-run case waited only for the pending list, then asserted the browser's presence frames at once; under load the frame may not have arrived. Wait for it the same way. The other cases #91 added assert on a POST's answer or wait on the exact frame (m.next), so they are unchanged. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Closes #88
What changes
A machine POST (
POST /machine/frames) now says, in its own answer, which of its frames the hub refused whole:not-open: a session-plane frame, an upload, arejectedreport, anrpc-result, apending), and one the hub cannot read (bad-shape, a frame naming no.smnsproject id among them). An upload some of whose events were refused (writer-not-yours,conflict, one event'sbad-shape) is not refused whole. Those refusals still go down the stream only.index. The frame's place among the POST's frames, from 0, in the numberingframesalready counts: each non-blank line is one frame, and eachpartis one. A set joined in this POST is named by its last part.reason. The same reason the stream refusal carries.refusedis[]when nothing was refused, so a machine can tell "none refused" from a hub older than desk hub: a machine POST's answer names the frames it refused (not-open project) #88, whose answer has norefusedat all.409 stale-generationand503 delivery-failedanswers that countframescarryrefusedfor those counted frames too.Compatibility
frameskeeps its meaning (refused frames still count as applied). A daemon that ignores the new field behaves exactly as today.The doperpowers follow-up can now drop the held settlements and the 2 s probe, and act on the answer instead.
Contract and tests
docs/doperpowers/specs/2026-10-15-desk-design.mdstates the shape.RefusedFrameandPostAnswertypes are inapps/desk-hub/src/protocol/machine.ts.apps/desk-hub/test/session-plane.test.ts:{index: 0, reason: "not-open"}, and an applied POST answersrefused: [];eventsprobe, a part set named by its last part, and a frame naming no project id;refusedstill reaches the stream.Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)