Repository navigation
Release v0.16.3 — More reliable triggers and clearer usage tracking - #12969
Conversation
…X-5031) (#12950) ## Demo video No demo video: code-only change. The diff adds one unit test. No renderer or runtime code changes, so there is no new screen to record. ## Quick verification - **Outcome:** a `/command` message now has a test for its replay privacy. The test checks that the command chip and the args the person typed sit inside the `[data-replay-content]` region. That region is what `REPLAY_CONTENT_SELECTOR` (existing, `apps/web/src/lib/analytics/posthog-config.ts`) hides in a session replay. Until now no test on `dev` checked the marker on user-message text, so a renderer refactor could drop it and leak typed command args into replays without failing anything. - **Why this shape (the issue's acceptance, as I read it):** KRTX-5031 asked to add `data-replay-content` to the four byte-identical command-markup fixtures. #12923 (KRTX-5013) has since deleted those fixtures from `dev` under AGENTS.md testing rule 6 ("delete on red"), and two earlier attempts stopped there as obsolete. I did not restore the deleted fixtures. Instead I kept the issue's intent: the command markup must carry the replay redaction marker. I assert it as a privacy behavior (rule 6 keeps tests for secrets and privacy decisions). The production renderer is unchanged (existing `packages/ui/src/session/turn/user-message.tsx:1169`), and no assertion is weakened. - **Caller boundary:** the command comes either from `commandInfo` passed by `transcript.tsx:1730` or from `detectCommandFromText`. Both render through the single `UserMessageBubble` call site (existing, `user-message.tsx:2110`), so this test covers the one region both paths share. - **Red before green:** I removed `data-replay-content=""` from the renderer and ran the new test: `0 pass, 1 fail` with `expect(received).not.toBeNull() Received: null`. I then restored the renderer and it passed. - **Risk:** low. The diff is test-only: one test and one `happy-dom` import, which is already a devDependency of `@kortix/ui` and is used by sibling tests. - **Verified:** `bun test src/session/turn/user-message.test.tsx` gives 97 pass, 0 fail. The whole `@kortix/ui` suite (`pnpm test`) gives 9599 pass, 0 fail. `pnpm typecheck` exited 0, and eslint on the changed file exited 0. Not run: the local stack and the browser, because the diff changes no runtime code and nothing new is visible. - suna-skills: contributing, create-pr (template), testing, worktree, learnings (searched replay/posthog: no entry for this surface) - ponytail: full · review: Lean already. Ship. · markers: 0 - Self-review: 1 items found and fixed (the first draft's `hidden?.querySelector(...)` was `undefined` with no marker and still passed `.not.toBeNull()`; it is now a descendant selector, which fails with `null`) - Closes KRTX-5031 ``` $ cd packages/ui && bun test src/session/turn/user-message.test.tsx -t "replay" # renderer marker removed error: expect(received).not.toBeNull() Received: null 0 pass 1 fail $ cd packages/ui && bun test src/session/turn/user-message.test.tsx 97 pass 0 fail 315 expect() calls Ran 97 tests across 1 file. [1353.00ms] $ cd packages/ui && pnpm test 9599 pass 0 fail Ran 9599 tests across 872 files. [538.46s] $ cd packages/ui && pnpm typecheck; echo exit=$? exit=0 $ cd packages/ui && pnpm exec eslint src/session/turn/user-message.test.tsx; echo exit=$? exit=0 ``` <!-- codesmith:footer --> --- <a href="https://dashboardbackend.blacksmith.sh/track/enable-autofix?expires=1797779707&installation_model_id=434224&pr_number=12950&ref=codesmith_pr_footer&repository=kortix-ai%2FCompanyOS&return_to=https%3A%2F%2Fgithub.com%2Fkortix-ai%2FCompanyOS%2Fpull%2F12950&signature=7f218d6b347215fbb4b0137bfc7825c6cdc0ecf4fbd1bf712d7f5335532c2c9a"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a> <sup><a href="https://app.blacksmith.sh/kortix-ai/codesmith/CompanyOS/pr/12950?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> Co-authored-by: Kortix Agent <292857086+agent-kortix@users.noreply.github.com>
…-5042) (#12956) ## Demo video No demo video: code-only change. Gateway valuation and subscription accounting only. ## Quick verification - Outcome: price Sol, Terra, Morph's documented upstream proxy, and Claude 5.5 Opus/Sonnet. Record Claude input/output/cache usage without charging subscription calls or logging payloads. Closes KRTX-5042. - Feedback: require observed input/output counters; malformed, oversized or invalid frames stay incomplete and unpriced. Optional cache counters default to zero. Relay bytes unchanged. Claude settlement cannot release a paid request's block-budget reservation. - Risk: unknown models stay unpriced; historical missing Claude usage cannot be recovered. Morph retail proxy is not a bill. No migration. Roll back by reverting this PR. - Verified on head 92d8743 after merging origin/dev: the commands below passed. No whole-package suites: repository AGENTS.md requires named targeted files. ```sh . scripts/hermetic-test-env.sh bun --env-file=apps/api/scripts/test.env test --isolate packages/llm-gateway/src/claude-code/usage.test.ts packages/llm-gateway/src/claude-code/passthrough.test.ts packages/llm-gateway/src/create-gateway.test.ts apps/api/src/shared/llm-value.test.ts apps/api/src/llm-gateway/hooks.test.ts apps/api/src/__tests__/unit-gateway-budgets.test.ts apps/cli/src/__tests__/sessions-usage.test.ts apps/cli/src/__tests__/gateway.test.ts 131 pass 0 fail 394 expect() calls Ran 131 tests across 8 files. [20.61s] bun test packages/llm-gateway/src/claude-code/usage.test.ts packages/llm-gateway/src/create-gateway.test.ts 27 pass 0 fail 83 expect() calls Ran 27 tests across 2 files. [259.00ms] pnpm --filter @kortix/llm-gateway typecheck # exit 0 pnpm --filter kortix-api typecheck # exit 0 cd apps/api && ../../node_modules/.bin/eslint src/llm-gateway/hooks.ts src/llm-gateway/hooks.test.ts src/shared/llm-value.ts src/shared/llm-value.test.ts src/shared/integration-llm-value.test.ts # exit 0; 0 errors, 3 ignored-test warnings ``` - Red before fix: usage parser 6 pass / 4 fail; real HTTP caller with old parser 15 pass / 2 fail; reservation regression 29 pass / 1 fail. Real local upstream tests assert 11/23/37/53 plain/read/write/output becomes inclusive input 71/output 53, plus damaged JSON/SSE produce estimated usage and unsuccessful traces without changing response bytes. - Unrun this session: local API stack, GW-11, and DB suites. `pnpm worktree start krtx-5042-rework --no-web` failed: primary Supabase REST 503 because schema `kortix` does not exist; primary Supabase credentials unavailable. No deployed CLI/provider call or paid subscription call. The prior worker's DB evidence remains in the earlier PR history; it is not a run from this session. - DB assertions inspected: integration-llm-value still prices exact provider/model rows and daily series; integration-session-usage still sums recorded counts; gateway-series and covering-index suites keep unchanged columns/indexes. No schema change. The repair only invalidates damaged usage and avoids releasing an unreserved Claude request. - Self-review: 1 items found and fixed (block-budget release). A–H checked against all acceptance criteria; caller/adapter traced from gateway HTTP routes through createGateway, passthrough, observer and settlement. No alternate production observer caller exists. Independent G9 remains required. - suna-skills: worktree, testing, learnings, contributing (attachments and preview references), create-pr, claude-cli - ponytail: full · review: Lean already. Ship. · markers: 0 - Issue: https://linear.app/kortix/issue/KRTX-5042 --------- Co-authored-by: Kortix Agent <292857086+agent-kortix@users.noreply.github.com>
…abels (#12962) The reviewer path on prod is email, "Use a password", Allow, then Finish on the welcome tab; the prompt goes in the workspace home. The reference also records how the reviewer account is created.
## Review in 60 seconds - Config commits now include `Kortix-Actor` and `Kortix-Session` trailers from server authentication. - Manifest, prompt, agent governance/default, and skill multi-file writes share one formatter. Both Git CLI and GitHub Contents paths carry attribution. - A dedicated authentication-session field prevents route-target sessions or request-body identity fields from changing attribution. Missing identity/session is recorded as `none`. No demo video: code-only change **Risk:** Adds authenticated principal identifiers to workspace Git history, as requested. No schema, permissions, author identity, or public API change. Revert this PR to stop adding trailers; existing commits remain unchanged. **Verified:** Focused tests: 30 pass, 0 fail. Related tests: 130 pass, 0 fail. API typecheck exit 0. Changed-file eslint exit 0 (test files ignored by existing config). Real local bare-Git commit and persisted message verified. Full-stack flow could not run: fresh Supabase PostgREST requires the absent `kortix` schema before stack startup/migrations complete. suna-skills: worktree, testing, learnings, contributing, create-pr ponytail: full · review: Lean already. Ship. · markers: 0 Self-review: 1 items found and fixed ## Demo video No demo video: code-only change. Real Git commit assertions and Hono request/principal boundary tests provide the relevant proof. ## Quick verification Outcome: platform config commits identify their authenticated caller without accepting body-supplied identity. `bun --env-file=scripts/test.env test --isolate src/lib/request-context.test.ts src/projects/git/manifest-cas.integration.test.ts src/projects/lib/commit-manifest-cas.test.ts src/middleware/auth-config-attribution.test.ts src/projects/lib/config-commit-message.test.ts` → 30 pass; 0 fail; 74 expect() calls. Closes KRTX-5049 — https://linear.app/kortix/issue/KRTX-5049 Root cause: config writers forwarded operation-only messages; token-bound session identity was not propagated to asynchronous request context. Caller boundary: actual `patPrincipal`, `serviceAccountPrincipal`, and `jwtPrincipal` run behind a Hono request adapter with forged body IDs and a different route-target session. The commit formatter retains the principal identity. An actual local bare Git repository proves the stored manifest commit contains the trailers. GitHub Contents and Git CLI adapters are separately asserted. Alternate direct agent-config and project-skills callers explicitly use the same formatter; OAuth already propagates the authenticated user and has no bound platform session. Self-review A–H: all acceptance behaviors covered; no permission, schema or rollout change. One test fixture lacked required project-row fields; fixed without casts. Ponytail review: Lean already. Ship. No new dependencies. Independent G9 remains the merge gate's responsibility. ## How was this tested? `bun --env-file=scripts/test.env test --isolate src/lib/request-context.test.ts src/projects/git/manifest-cas.integration.test.ts src/projects/lib/commit-manifest-cas.test.ts src/middleware/auth-config-attribution.test.ts src/projects/lib/config-commit-message.test.ts` → 30 pass; 0 fail; 74 expect() calls. Commands ran from `apps/api` unless stated otherwise. ```text bun test apps/api/src/projects/lib/config-commit-message.test.ts # Before implementation (identity formatter returned the unmodified operation): 0 pass 4 fail 4 expect() calls Ran 4 tests across 1 file. [54.00ms] bun --env-file=scripts/test.env test --isolate src/middleware/auth-config-attribution.test.ts src/projects/lib/commit-manifest-cas.test.ts src/projects/git/manifest-cas.integration.test.ts # Removed auth-session propagation and manifest-message attribution, retaining tests: 17 pass 5 fail 61 expect() calls Ran 22 tests across 3 files. [4.77s] bun --env-file=scripts/test.env test --isolate src/lib/request-context.test.ts src/projects/git/manifest-cas.integration.test.ts src/projects/lib/commit-manifest-cas.test.ts src/middleware/auth-config-attribution.test.ts src/projects/lib/config-commit-message.test.ts 30 pass 0 fail 74 expect() calls Ran 30 tests across 5 files. [4.74s] bun --env-file=scripts/test.env test --isolate src/middleware/auth.test.ts src/middleware/auth-characterization.test.ts src/middleware/auth-sso-sync.test.ts src/projects/lib/triggers.test.ts src/projects/git/manifest-imports.integration.test.ts src/connectors/manifest-crud-create-only.test.ts src/__tests__/unit-auth-logout-revocation.test.ts src/__tests__/unit-secret-grant-route.test.ts 130 pass 0 fail 413 expect() calls Ran 130 tests across 8 files. [8.71s] # Repository root: pnpm --filter kortix-api typecheck > tsgo --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsgo.tsbuildinfo exit 0 # apps/api: ../../node_modules/.bin/eslint src/lib/request-context.ts src/middleware/auth-principal.ts src/middleware/auth-config-attribution.test.ts src/projects/lib/config-commit-message.ts src/projects/lib/config-commit-message.test.ts src/projects/lib/trigger-manifest.ts src/projects/routes/agent-config.ts src/projects/routes/project-skills.ts 0 errors, 2 warnings (test files ignored by existing configuration) exit 0 # Repository root: pnpm worktree start krtx-5049 supabase_rest_kortix-local unexpected status 503 Failed to load the schema cache: schema "kortix" does not exist primary Supabase credentials are unavailable exit 1 pnpm test -- --id PROJ-19 local database migration exited with code 1 code: "57P01" (stack startup stopped the database after failed health checks) FAIL api-cli-flows exit 1 git merge origin/dev --no-edit Already up to date. git diff --check exit 0 ``` Full API package suite was not run: repo AGENTS.md and testing skill explicitly prohibit whole-package runs during development. Focused and related files were run instead. Unverified DB-backed coverage: `integration-iam-build-actor.test.ts` uses principal bindings unchanged by the added context field; `integration-session-list-poll-memo-attribution.test.ts` and `integration-session-participants-roster.test.ts` retain session/participant state unchanged. `PROJ-19` config bodies/responses, CAS and permissions are unchanged; only Git messages gain trailers. Local HTTP stack and deployed-dev verification remain unverified. The Git-only `manifest-cas.integration.test.ts` and `manifest-imports.integration.test.ts` did run successfully. Co-authored-by: Kortix Agent <292857086+agent-kortix@users.noreply.github.com>
## Demo video No demo video: code-only change. ## Quick verification Outcome: KRTX-5050 rejects undeclared agents in `on`/`run` triggers. POST and PATCH refuse new manifest errors before committing. - The validator reports `triggers[i].run.agent`; declared agents, `default`, `mykortix`, its legacy alias, and omitted agents remain valid. Flat references remain checked. - Root cause: cross-validation read only flat `agent`; trigger CRUD also did not call the existing added-error validator. Reused `addedManifestErrors` on both write paths. - **Risk:** invalid trigger edits now return 400. Existing unrelated manifest errors remain editable. No migration. Rollback: revert this PR. - **Verified:** manifest-schema and API typechecks exit 0; changed API file ESLint exits 0; 607 targeted parser tests pass; TRG-2 passes through the local HTTP stack, including POST/PATCH refusal and unchanged manifest read-back. ```sh bun test packages/manifest-schema/src/__tests__/validator.test.ts packages/manifest-schema/src/__tests__/validator.v3.test.ts packages/manifest-schema/src/__tests__/validator.rules.test.ts packages/manifest-schema/src/__tests__/validator.coverage.test.ts packages/manifest-schema/src/__tests__/json-schema.conformance.test.ts 607 pass 0 fail 1601 expect() calls Ran 607 tests across 5 files. [1336.00ms] pnpm test -- --id TRG-2 results: 1/1 passed · 0 failed · 0 skipped · 0 todo · 1.5s [test] PASS api-cli-flows 46.5s pnpm --filter @kortix/manifest-schema typecheck exit 0 pnpm --filter kortix-api typecheck exit 0 cd apps/api && bunx eslint src/projects/routes/triggers.ts exit 0 ``` Before fix: validator regression run had `84 pass; 5 fail`. Before the route guard, TRG-2 failed: `expected [400], got 201`. The final flow verifies both POST and PATCH reject `ghost`, and reads the manifest back unchanged. The existing create still returns 201. Adapter check: `bun --no-env-file /workspace/out/run-adapter.ts` launches the existing `trigger-on-run.test.ts` with the deterministic local API environment: `8 pass; 0 fail; 15 expect() calls`. Unrun: full package/release suites, prohibited during development by repository AGENTS.md/testing. Dev deployment verification awaits merge. No external managed Git repository or cloud sandbox is used; the local flow uses its real bare-Git fixture and database. Self-review: 2 items found and fixed. Final A–H review: no outstanding defects. Caller boundary: POST/PATCH → draft → on/run serializer → addedManifestErrors → canonical validator; the CLI shares the validator. No helper duplication or dependency added. suna-skills: worktree, testing, learnings, contributing (attachments and preview references), create-pr. ponytail: full · review: Lean already. Ship. · markers: 0 Closes https://linear.app/kortix/issue/KRTX-5050 <!-- codesmith:footer --> --- <a href="https://dashboardbackend.blacksmith.sh/track/enable-autofix?expires=1797812988&installation_model_id=434224&pr_number=12967&ref=codesmith_pr_footer&repository=kortix-ai%2FCompanyOS&return_to=https%3A%2F%2Fgithub.com%2Fkortix-ai%2FCompanyOS%2Fpull%2F12967&signature=1de79ac7a44ca6cc2772007901bcedf5260842cd408e94a12308196767d16d33"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a> <sup><a href="https://app.blacksmith.sh/kortix-ai/codesmith/CompanyOS/pr/12967?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> Co-authored-by: Kortix Agent <292857086+agent-kortix@users.noreply.github.com>
Promote dev b5066c2 to staging
Strix Security Review✅ No open security findings. PR summary: Release v0.16.3 bundles config-commit attribution (the authenticated actor and session are appended to configuration commit messages), recording and valuation of Claude subscription usage, a schema check that trigger `run.agent` references a declared agent, and CI changes that preload Supabase images into the runner template. Review summaryThis release PR changes no runtime behavior that opens a security hole. The parts worth scrutiny — the new commit-attribution trailer and its Ruled out (4)
Review 1 on this PR · Reviewed by Strix |
More reliable triggers and clearer usage tracking
New
Improved
Fixed
Security
Internal