Skip to content

v1.91.233.0 fix(plan-tune): bound each UTC day's pull on a dimension, record contributing_events (GSTA-79) - #3397

Merged
capy-ai[bot] merged 11 commits into
mainfrom
capy/plan-tune-session-cap
Oct 26, 2026
Merged

capy-ai[bot] merged 11 commits into
mainfrom
capy/plan-tune-session-cap

Conversation

@garrytan

@garrytan garrytan commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3397,
  "head": "d91337dd4b5ea8ffaa1768b2a24cd166c284736a",
  "version": "1.91.187.0",
  "base": "main",
  "gate": {
    "tests": {
      "pass": 177,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "pregate": "requires-remote cleared @fff627b83bb2 (1 checks, current for d91337dd4b5e)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/40255799776",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/40255804021",
    "pregate.json/remote_gate: remote-gate tree=fff627b83bb2 tests=11739"
  ],
  "issues": {
    "fixes": [
      2623
    ],
    "refs": [
      2625,
      3436,
      3442
    ],
    "flakes": []
  }
}

What changed

Before: eight reviews with five "fix now" answers each pin architecture_care at 0.998 with no evidence count. After: each UTC day moves a dimension at most ±0.06, so the same log reads 0.808 with contributing_events 40.

Before: forty "fix now" answers on /plan-eng-review pin architecture_care at 0.998, and nothing records how many answers sit behind the number. After: each UTC day moves a dimension at most one strong answer's worth (±0.06), so the same log reads 0.808, contributing_events shows the 40 answers, and --trace shows each capped day with a total that matches --derive (#2623).

Text before/after

Before:

$ gstack-developer-profile --profile  (inferred, abridged)
{ "architecture_care": 0.998, "sample_size": 40, "contributing_events": "(not recorded)" }
$ gstack-developer-profile --trace architecture_care | tail -2
  2026-04-08T10:04:00  plan-eng-review-arch-finding  → fix-now  (+0.05)
  2026-04-08T10:05:00  plan-eng-review-arch-finding  → fix-now  (+0.05)

After:

$ gstack-developer-profile --profile  (inferred, abridged)
{ "architecture_care": 0.808, "sample_size": 40,
  "contributing_events": { "risk_tolerance": 40, "architecture_care": 40, "scope_appetite": 0, "detail_preference": 0, "autonomy": 0 } }
$ gstack-developer-profile --trace architecture_care | tail -3
  day 2026-04-07: +0.250 capped to +0.060
  day 2026-04-08: +0.250 capped to +0.060
TOTAL: +0.480 (each UTC day capped at ±0.06) → 0.808
  • Per-UTC-day bound (bin/gstack-developer-profile): --derive sums each UTC day's deltas per dimension and clamps the sum to the largest single delta in the signal map (±0.06 today, computed from SIGNAL_MAP, so no new constant). Answers within a day net out before the clamp. The day comes from an ISO 8601 ts (a zoneless or space-separated one reads as UTC); rows without one share a single undated bucket.
  • This changes how the bound is keyed. The first version of this PR bounded per session_id. /ship's reviews showed session_id can't carry the bound: the question-log hook and the agent log the same answer under different ids, and the agent often logs the literal SESSION_ID placeholder, so a session-keyed bound double counts or collapses unrelated reviews. Keying by UTC day needs nothing the writers supply beyond ts. The accepted cost: several reviews on one day count as one.
  • One accumulation for derive and trace: --derive and --trace share accumulateSignals, so the trace explains exactly the value derive wrote: every contributing answer, each capped day and a TOTAL line. Control characters in ts are replaced in --trace so a row can't forge a TOTAL line.
  • inferred.contributing_events: per dimension, the number of unique answers that moved it. A dimension with no evidence reads 0 instead of a bare 0.5 that looks like balanced evidence. days_span uses the same UTC day.
  • Hardening: signal lookups use own properties only (a constructor choice no longer resolves to Object.prototype), null JSONL lines are skipped, and question_id/user_choice must be strings.
  • Docs: docs/designs/PLAN_TUNING_V0.md documents signal_events, contributing_events and the per-day bound; TODOS.md narrows the /plan-tune inferred psychographic never leaves 0.5: SIGNAL_MAP is keyed by stable option keys, the capture hook logs UI labels (0 of 1,286 rows match) #2623 entry to the remaining Gate 1 work (plan-tune: {skill}-{slug} question ids never reach a signal (Gate 1 of #2623) #3442).

Credit

