---
name: "Onboarding welcome screen triggers on already-configured projects"
---

# Bug 156: Onboarding welcome screen triggers on already-configured projects

## Description

The onboarding welcome screen ("Welcome to Story Kit — This project needs to be set up...") appears even when the project is fully configured and has been in use for a long time.

## Root Cause

`server/src/io/onboarding.rs` lines 6 and 9 define template markers:

```rust
const TEMPLATE_MARKER_CONTEXT: &str = "Agentic AI Code Assistant";
const TEMPLATE_MARKER_STACK: &str = "Agentic Code Assistant";
```

These markers are phrases that appear in the scaffold templates (`server/src/io/fs.rs` lines 233 and 269). The detection logic (`is_template_or_missing` at line 59) checks if the file *contains* the marker string. But these phrases are generic enough that real project content can contain them too — especially when the project being managed IS an agentic code assistant (i.e. huskies managing itself).

## The Fix

Replace the content-based marker detection with a dedicated sentinel comment that only exists in untouched scaffold templates. The sentinel should be something that would never appear in real content, like an HTML comment:

```
<!-- huskies:scaffold-template -->
```

Changes needed:

1. **`server/src/io/onboarding.rs`**: Replace `TEMPLATE_MARKER_CONTEXT` and `TEMPLATE_MARKER_STACK` with a single `TEMPLATE_SENTINEL` constant set to `"<!-- huskies:scaffold-template -->"`. Update `check_onboarding_status` to use it for both context and stack checks.

2. **`server/src/io/fs.rs`**: Add `<!-- huskies:scaffold-template -->` as the first line of both `STORY_KIT_CONTEXT` and `STORY_KIT_STACK` template constants (lines 233 and 269).

3. **`server/src/io/onboarding.rs` tests**: Update the test `needs_onboarding_true_when_specs_contain_scaffold_markers` to use the sentinel instead of the old marker phrases. Also add a test confirming that content containing "Agentic AI Code Assistant" WITHOUT the sentinel does NOT trigger onboarding.

## Key Files

- `server/src/io/onboarding.rs` — detection logic and markers
- `server/src/io/fs.rs` lines 233, 269 — scaffold template content

## Acceptance Criteria

- [ ] Scaffold templates contain the sentinel `<!-- huskies:scaffold-template -->` as first line
- [ ] `needs_onboarding()` returns false for projects whose specs contain "Agentic AI Code Assistant" but NOT the sentinel
- [ ] `needs_onboarding()` returns true for untouched scaffold content (which contains the sentinel)
- [ ] Existing tests updated and passing
- [ ] `cargo clippy` clean
