Skip to content

feat(personas): the hire endpoint — Phase 2's backend, gated behind verified - #1094

Merged
lilyshen0722 merged 9 commits into
mainfrom
feat/persona-hire-endpoint
Aug 22, 2026
Merged

lilyshen0722 merged 9 commits into
mainfrom
feat/persona-hire-endpoint

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Generalizes Scout's signup install into POST /api/personas/:agentName/hire: per-user identity, idempotent install, membership, scripted opener (Recorder's is written). Rides yesterday's D5 ceiling (#1091) — the second hosted seat is now priceable. Deliberately inert in production until a persona's registry row flips verified: the same curation boundary as the catalog gate doubles as the launch switch, so merging this ships no user-visible change. 5 red-first tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8

Per-user identity (u+sha256 prefix — one colleague per user per persona,
same derivation as signup so the two can never disagree), idempotent upsert
on the full identity key (the #1086 dup class is impossible by
construction), membership, and the scripted it-speaks-first opener. The
registry row's verified flag is the hireable switch — flipping a persona to
verified IS its seat's launch.
… API

Thin over the service: auth, rate limit, the hosted-seat gate (same
cloud_agents_not_entitled refusal the UI already redirects on), pod
membership, and the 07-24 community-pod rule. Role and entitlements load
from DB — req.user carries { id } only on JWT sessions.
Per-user identity + idempotent upsert + intro post; unverified refused
(verified IS the switch); unknown 404-shaped; perUser refused (signup owns
Scout); a failed intro never fails the hire.
The route feeds req.params.agentName into the service, which made an old
display-label regex reachable with user input (js/polynomial-redos is a NEW
DATAFLOW, not new code) and put user data in a log format string. One gate
kills both: nothing downstream sees anything but a validated lowercase
slug, and the log's format string is constant.
@lilyshen0722
lilyshen0722 merged commit c5b405d into main Aug 22, 2026
11 checks passed
@lilyshen0722
lilyshen0722 deleted the feat/persona-hire-endpoint branch August 22, 2026 04:25
lilyshen0722 added a commit that referenced this pull request Aug 23, 2026
…njection

The id arrives from agent-supplied metadata; String() at the entrance
collapses operator-object payloads into literals that match nothing.
Surfaced by this PR's re-traced dataflow, same class as #1094's lesson.
lilyshen0722 added a commit that referenced this pull request Aug 23, 2026
…cue (TASK-052) (#1176)

* feat(agents): thread-aware reads, in-thread posts, and the threading cue (TASK-052)

The cue teaching agents the three verbs was held on one finding: peers
reading context could not see thread structure, so teaching agents to put
continuations in threads would hide the work from its audience. Both
halves now exist, so the cue ships with them:

READ — getRecentMessages' PG mapping carries thread_root_id,
reply_to_message_id and the formatted replyTo (explicit null = not in a
thread; the Mongo fallback omits the keys = server cannot say, same
convention as the frontend). ?threadRootId= on the runtime messages read
scopes to one thread (root + rooted rows); the Mongo fallback REFUSES a
thread-scoped read rather than returning the pod as if it were the thread.

WRITE — threadRootId on the agent post body continues a thread WITHOUT
addressing anyone (constraint 5), through the same threadRootResolver and
five rejections as the human composer; ThreadRootError resolves BEFORE the
PG try so it can never be swallowed into the Mongo fallback as a silently
un-threaded row, and the route maps it to a 400 with the resolver's code.

CUE — the pod-context frame teaches the three verbs, quote-thread
independence, and Sam's overflow rule (prose continuations go in a thread;
attachments are for genuine artifacts), promising only what the kernel
now enforces.

10 new executing tests across three suites; two existing call-contract
pins widened for the new trailing argument; 698/698 across the service +
mention + route suites.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TdEJoXUmbHmW5TFk7hfkbK

* fix(events): taint boundary on markPosted's eventId — CodeQL js/sql-injection

The id arrives from agent-supplied metadata; String() at the entrance
collapses operator-object payloads into literals that match nothing.
Surfaced by this PR's re-traced dataflow, same class as #1094's lesson.

* fix(events): typeof gate on markPosted's eventId — the barrier CodeQL models

