~ knotless Search/
↑↓ move↵ open⇧↵ all results

socialweb.computer/socialweb-computer-kcp

socialweb.computer: a compute market on atproto (kcp)

1 collaborator
0
0

publish-spaces: per-request limit, retried

Merged johnandersen777.bsky.social asked to merge into main from socialweb.computer/socialweb-computer-kcp:fix-publish-timeout
docs/plans/0044-ci-by-hand.md+1−1
@@ -379,7 +379,7 @@ everything and exits (finding 5). If its cleanup reports errors (`cleanupErrors`
| 72 | CI on socialweb.computer/socialweb-computer-kcp, 2fb0f74d: release success (the asset cache restored the pinned upstream files), test 16/16 (an asked `release` did not start `test`; asked separately) | the first green CI; prod gate 3 on it next |
| 73 | Prod gate 3 (2fb0f74d), 0013 FROZEN "no answer 5 min after the first prompt": the guest's atirc-agent restarted 45 times on "the mesh identity (ATP_USERNAME, /etc/atirc/iroh_key.hex) is not in the secrets bundle yet" (its atirc.env 0 bytes). The requester wrote ATP_USERNAME at 03:14:12.158, 0.3 s after the guest.secretsUpdated it had just sent (secrets-updated-dt3dah...), and sent none after it: the event's name is `secretsUpdated` of (contract, ref URI, ref CID), and the agent path and atirc.go passed the file path with no CID, so every later change of that file was the same name and dropped as known. The guest refetched once, too early. Fix: the ref names the content (`bundleRef`: path and sha256 of the value), so each distinct bundle version sends one event. Also: a hand identity change needs every requester under `$CI_IDENTITY_DIR/requesters` recorded with the old one moved aside (0012's `qs`, 0013's `mp`, not only `stg`) | fixed (branch fix-secrets-updated-version) |
| 74 | Prod gate 3: 0007:restart, the four 0014 and 0015:pressure read PASS in 0-1 s, but each was `readings.skipped` (staging only); the test host now prints its tick lines on stdout before the JSON result, so gate.sh's `jq` of that file failed and fell through to PASS (and a FAIL's note to "exit 1: readings: ..."). Fix: gate.sh reads the document from its first `{` line | fixed |
| 75 | The v0.0.0-rc168 tag build (53cad0e3): `stage` "killed after 900s": two small PUTs to Spaces answered UnknownError (retried), the 545 MB arm64 binary uploaded in 26 s, the amd64 one's PUT never returned: `publish-spaces.ts` gives a request no time limit. Rerun (attempt 2). A per-request limit is proposed in docs/security/proposed-controls.md (a timeout: not added without the owner) | rerun |
| 75 | The v0.0.0-rc168 tag build (53cad0e3): `stage` "killed after 900s": two small PUTs to Spaces answered UnknownError (retried), the 545 MB arm64 binary uploaded in 26 s, the amd64 one's PUT never returned: `publish-spaces.ts` gives a request no time limit. Rerun (attempt 2). Fix: every S3 request gets a limit that grows with the file (60 s + 1 s per 5 MB), so a hung PUT is aborted and `attempt` retries it (owner, 2026-11-16: not a control) | fixed |
## Runs
docs/security/proposed-controls.md+0−6
@@ -24,12 +24,6 @@ Controls an agent thinks are needed. None is implemented until the owner approve
- Threat: an operator typo takes its own bidder out of the market. There is no upper bound either: a large ratio lets one host commit far more vCPUs than it has cores, which is the operator's choice.
- Proposal: refuse a negative ratio when the bidder starts, and say in `check-host` the ratio the bidder commits.
### publish-spaces: a time limit per upload request
- What: give each S3 request of `scripts/publish-spaces.ts` (`s3.send(..., { abortSignal: AbortSignal.timeout(...) })`) a limit that grows with the file (for example 60 s plus 1 s per 5 MB), so a hung PUT is retried by `attempt` instead of blocking.
- Where: `scripts/publish-spaces.ts` `put` (PutObjectCommand, CopyObjectCommand, HeadObjectCommand); today a request has no limit.
- Threat: not an attacker: Spaces answered two small PUTs UnknownError and left the 600 MB amd64 PUT open, so the rc168 tag build's `stage` step was killed at its 15 min limit (plan 0044 finding 75). Listed here because it is a timeout.
## Existing, not owner-approved
For the owner to keep, change or remove. Listing them changed none of them. Line numbers are of the base of the pull that listed them (fix-marker-cap).
scripts/publish-spaces.ts+6−4
@@ -49,6 +49,8 @@ const manifest = {
files: files.map(({ rel, size, sha256 }) => ({ path: rel, size, sha256 })),
};
const within = (bytes: number) => ({ abortSignal: AbortSignal.timeout(60_000 + Math.ceil(bytes / 5_000_000) * 1000) });
const attempt = async <T>(key: string, fn: () => Promise<T>): Promise<T> => {
for (let n = 1; ; n++) {
try {
@@ -63,7 +65,7 @@ const attempt = async <T>(key: string, fn: () => Promise<T>): Promise<T> => {
const held = async (key: string): Promise<{ sha256?: string; size?: number } | undefined> => {
try {
const h = await s3.send(new HeadObjectCommand({ Bucket: bucket, Key: key }));
const h = await s3.send(new HeadObjectCommand({ Bucket: bucket, Key: key }), within(0));
return { sha256: h.Metadata?.sha256, size: h.ContentLength };
} catch (err) {
if ((err as { $metadata?: { httpStatusCode?: number } }).$metadata?.httpStatusCode === 404) return undefined;
@@ -93,7 +95,7 @@ const put = async (prefix: string, copyFrom?: string) => {
CopySource: encodeURI(`${bucket}/${copyFrom}/${f.rel}`),
MetadataDirective: "COPY",
ACL: "public-read",
})));
}), within(f.size)));
} else {
await attempt(key, async () =>
s3.send(new PutObjectCommand({
@@ -103,7 +105,7 @@ const put = async (prefix: string, copyFrom?: string) => {
ContentType: typeOf(f.rel),
ACL: "public-read",
Metadata: { sha256: f.sha256 },
})));
}), within(f.size)));
}
const how = copyFrom ? `copied from ${copyFrom}` : "uploaded";
console.log(`${key} ${f.size} bytes sha256 ${f.sha256} ${how} (${((Date.now() - started) / 1000).toFixed(1)}s)`);
@@ -117,7 +119,7 @@ const put = async (prefix: string, copyFrom?: string) => {
Body: new TextEncoder().encode(JSON.stringify(manifest, null, 2) + "\n"),
ContentType: "application/json",
ACL: "public-read",
}));
}), within(0));
console.log(`${prefix}/manifest.json (${files.length} files)`);
};
AGENTS.md+2−1
@@ -1273,7 +1273,8 @@ Never add a security control unless the owner explicitly approved that exact con
- allowlists and denylists;
- scope or permission checks;
- sandbox rules;
- timeouts added "for safety".
- timeouts that cut off or refuse a party "for safety" (a time limit that lets a hung request be retried is not a control:
owner, 2026-11-16).
If you think one is needed, add it to `docs/security/proposed-controls.md` and tell the owner. Do not implement it.