Skip to content

P5 O13 M1: production's deploy steps in the repository (Decision Log 40) - #245

Merged
SSFSKIM merged 7 commits into
masterfrom
p5-o13-m1
Oct 28, 2026
Merged

SSFSKIM merged 7 commits into
masterfrom
p5-o13-m1

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

P5 O13 M1: production's deploy steps, committed to the repository (P5 Decision Log 40).

Hub v2's first production deploy, and the org's root and the phone's approval after it, now run from two committed scripts beside O11's staging runners. Until now they ran from wrappers outside the repository. The scripts use the staging scripts' mechanism with the roles swapped. Nothing in this PR runs against production. Only the owner runs these scripts.

  • apps/desk-hub/deploy/production-deploy.sh --checkout <path> --confirm <sha8> [--allow-head] [--dry-run]:
    • Guard first: before anything runs, config.json must name exactly desk-hub / desk-hub.opencognita-platform.workers.dev / ssfskim. Any staging name or preview alias is refused.
    • Commit confirmation: --confirm must equal the checkout's HEAD short hash. The checkout must be clean and at origin/master after a fetch, unless --allow-head is given; such a build is labelled head.<sha8>.
    • Lock and recheck: a lock is held in the checkout for the whole run. After the web build, before any token is read, HEAD and cleanliness are checked again.
    • Secrets and logs: the two tokens are read by path from DESK_PRODUCTION_SECRETS inside the pipe and go to the deploy on stdin. Output goes through the staging filter, and logs are written under DESK_PRODUCTION_DIR (0700).
    • After the deploy: every wrangler target line must name desk-hub, then X-Desk-Build is polled to a 2-minute elapsed deadline for hub@<sha8>.
  • apps/desk-hub/deploy/production-run.sh steps:
    • checkout [<path>]: a durable path, never /tmp, with the same lock.
    • build: fails with a reason when no build header is read.
    • wait <sha8>.
    • access-sync: needs O14's first production machine's credentials.
    • admin <args…>: M2's deployment admin with the owner's Access token. Any step that changes production prints so on its first line, and genesis is never logged.
  • README: a "Production runs" section that names every environment variable the scripts read.

The branch also carries the O13 spec's living sections.

Validation Evidence

  • npx vitest run --project desk-hub apps/desk-hub/test/deploy/production-scripts.test.ts → 40/40, offline, with stubs for pnpm, wrangler, cloudflared, curl and sleep on PATH. Covered:
    • every guard refusal before any token or stub call;
    • every --confirm refusal, and a master that moved past the checkout;
    • a checkout switched, a tracked file edited, or the config replaced by staging's during the build, each stopping before any token is handed over;
    • a concurrent checkout refused while the lock is held;
    • slow curl stubs (25, 30 and 45 s) never passing 120 s;
    • the filter dropping token / secret / bearer / eyJ lines, and flushing line by line;
    • the README naming every variable.
  • The suite needs zsh; it skips without it, as the staging suites do.
  • eslint and the desk-hub tsconfig.test.json typecheck: clean.
  • Review: doperpowers:reviewer-high, two rounds.
    • Round 1 found three issues, all fixed: a checkout swapped during a queued build could deploy an unconfirmed commit; the 2-minute poll was not time-bounded; build succeeded silently on a failed read.
    • Round 2: correct, no findings.
  • scripts/ci-gate.sh <wt> --gates static,unit --class1a pool on f182dab (the PR head): GREEN, run 40619525075. production-scripts.test.ts ran in the unit job: 40 tests passed, none skipped.

Residue

none

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

…ision Log 40)

production-deploy.sh and production-run.sh fold the owner's out-of-repo wrappers (prep-deploy, deploy-master,
poll-build) in beside the staging runners, with their mechanism aimed at production: config.json must name exactly
desk-hub / its host / ssfskim (staging names and preview aliases refused as not production) before anything runs;
the deploy runs only for the checkout's HEAD named by --confirm, at origin/master unless --allow-head; tokens read by
path inside the pipe; output filtered; every wrangler target desk-hub; production's X-Desk-Build polled 2 minutes for
hub@<sha8>. The runner's checkout, build, wait, access-sync and admin steps (M2's command) announce any production
change first. Offline suite with stubs on PATH; README 'Production runs'.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…y key

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…ked and rechecked, a 2-minute deadline, build fails with a reason

production-deploy.sh holds a lock on the checkout's git directory for the whole run, which production-run.sh checkout
takes too, and after the web build (which may queue under DESK_HEAVY_WRAPPER) requires the confirmed HEAD and a clean
tree again before any token is handed over. The deploy's wait and 'wait <sha8>' run to an elapsed-time deadline of 2
minutes, each read's --max-time and each pause cut to what is left (twelve 30 s reads had made it 470 s). 'build' fails
with what it read when production gives no hub build. Tests: a checkout switched during the build, a held lock, slow
reads against a fake clock, a curl that cannot connect.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T02:14:34.484004Z f182dab PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f182dab178

ℹ️ 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".

Comment on lines +81 to +82
git -C $W fetch -q origin master && git -C $W worktree add -q -f --detach $P origin/master || { print -r -- "could not add a worktree of origin/master at $P: stop"; exit 2; }
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Lock newly created checkouts before installing dependencies

When the destination does not exist, this branch creates the worktree without acquiring its desk-production.lock, then proceeds to the potentially queued dependency install. Once the worktree exists, another checkout or production-deploy.sh invocation can acquire that lock and operate on it while the first install is still running. This permits concurrent dependency installation and production build/deploy operations despite the existing-checkout branch explicitly preventing that overlap; the deploy's HEAD and tracked-cleanliness recheck does not detect changes to node_modules. Acquire and hold the destination's lock for the new-worktree installation path as well.

Useful? React with 👍 / 👎.

@SSFSKIM
SSFSKIM merged commit c1bcb3c into master Oct 28, 2026
SSFSKIM added a commit that referenced this pull request Oct 28, 2026
…Decision Log 40's fold complete

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Oct 28, 2026
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant