Skip to content

fix: office-hours marks sessions "success" without writing design doc - #1049

Closed
walton-chris wants to merge 1 commit into
garrytan:mainfrom
walton-chris:fix/office-hours-verify-design-doc-artifact
Closed

walton-chris wants to merge 1 commit into
garrytan:mainfrom
walton-chris:fix/office-hours-verify-design-doc-artifact

Conversation

@walton-chris

Copy link
Copy Markdown

Summary

The office-hours skill can log outcome:success in the timeline even
when Phase 5 (design doc write) was skipped. The session looks
complete in telemetry, but no *-design-*.md artifact exists on disk,
silently breaking downstream skills (/plan-ceo-review,
/plan-eng-review) that read design docs from
~/.gstack/projects/{slug}/.

Repro

Observed in the wild on an apex-coach session (2026-04-12):

{"skill":"office-hours","event":"completed","branch":"master",
 "outcome":"success","duration_s":"0","session":"unknown",
 "ts":"2026-04-12T11:59:40.368Z"}

duration_s:"0" and session:"unknown" are a separate shell-state bug
addressed in a companion PR. But the real issue here is
outcome:"success" logged against ~/.gstack/projects/apex-coach/
which contains zero *-design-*.md files. A session with no
persisted artifact is not a successful session.

Fix

Two changes to office-hours/SKILL.md.tmpl:

  1. New section "Pre-Telemetry: Verify Design Doc Artifact" inserted
    before the {{LEARNINGS_LOG}} placeholder. It re-derives SLUG,
    uses the preamble's ~/.gstack/sessions/\$PPID touch file as a
    session-start time reference, and finds any *-design-*.md
    written after that time. Emits ARTIFACT_STATUS: ok or no_doc.

  2. New rule in Important Rules instructing Claude to use the
    artifact check to drive OUTCOME in the preamble's telemetry
    block. Log outcome:no_doc when no doc was written, never
    outcome:success.

Net diff: +56 lines, 0 deletions. Zero impact on sessions that
correctly write a doc.

Test plan

  • Run `/office-hours` on a new project, complete Phase 5, confirm
    timeline logs `outcome:success` and artifact exists
  • Run `/office-hours`, abandon mid-conversation, confirm timeline
    logs `outcome:no_doc`
  • Run `/office-hours` in a project with existing old design docs,
    confirm the `-newer` check correctly distinguishes this session's
    doc from prior ones

Generated with Claude Code

The office-hours skill can complete the final telemetry block and log
`outcome:success` even when Phase 5 (design doc write) was skipped —
e.g., when a session ends early or the conversation pivots to
implementation. The timeline shows `event:completed` with no
corresponding `*-design-*.md` file on disk, silently losing the
artifact that downstream skills (/plan-ceo-review, /plan-eng-review)
depend on.

Fix: add a "Pre-Telemetry: Verify Design Doc Artifact" section that
runs before the preamble's telemetry block. It re-derives SLUG (since
shell state doesn't persist between Bash tool calls), uses the
preamble's `~/.gstack/sessions/$PPID` touch file as a session-start
time reference, and looks for a fresh design doc written after that
point. Emits `ARTIFACT_STATUS: ok` or `no_doc`.

The Important Rules section now instructs Claude to use this result
to drive OUTCOME — never log `success` when `no_doc`.

Repro: observed in apex-coach session 2026-04-12 — timeline logged
`duration_s:"0"`, `session:"unknown"`, `outcome:"success"`, but no
design doc exists in ~/.gstack/projects/apex-coach/.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@time-attack

time-attack commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

@walton-chris Rewrite the session matching so each run checks its own marker and design document; using the newest global marker and any newer slug lets concurrent sessions classify each other.