The contributing_events provenance and the GSTACK_QUESTION_LOG_NO_DERIVE test-harness fix are ported from #2625 by @v639dragoon, in their own commit with Co-authored-by. The bound and hardening are separate commits on top. #2625's followed_recommendation → autonomy signal stays parked, as its Oct 8 review decided.

Why

#2623 found three problems. Labels never matched SIGNAL_MAP (fixed by #3394). Once answers do match, a dimension saturates after about eight reviews because every answer adds its full delta, and "no evidence" and "balanced evidence" both print 0.5. Garry's Oct 17 decision on #2623 covered all three; this PR delivers the bound and contributing_events, so a heavy day of reviews can no longer pin a dimension and the profile says how much evidence it has.

Follow-ups filed from /ship's reviews: #3435 (dead applySignal/newDimensionTotals), #3436 (--check-mismatch/--gap ignore contributing_events), #3437 (background derive temp-file race), #3442 (Gate 1 {skill}-{slug} hinted fallback, crediting @v639dragoon), #3443 (no decay), #3444 (spawned-env-deny and auto-decided rows train the profile), #3445 (caller-supplied ts backdating).

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-10-17 #2623: map labels to keys at capture, bound accumulation, record per-dimension contributing_events “3223 subset / Accept all recommendations” (Garry (decision posted on #2623)) standing approval the bound and contributing_events in this PR; label mapping shipped as #3394 none
2026-10-24 Take the #2623 follow-up yourself, porting #2625 with credit “Do it. Take the follow-up yourself.” (GStack Minder) approved this PR, including the #2625 port none
2026-10-25 Run gstack /ship before every READY “we should really be using the gstack ship skill before merging PRs, can you make sure we do that?” (Garry (via GStack Minder, CREW 22)) standing approval this PR's /ship run and receipt none
2026-10-25 How to key the bound after /ship's reviews showed session_id cannot be trusted “A” (GStack Minder (under Garry's standing do it on #2623)) approved per-UTC-day bound (±0.06 per dimension per day), its tests and the PR-body note none
2026-10-25 Close #2623, split Gate 1 into a new issue, narrow TODOS.md:55, file follow-ups “take your recommendation” (GStack Minder (under Garry's standing do it on #2623)) approved Closes #2623; #3442 for Gate 1; TODOS.md one-line edit; issues #3435-#3437 and #3443-#3445 none
2026-10-16 Merge through a train; focused paid runs “standing (CREW 5, 6)” (Garry) standing approval this PR none

Source: gstack-approvals record for capy/plan-tune-session-cap (display only; not an approval citation).

Summary

Test Coverage

All new code paths have test coverage in test/gstack-developer-profile.test.ts: the per-day bound (positive and negative), the SESSION_ID placeholder, the hook-plus-agent double log, a second day still moving (negative control), undated rows sharing one bucket, zoneless and space-separated ts read as UTC under TZ=America/Los_Angeles, non-string question_id/user_choice, a null line, a constructor choice, --trace control characters, and trace/derive agreement.

Tests ran: tests 177

Pre-Landing Review