* fix(events): primitive gates on every operand of markPosted's filter

---------

Co-authored-by: Claude Fable 5 <[email protected]>
samxu01 pushed a commit that referenced this pull request Aug 29, 2026
…claim

Two corrections from sprint-review's gate, both verified here rather than
accepted:

- /pulls/:n/comments (inline review comments) is a third collection and does
  carry commit_id. The rule stands — every inline comment's
  pull_request_review_id resolves to an event /pulls/:n/reviews returns
  (#1312, #1302, #1260) — but the entry's surface count was wrong, in an
  entry about getting a surface count wrong. Also: they are not rare here;
  a repo-wide sweep finds them on #1312/#1302/#1297/#1274/#1260/#1176/#1094/#1022.
  The 0-across-five-PRs sample was all docs rows.

- The entry claimed the comments collection is "what gh pr view N prints
  without flags". False. Bare gh pr view prints neither. --comments prints
  BOTH interleaved, split only by a status: line and with no sha on either;
  --json comments returns half. On #1338: 2 vs 1.

Co-Authored-By: Claude Opus 5 <[email protected]>
lilyshen0722 added a commit that referenced this pull request Aug 30, 2026
… a commit (#1338)

* docs(ax): entry 51 — a PR's two comment surfaces, and the one without a commit_id

`gh pr view --json comments` and `/pulls/:n/reviews` are disjoint sets, not a
set and a subset: `gh pr review --comment` files a review event that never
appears in the comments collection. The comments surface is the default
projection and the obvious one to reach for, so an agent asking "has anyone
gated the tree that would press?" reads it, sees nothing, and concludes nobody
has — which is what produced a false published warning against pressing a
ready PR.

The sharper half is that an issue comment carries no `commit_id` at all, so
that surface cannot answer the question even when it does show a gate.
Measured across eight open PRs: one with a live gate a comments read omits,
one with a gate at a dead sha, and one correctly gated with zero review
events, where the only thing binding the approval to a tree is that the
reviewer typed the sha into the prose.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs(ax): entry 51 — third collection, and correct the gh-projection claim

Two corrections from sprint-review's gate, both verified here rather than
accepted:

- /pulls/:n/comments (inline review comments) is a third collection and does
  carry commit_id. The rule stands — every inline comment's
  pull_request_review_id resolves to an event /pulls/:n/reviews returns
  (#1312, #1302, #1260) — but the entry's surface count was wrong, in an
  entry about getting a surface count wrong. Also: they are not rare here;
  a repo-wide sweep finds them on #1312/#1302/#1297/#1274/#1260/#1176/#1094/#1022.
  The 0-across-five-PRs sample was all docs rows.

- The entry claimed the comments collection is "what gh pr view N prints
  without flags". False. Bare gh pr view prints neither. --comments prints
  BOTH interleaved, split only by a status: line and with no sha on either;
  --json comments returns half. On #1338: 2 vs 1.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs(ax): entry 51 — the gate check built from it is prefix-width-sensitive

The #1330 case forces a prose-sha query; that query has a free width
parameter. This repo writes 8-char shas, so a 9-char prefix returns zero
across all 12 open PRs measured — indistinguishable from an arm that never
ran. At 8 it finds a gate at head on 9 of 12. Prescribe 7 (git's minimum
abbreviation) plus a positive control for any arm that returns an
all-population zero.

Co-Authored-By: Claude Opus 5 <[email protected]>

* docs(ax): entry 51 — delete the prefix width, don't retune it

sprint-review's review of 4ce6e8a is right twice. "This repo writes 8"
is a majority habit, not a rule — #1322 and a #1325 comment write 9
(re-derived, not borrowed). And "cut to 7 so it catches any convention
shorter than 8" is self-refuting: grep 'a1607e8' does not match a1607e,
so 7 relocates the threshold and tells the next reader the check is safe.

Replace the width with a width-free comparison: extract hex tokens from
the body and test whether the head STARTS WITH the token. Verified on the
same population (a1607e8 on #1330, 35e4a1a on #1327). The residual
minimum-token-length knob fails by over-reporting, which is visible,
rather than to zero, which reads as an answer. Promote the positive
control above the width advice — it is what catches the class.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
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.

2 participants