time-attack pushed a commit to time-attack/gstack that referenced this pull request Jul 22, 2026
capy-ai Bot added a commit that referenced this pull request Oct 8, 2026
…sing, design doc shown before approval, strict timeline --limit (#3075)

* fix(timeline): reject a missing or malformed --limit with exit 2 (#1723)

gstack-timeline-read parsed --limit with parseInt and fell back to 20, so
'--limit 1abc' became 1, 'nope', 0 and -5 silently became the default, and a
bare --limit crashed on an unbound $2. Validate the argument as a positive
integer before the no-timeline early exit and exit 2 with an example. No flag
still means 20.

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

* fix(skill-start): echo SESSIONS, the live session-marker count (#1651)

The sessions directory is touched and expired at skill start, but the count
was never printed, so CLAUDE.md rules that read the preamble's session count
had nothing to read. Echo SESSIONS: N (markers fresher than 120 minutes,
this session included). Idea from @0xDevNinja's PR #1747, redone in the
consolidated skill-start script.

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

* fix(office-hours): pick the closing tier from the profile read before this session is logged (#2801)

Phase 4.5 appended this session to the builder profile and Phase 6 then read
the profile to choose its closing, so every run saw itself as history: a
first-time user got welcome_back and was asked how the assignment issued
minutes earlier went. Phase 4.5 now reads the profile before --log-session and
records the prior tier, count and last-session fields in the transcript;
Phase 6 uses those values (this session is prior + 1) and re-reads only the
running totals. A failed read proceeds as a first session and says so. Tier
headers now name the session numbers each tier actually covers.

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

* fix(office-hours): print the full design doc inline before asking for approval (#879)

Tool output collapses in Claude Code, so users were asked to approve a doc
they could not see. Port of @RyanAlberts's PR #1116 into the carved
design-and-handoff section.

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

* fix(office-hours): report success only when this run wrote its design doc (#1049)

Before telemetry, check the design doc this run wrote, by its exact path under
the state root, never the newest file in the folder. Success needs a
non-empty doc there; otherwise the outcome is abort or error with failed step
design_doc. Rewrite of @walton-chris's PR #1049, which matched the newest
global session marker and hardcoded ~/.gstack.

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

* fix(plan reviews): skip the /office-hours prerequisite offer in spawned and headless sessions (#1958)

The BENEFITS_FROM offer had no recommended option, so a spawned run had
nothing defined to auto-pick and a headless run could only block. Skip it
there and continue with the standard review.

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

* chore: regenerate SKILL.md files

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

* test: office-hours tier order, failed-read fallback, inline doc, design-doc check and offer skip

Rendered-block tests run the Phase 4.5 read and log on a temp state root
(first session reads introduction, failed read is marked) and the
pre-telemetry check against this run's doc, an empty doc, another session's
doc and a path outside the state root. Parity caps take the measured growth.

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

* chore(release): v1.91.37.0 changelog and TODOS

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

* test(browse): run watchdog test servers under a private HOME

The headed-mode case starts a real server with BROWSE_HEADED=1, and its
headed launch writes ~/.gstack/.auth.json for the extension. With the
caller's HOME, a slow kill let that write reach the real home and failed the
free runner's home-containment check (free-suite shard 5 on #3075). Give each
spawned server a private HOME and GSTACK_HOME, keeping Playwright's browser
cache path.

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

* test(evals): name the office-hours-auto-mode case so the PR lane can select it

The PR lane runs each short probe with a Bun name pattern ending in its case
id. The office-hours AskUserQuestion-blocked smoke had a descriptive test
name and no CASE_TEST_NAMES label, so whenever office-hours changed its shard
matched 0 tests and failed in 0 s (E2E Evals slice 6 on #3075). Name the
test after its id, keep the description on the describe, and check that
every literal-named PR probe has a test the pattern selects.

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

* fix(office-hours): skip a last-session greeting clause whose value is empty

A profile backfilled from the timeline can carry a welcome_back or regular
tier with empty LAST_ASSIGNMENT and LAST_PROJECT. The welcome_back and
regular greetings now drop the "last time" clause and its question when the
value it names is empty, and say only "Welcome back."

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 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Landed in v1.91.54.0 (#3075), rewritten with credit to you: /office-hours now records success only when this run actually wrote its design doc. Thank you @walton-chris!

@capy-ai capy-ai Bot closed this Oct 8, 2026
levi85 pushed a commit to levi85/gstack that referenced this pull request Oct 14, 2026
…sing, design doc shown before approval, strict timeline --limit (garrytan#3075)

* fix(timeline): reject a missing or malformed --limit with exit 2 (garrytan#1723)

gstack-timeline-read parsed --limit with parseInt and fell back to 20, so
'--limit 1abc' became 1, 'nope', 0 and -5 silently became the default, and a
bare --limit crashed on an unbound $2. Validate the argument as a positive
integer before the no-timeline early exit and exit 2 with an example. No flag
still means 20.

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

* fix(skill-start): echo SESSIONS, the live session-marker count (garrytan#1651)

The sessions directory is touched and expired at skill start, but the count
was never printed, so CLAUDE.md rules that read the preamble's session count
had nothing to read. Echo SESSIONS: N (markers fresher than 120 minutes,
this session included). Idea from @0xDevNinja's PR garrytan#1747, redone in the
consolidated skill-start script.

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

* fix(office-hours): pick the closing tier from the profile read before this session is logged (garrytan#2801)

Phase 4.5 appended this session to the builder profile and Phase 6 then read
the profile to choose its closing, so every run saw itself as history: a
first-time user got welcome_back and was asked how the assignment issued
minutes earlier went. Phase 4.5 now reads the profile before --log-session and
records the prior tier, count and last-session fields in the transcript;
Phase 6 uses those values (this session is prior + 1) and re-reads only the
running totals. A failed read proceeds as a first session and says so. Tier
headers now name the session numbers each tier actually covers.

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

* fix(office-hours): print the full design doc inline before asking for approval (garrytan#879)

Tool output collapses in Claude Code, so users were asked to approve a doc
they could not see. Port of @RyanAlberts's PR garrytan#1116 into the carved
design-and-handoff section.

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

* fix(office-hours): report success only when this run wrote its design doc (garrytan#1049)

Before telemetry, check the design doc this run wrote, by its exact path under
the state root, never the newest file in the folder. Success needs a
non-empty doc there; otherwise the outcome is abort or error with failed step
design_doc. Rewrite of @walton-chris's PR garrytan#1049, which matched the newest
global session marker and hardcoded ~/.gstack.

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

* fix(plan reviews): skip the /office-hours prerequisite offer in spawned and headless sessions (garrytan#1958)

The BENEFITS_FROM offer had no recommended option, so a spawned run had
nothing defined to auto-pick and a headless run could only block. Skip it
there and continue with the standard review.

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

* chore: regenerate SKILL.md files

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

* test: office-hours tier order, failed-read fallback, inline doc, design-doc check and offer skip

Rendered-block tests run the Phase 4.5 read and log on a temp state root
(first session reads introduction, failed read is marked) and the
pre-telemetry check against this run's doc, an empty doc, another session's
doc and a path outside the state root. Parity caps take the measured growth.

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

* chore(release): v1.91.37.0 changelog and TODOS

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

* test(browse): run watchdog test servers under a private HOME

The headed-mode case starts a real server with BROWSE_HEADED=1, and its
headed launch writes ~/.gstack/.auth.json for the extension. With the
caller's HOME, a slow kill let that write reach the real home and failed the
free runner's home-containment check (free-suite shard 5 on garrytan#3075). Give each
spawned server a private HOME and GSTACK_HOME, keeping Playwright's browser
cache path.

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

* test(evals): name the office-hours-auto-mode case so the PR lane can select it

The PR lane runs each short probe with a Bun name pattern ending in its case
id. The office-hours AskUserQuestion-blocked smoke had a descriptive test
name and no CASE_TEST_NAMES label, so whenever office-hours changed its shard
matched 0 tests and failed in 0 s (E2E Evals slice 6 on garrytan#3075). Name the
test after its id, keep the description on the describe, and check that
every literal-named PR probe has a test the pattern selects.

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

* fix(office-hours): skip a last-session greeting clause whose value is empty

A profile backfilled from the timeline can carry a welcome_back or regular
tier with empty LAST_ASSIGNMENT and LAST_PROJECT. The welcome_back and
regular greetings now drop the "last time" clause and its question when the
value it names is empty, and say only "Welcome back."

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>
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