Review (via ship, 2 cycles, converged): quality 9/10, 0 critical, 5 informational. Specialists: testing, maintainability, security, performance, simplification and red-team ran; data-migration, api-contract, design and state-machines were out of scope. Informational findings were filed as follow-ups (#3435, #3443, #3444, #3445) rather than fixed here.

Gate edits: none detected (no test expectation, threshold, budget, timeout, trial count or case kind changed).

Outside review (adversarial): verified at tree 2d072eb, verdict merge as is and file follow-ups. Both reviews were bound at b2ab7a8; the only later commit (d91337d) changes TODOS.md and CHANGELOG.md text.

Exploratory QA

Functional CLI smoke at b2ab7a8 on isolated state roots: 9/9 probes pass (verdict pass, no open findings). Covered the shared day bound across five session ids, --trace capped days and TOTAL, SESSION_ID placeholder rows, the hook-plus-agent double log, a constructor choice with a null line, control characters in ts, and the undated bucket with zoneless UTC reads.

Design Review

No frontend files changed — design review skipped.

Eval Results

Focused paid case plan-tune-inspect (gate tier, 1 trial) at d91337d: PASS 1/1, $0.13.

Issues

Fixes #2623
Refs #2625
Refs #3436
Refs #3442

Verification Results

Pregate at tree fff627b: typecheck clean; remote free tier 11,739 tests, 0 failed ($0.04); macOS named regressions and the Windows free shard cleared from CI runs on this head (linked in the receipt's pregate record).

TODOS

No TODO items completed in this PR. The #2623 entry (TODOS.md:55) is narrowed to its remaining Gate 1 work, tracked as #3442.

Documentation

Status: current. The release docs match the code at d91337d. No edits, no blockers.

Scope: base 632bde7..d91337d (5 committed files; nothing staged, unstaged or untracked). Changed surface: bin/gstack-developer-profile --derive per-UTC-day bound (±0.06, the largest SIGNAL_MAP delta), inferred.contributing_events, and --trace clamped days with a TOTAL that matches --derive. The 111-file doc inventory was screened for the changed surface; the related docs and their verifying source were read.

Documentation health:

Coverage debt: inferred.contributing_events has reference and explanation coverage (PLAN_TUNING_V0.md); nothing displays it yet (#3436, deliberate). The --trace clamped-day output has reference coverage only (bin usage header and PLAN_TUNING_V0.md); no /plan-tune how-to surfaces --trace. Diagram drift: none.

Test plan

  • bun run typecheck: exit 0
  • Step 16 tests lane (8 files): 177 pass, 0 fail
  • gstack-pregate --stage tests --remote at tree fff627b: 11,739 tests, 0 failed
  • Free Tests (macOS named regressions) and Windows Free Tests on d91337d: green
  • bun run scripts/test-paid-shards.ts --tier gate --case plan-tune-inspect --trials 1: PASS 1/1, $0.13

🤖 Generated with Claude Code

garrytan and others added 2 commits October 24, 2026 23:48
…ofile

Port of the provenance part of #2625 by @v639dragoon: --derive records, per
dimension, how many unique log rows moved it, so "no evidence" and
"balanced evidence" no longer both print a bare 0.5. Also ports the test
harness fix: logQuestion sets GSTACK_QUESTION_LOG_NO_DERIVE=1 so the
background derive cannot race the test's own --derive.

The registry-independent autonomy signal from #2625 stays parked, as the
Oct 8 review decided.

Co-authored-by: v639dragoon <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…g answer; trace shares derive's accumulation (#2623)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 5 commits October 25, 2026 00:01
…doc (heredoc pipe-deadlock guard)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…n-cap

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
Own-property signal lookups so a logged choice such as constructor cannot
break every later --derive; --trace replaces control characters in the
fields it prints; tests for the negative clamp, empty session_id, an
unmatched answer and both fixes; docs and CHANGELOG say the bound keys on
the writer session_id.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A session_id that is an unsubstituted placeholder such as SESSION_ID
counts as its own session instead of collapsing every agent-logged
answer into one bound; a log line that parses to null is skipped; the
accumulation tolerates a dimension it did not seed; the trace test covers
DEL and C1 controls; docs and CHANGELOG wording match the code.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The per-session bound trusted whatever session_id a writer logged. The
PostToolUse hook and the agent log different ids for one review, and an
unsubstituted SESSION_ID placeholder either merged every review into one
bound or left each answer unbounded. Bucketing by the UTC day of ts
stops one burst from pinning a dimension without trusting any id;
several reviews on one day count as one. Decision A from GStack Minder.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
garrytan and others added 2 commits October 26, 2026 01:12
Rows without a parseable string ts share one undated bucket instead of
each escaping the bound; a ts without a zone is read as UTC, so the day
does not depend on the machine's zone; days_span counts the same UTC
days; question_id and user_choice must be strings. Tests pin a zone west
of UTC. CHANGELOG says contributing_events is recorded in the profile
JSON and not displayed yet (#3436).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Only an ISO 8601 date or date-time ts counts as dated; Date alone parses
strings such as "junk 1" as real days, which let junk rows escape the
bound and inflate days_span. A zoneless time, T- or space-separated, is
read as UTC. Tests cover array-valued fields, an offset ts in days_span,
the space separator and every undated row reaching the shared bucket.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai capy-ai Bot changed the title fix(plan-tune): bound each session's pull on a dimension, record contributing_events (GSTA-79) fix(plan-tune): bound each UTC day's pull on a dimension, record contributing_events (GSTA-79) Oct 26, 2026
…n-cap

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
@github-actions github-actions Bot changed the title fix(plan-tune): bound each UTC day's pull on a dimension, record contributing_events (GSTA-79) v1.91.233.0 fix(plan-tune): bound each UTC day's pull on a dimension, record contributing_events (GSTA-79) Oct 26, 2026
@capy-ai
capy-ai Bot merged commit 4216bbb into main Oct 26, 2026
62 checks passed
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.

/plan-tune inferred psychographic never leaves 0.5: SIGNAL_MAP is keyed by stable option keys, the capture hook logs UI labels (0 of 1,286 rows match)

1 participant