veyron2: Remove TODOContext.

I've wired through real contexts through most remaining places.  The
only thing left is in the Java and Javascript bridges.  There I've
left TODO comments instead of using TODOContext.

Change-Id: I5d1de417d0022a531a5d046e6653f3514c38973f
diff --git a/examples/bank/bank/main.go b/examples/bank/bank/main.go
index efbcce9..333163a 100644
--- a/examples/bank/bank/main.go
+++ b/examples/bank/bank/main.go
@@ -9,6 +9,7 @@
 	"os"
 	"strconv"
 	"strings"
+	"time"
 
 	"veyron/examples/bank"
 	vsecurity "veyron/security"
@@ -57,8 +58,10 @@
 		log.Fatal("error binding to server: ", err)
 	}
 
+	ctx, _ := runtime.NewContext().WithTimeout(time.Minute)
+
 	// First, Connect to the bank to retrieve the location you should bind to.
-	newIdentity, bankAccountNumber, err := bankServer.Connect(runtime.TODOContext(), veyron2.RemoteID(*serverPattern))
+	newIdentity, bankAccountNumber, err := bankServer.Connect(ctx, veyron2.RemoteID(*serverPattern))
 	if err != nil {
 		log.Fatalf("%s.Connect failed: %s\n", bankMountTableName, err)
 	}
@@ -142,7 +145,7 @@
 			if e {
 				break
 			}
-			err := accountServer.Deposit(runtime.TODOContext(), amount, veyron2.RemoteID(*serverPattern))
+			err := accountServer.Deposit(ctx, amount, veyron2.RemoteID(*serverPattern))
 			if err != nil {
 				fmt.Printf("%s.Deposit failed: %s\n", accountMountTableName, err)
 				break
@@ -157,7 +160,7 @@
 			if e {
 				break
 			}
-			err := accountServer.Withdraw(runtime.TODOContext(), amount, veyron2.RemoteID(*serverPattern))
+			err := accountServer.Withdraw(ctx, amount, veyron2.RemoteID(*serverPattern))
 			if err != nil {
 				fmt.Printf("%s.Withdraw failed: %s\n", accountMountTableName, err)
 				break
@@ -173,14 +176,14 @@
 			if e1 || e2 {
 				break
 			}
-			err := accountServer.Transfer(runtime.TODOContext(), accountNumber, amount, veyron2.RemoteID(*serverPattern))
+			err := accountServer.Transfer(ctx, accountNumber, amount, veyron2.RemoteID(*serverPattern))
 			if err != nil {
 				fmt.Printf("%s.Transfer failed: %s\n", accountMountTableName, err)
 				break
 			}
 			fmt.Printf("Transferred %d to %d\n", amount, accountNumber)
 		case "balance":
-			balance, err := accountServer.Balance(runtime.TODOContext(), veyron2.RemoteID(*serverPattern))
+			balance, err := accountServer.Balance(ctx, veyron2.RemoteID(*serverPattern))
 			if err != nil {
 				fmt.Printf("%s.Balance failed: %s\n", accountMountTableName, err)
 				break
diff --git a/examples/boxes/android/src/boxesp2p/main.go b/examples/boxes/android/src/boxesp2p/main.go
index ef39c88..250d50d 100644
--- a/examples/boxes/android/src/boxesp2p/main.go
+++ b/examples/boxes/android/src/boxesp2p/main.go
@@ -73,6 +73,7 @@
 	sstore "veyron/services/store/server"
 
 	"veyron2"
+	"veyron2/context"
 	"veyron2/ipc"
 	"veyron2/naming"
 	"veyron2/rt"
@@ -232,7 +233,7 @@
 	}
 }
 
-func (gs *goState) registerAsPeer() {
+func (gs *goState) registerAsPeer(ctx context.T) {
 	auth := vsecurity.NewACLAuthorizer(vsecurity.NewWhitelistACL(
 		map[security.PrincipalPattern]security.LabelSet{
 			security.AllPrincipals: security.LabelSet(security.AdminLabel),
@@ -246,7 +247,7 @@
 	if err := gs.ipc.Serve("", &gs.disp); err != nil {
 		panic(fmt.Errorf("Failed Register:%v", err))
 	}
-	if err := gs.signalling.Add(gs.runtime.TODOContext(), endPt.String()); err != nil {
+	if err := gs.signalling.Add(ctx, endPt.String()); err != nil {
 		panic(fmt.Errorf("Failed to Add endpoint to signalling server:%v", err))
 	}
 }
@@ -264,8 +265,8 @@
 } {
 	return w.DrawInterfaceDrawCall.SendStream()
 }
-func (gs *goState) connectPeer() {
-	endpointStr, err := gs.signalling.Get(gs.runtime.TODOContext())
+func (gs *goState) connectPeer(ctx context.T) {
+	endpointStr, err := gs.signalling.Get(ctx)
 	if err != nil {
 		panic(fmt.Errorf("failed to Get peer endpoint from signalling server:%v", err))
 	}
@@ -274,7 +275,7 @@
 		panic(fmt.Errorf("failed BindDrawInterface:%v", err))
 	}
 	if !useStoreService {
-		val, err := drawInterface.Draw(gs.runtime.TODOContext())
+		val, err := drawInterface.Draw(ctx)
 		if err != nil {
 			panic(fmt.Errorf("failed to get handle to Draw stream:%v\n", err))
 		}
@@ -286,7 +287,7 @@
 		if err != nil {
 			panic(fmt.Errorf("failed to parse endpoint:%v", err))
 		}
-		if err = drawInterface.SyncBoxes(gs.runtime.TODOContext()); err != nil {
+		if err = drawInterface.SyncBoxes(ctx); err != nil {
 			panic(fmt.Errorf("failed to setup remote sync service:%v", err))
 		}
 		initSyncService(endpoint.Addr().String())
@@ -302,12 +303,14 @@
 
 //export Java_com_boxes_GoNative_registerAsPeer
 func Java_com_boxes_GoNative_registerAsPeer(env *C.JNIEnv) {
-	gs.registerAsPeer()
+	ctx := gs.runtime.NewContext()
+	gs.registerAsPeer(ctx)
 }
 
 //export Java_com_boxes_GoNative_connectPeer
 func Java_com_boxes_GoNative_connectPeer(env *C.JNIEnv) {
-	gs.connectPeer()
+	ctx := gs.runtime.NewContext()
+	gs.connectPeer(ctx)
 }
 
 //export Java_com_boxes_GoNative_sendDrawBox
diff --git a/examples/mdb/mdb_init/main.go b/examples/mdb/mdb_init/main.go
index b00013a..f00118f 100644
--- a/examples/mdb/mdb_init/main.go
+++ b/examples/mdb/mdb_init/main.go
@@ -23,6 +23,7 @@
 	"time"
 
 	"veyron/examples/mdb/schema"
+	"veyron2/context"
 	"veyron2/rt"
 	"veyron2/storage"
 	"veyron2/storage/vstore"
@@ -82,6 +83,7 @@
 // state is the initial store state.
 type state struct {
 	store     storage.Store
+	ctx       context.T           // The context to use for all operations.
 	storeRoot string              // The name of the root of the store.
 	tx        storage.Transaction // Current transaction; nil if there's no transaction.
 	idTable   map[string]*value
@@ -135,8 +137,8 @@
 }
 
 // newState returns a fresh state.
-func newState(st storage.Store, storeRoot string) *state {
-	return &state{store: st, storeRoot: storeRoot, idTable: make(map[string]*value)}
+func newState(ctx context.T, st storage.Store, storeRoot string) *state {
+	return &state{store: st, ctx: ctx, storeRoot: storeRoot, idTable: make(map[string]*value)}
 }
 
 // find fetches a value from the store.
@@ -149,7 +151,7 @@
 func (st *state) put(path string, v interface{}) {
 	vlog.Infof("Storing %q = %+v", path, v)
 	st.makeParentDirs(path)
-	if _, err := st.tx.Bind(path).Put(rt.R().TODOContext(), v); err != nil {
+	if _, err := st.tx.Bind(path).Put(st.ctx, v); err != nil {
 		vlog.Infof("put failed: %s: %s", path, err)
 		return
 	}
@@ -160,7 +162,7 @@
 func (st *state) putNamed(name, path string, v interface{}) {
 	vlog.Infof("Storing %s: %q = %+v", name, path, v)
 	st.makeParentDirs(path)
-	s, err := st.tx.Bind(path).Put(rt.R().TODOContext(), v)
+	s, err := st.tx.Bind(path).Put(st.ctx, v)
 	if err != nil {
 		vlog.Infof("Put failed: %s: %s", path, err)
 		return
@@ -175,10 +177,10 @@
 	for i, _ := range l {
 		prefix := filepath.Join(l[:i]...)
 		o := st.tx.Bind(prefix)
-		if exist, err := o.Exists(rt.R().TODOContext()); err != nil {
+		if exist, err := o.Exists(st.ctx); err != nil {
 			vlog.Infof("Error checking existence at %q: %s", prefix, err)
 		} else if !exist {
-			if _, err := o.Put(rt.R().TODOContext(), &schema.Dir{}); err != nil {
+			if _, err := o.Put(st.ctx, &schema.Dir{}); err != nil {
 				vlog.Infof("Error creating parent %q: %s", prefix, err)
 			}
 		}
@@ -190,7 +192,7 @@
 // examples.  It is better to pass a transaction around than risk the race
 // condition of st being used from multiple threads.
 func (st *state) newTransaction() {
-	st.tx = st.store.NewTransaction(rt.R().TODOContext(), st.storeRoot)
+	st.tx = st.store.NewTransaction(st.ctx, st.storeRoot)
 }
 
 // commit commits the current transaction.
@@ -198,7 +200,7 @@
 	if st.tx == nil {
 		vlog.Fatalf("No transaction to commit")
 	}
-	err := st.tx.Commit(rt.R().TODOContext())
+	err := st.tx.Commit(st.ctx)
 	st.tx = nil
 	if err != nil {
 		vlog.Errorf("Failed to commit transaction: %s", err)
@@ -374,10 +376,10 @@
 // main reads all the files in the templates directory and adds them to the
 // store.
 func main() {
-	rt.Init()
+	r := rt.Init()
 
 	vlog.Infof("Binding to store on %s", storeName)
-	state := newState(vstore.New(), storeName)
+	state := newState(r.NewContext(), vstore.New(), storeName)
 
 	// Store all data and templates.
 	filepath.Walk(*templatesDir, func(path string, _ os.FileInfo, _ error) error {
diff --git a/examples/rockpaperscissors/common/common.go b/examples/rockpaperscissors/common/common.go
index 6b56721..a8db778 100644
--- a/examples/rockpaperscissors/common/common.go
+++ b/examples/rockpaperscissors/common/common.go
@@ -10,6 +10,7 @@
 
 	rps "veyron/examples/rockpaperscissors"
 
+	"veyron2/context"
 	"veyron2/rt"
 	"veyron2/vlog"
 )
@@ -33,8 +34,8 @@
 }
 
 // FindJudge returns a random rock-paper-scissors judge from the mount table.
-func FindJudge() (string, error) {
-	judges, err := findAll("judge")
+func FindJudge(ctx context.T) (string, error) {
+	judges, err := findAll(ctx, "judge")
 	if err != nil {
 		return "", err
 	}
@@ -45,8 +46,8 @@
 }
 
 // FindPlayer returns a random rock-paper-scissors player from the mount table.
-func FindPlayer() (string, error) {
-	players, err := findAll("player")
+func FindPlayer(ctx context.T) (string, error) {
+	players, err := findAll(ctx, "player")
 	if err != nil {
 		return "", err
 	}
@@ -58,18 +59,18 @@
 
 // FindScoreKeepers returns all the rock-paper-scissors score keepers from the
 // mount table.
-func FindScoreKeepers() ([]string, error) {
-	sKeepers, err := findAll("scorekeeper")
+func FindScoreKeepers(ctx context.T) ([]string, error) {
+	sKeepers, err := findAll(ctx, "scorekeeper")
 	if err != nil {
 		return nil, err
 	}
 	return sKeepers, nil
 }
 
-func findAll(t string) ([]string, error) {
+func findAll(ctx context.T, t string) ([]string, error) {
 	start := time.Now()
 	ns := rt.R().Namespace()
-	c, err := ns.Glob(rt.R().TODOContext(), "rps/"+t+"/*")
+	c, err := ns.Glob(ctx, "rps/"+t+"/*")
 	if err != nil {
 		vlog.Infof("mt.Glob failed: %v", err)
 		return nil, err
diff --git a/examples/rockpaperscissors/impl/impl.go b/examples/rockpaperscissors/impl/impl.go
index 41fd8f6..7988802 100644
--- a/examples/rockpaperscissors/impl/impl.go
+++ b/examples/rockpaperscissors/impl/impl.go
@@ -4,6 +4,7 @@
 	"errors"
 
 	rps "veyron/examples/rockpaperscissors"
+	"veyron2"
 	"veyron2/ipc"
 	"veyron2/vlog"
 )
@@ -46,12 +47,12 @@
 	if len(names) == 0 {
 		return rps.PlayResult{}, errors.New("no names provided with remote ID")
 	}
-	return r.judge.play(names[0], id, stream)
+	return r.judge.play(ctx, names[0], id, stream)
 }
 
 func (r *RPS) Challenge(ctx ipc.ServerContext, address string, id rps.GameID, opts rps.GameOptions) error {
 	vlog.VI(1).Infof("Challenge (%q, %+v, %+v) from %s", address, id, opts, ctx.RemoteID())
-	return r.player.challenge(address, id, opts)
+	return r.player.challenge(veyron2.RuntimeFromContext(ctx), address, id, opts)
 }
 
 func (r *RPS) Record(ctx ipc.ServerContext, score rps.ScoreCard) error {
diff --git a/examples/rockpaperscissors/impl/impl_test.go b/examples/rockpaperscissors/impl/impl_test.go
index 703f76b..6e4971d 100644
--- a/examples/rockpaperscissors/impl/impl_test.go
+++ b/examples/rockpaperscissors/impl/impl_test.go
@@ -69,6 +69,9 @@
 func TestRockPaperScissorsImpl(t *testing.T) {
 	runtime := rt.Init()
 	defer runtime.Cleanup()
+
+	ctx := runtime.NewContext()
+
 	mtAddress, mtStop := startMountTable(t, runtime)
 	defer mtStop()
 	rpsService, rpsStop := startRockPaperScissors(t, runtime, mtAddress)
@@ -76,7 +79,7 @@
 
 	const numGames = 10
 	for x := 0; x < numGames; x++ {
-		if err := rpsService.Player().InitiateGame(); err != nil {
+		if err := rpsService.Player().InitiateGame(ctx); err != nil {
 			t.Errorf("Failed to initiate game: %v", err)
 		}
 	}
diff --git a/examples/rockpaperscissors/impl/judge.go b/examples/rockpaperscissors/impl/judge.go
index 6f295da..0b1a774 100644
--- a/examples/rockpaperscissors/impl/judge.go
+++ b/examples/rockpaperscissors/impl/judge.go
@@ -10,7 +10,7 @@
 	rps "veyron/examples/rockpaperscissors"
 	"veyron/examples/rockpaperscissors/common"
 
-	"veyron2/rt"
+	"veyron2/context"
 	"veyron2/vlog"
 )
 
@@ -105,7 +105,7 @@
 }
 
 // play interacts with a player for the duration of a game.
-func (j *Judge) play(name string, id rps.GameID, stream rps.JudgeServicePlayStream) (rps.PlayResult, error) {
+func (j *Judge) play(ctx context.T, name string, id rps.GameID, stream rps.JudgeServicePlayStream) (rps.PlayResult, error) {
 	vlog.VI(1).Infof("play from %q for %v", name, id)
 	nilResult := rps.PlayResult{}
 
@@ -126,7 +126,6 @@
 		rStream := stream.RecvStream()
 		for rStream.Advance() {
 			action := rStream.Value()
-
 			select {
 			case pIn <- playerInput{player: playerNum, action: action}:
 			case <-done:
@@ -152,7 +151,7 @@
 
 	// When the second player connects, we start the game.
 	if playerNum == 2 {
-		go j.manageGame(id)
+		go j.manageGame(ctx, id)
 	}
 	// Wait for the ScoreCard.
 	scoreData := <-s
@@ -162,7 +161,7 @@
 	return rps.PlayResult{YouWon: scoreData.score.Winner == rps.WinnerTag(playerNum)}, nil
 }
 
-func (j *Judge) manageGame(id rps.GameID) {
+func (j *Judge) manageGame(ctx context.T, id rps.GameID) {
 	j.gamesRun.Add(1)
 	j.lock.Lock()
 	info, exists := j.games[id]
@@ -215,14 +214,14 @@
 	}
 
 	// Send the score card to the score keepers.
-	keepers, err := common.FindScoreKeepers()
+	keepers, err := common.FindScoreKeepers(ctx)
 	if err != nil || len(keepers) == 0 {
 		vlog.Infof("No score keepers: %v", err)
 		return
 	}
 	done := make(chan bool)
 	for _, k := range keepers {
-		go j.sendScore(k, info.score, done)
+		go j.sendScore(ctx, k, info.score, done)
 	}
 	for _ = range keepers {
 		<-done
@@ -288,14 +287,14 @@
 	return info.playerIn, info.playerOut, info.scoreChan, nil
 }
 
-func (j *Judge) sendScore(address string, score rps.ScoreCard, done chan bool) error {
+func (j *Judge) sendScore(ctx context.T, address string, score rps.ScoreCard, done chan bool) error {
 	defer func() { done <- true }()
 	k, err := rps.BindRockPaperScissors(address)
 	if err != nil {
 		vlog.Infof("BindRockPaperScissors: %v", err)
 		return err
 	}
-	err = k.Record(rt.R().TODOContext(), score)
+	err = k.Record(ctx, score)
 	if err != nil {
 		vlog.Infof("Record: %v", err)
 		return err
diff --git a/examples/rockpaperscissors/impl/player.go b/examples/rockpaperscissors/impl/player.go
index 609fa28..4d845c8 100644
--- a/examples/rockpaperscissors/impl/player.go
+++ b/examples/rockpaperscissors/impl/player.go
@@ -7,7 +7,8 @@
 	rps "veyron/examples/rockpaperscissors"
 	"veyron/examples/rockpaperscissors/common"
 
-	"veyron2/rt"
+	"veyron2"
+	"veyron2/context"
 	"veyron2/vlog"
 )
 
@@ -34,13 +35,13 @@
 	}
 }
 
-func (p *Player) InitiateGame() error {
-	judge, err := common.FindJudge()
+func (p *Player) InitiateGame(ctx context.T) error {
+	judge, err := common.FindJudge(ctx)
 	if err != nil {
 		vlog.Infof("FindJudge: %v", err)
 		return err
 	}
-	gameID, gameOpts, err := p.createGame(judge)
+	gameID, gameOpts, err := p.createGame(ctx, judge)
 	if err != nil {
 		vlog.Infof("createGame: %v", err)
 		return err
@@ -48,18 +49,18 @@
 	vlog.VI(1).Infof("Created gameID %q on %q", gameID, judge)
 
 	for {
-		opponent, err := common.FindPlayer()
+		opponent, err := common.FindPlayer(ctx)
 		if err != nil {
 			vlog.Infof("FindPlayer: %v", err)
 			return err
 		}
 		vlog.VI(1).Infof("chosen opponent is %q", opponent)
-		if err = p.sendChallenge(opponent, judge, gameID, gameOpts); err == nil {
+		if err = p.sendChallenge(ctx, opponent, judge, gameID, gameOpts); err == nil {
 			break
 		}
 		vlog.Infof("sendChallenge: %v", err)
 	}
-	result, err := p.playGame(judge, gameID)
+	result, err := p.playGame(ctx, judge, gameID)
 	if err != nil {
 		vlog.Infof("playGame: %v", err)
 		return err
@@ -72,7 +73,7 @@
 	return nil
 }
 
-func (p *Player) createGame(server string) (rps.GameID, rps.GameOptions, error) {
+func (p *Player) createGame(ctx context.T, server string) (rps.GameID, rps.GameOptions, error) {
 	j, err := rps.BindRockPaperScissors(server)
 	if err != nil {
 		return rps.GameID{}, rps.GameOptions{}, err
@@ -83,35 +84,37 @@
 		gameType = rps.LizardSpock
 	}
 	gameOpts := rps.GameOptions{NumRounds: int32(numRounds), GameType: gameType}
-	gameId, err := j.CreateGame(rt.R().TODOContext(), gameOpts)
+	gameId, err := j.CreateGame(ctx, gameOpts)
 	return gameId, gameOpts, err
 }
 
-func (p *Player) sendChallenge(opponent, judge string, gameID rps.GameID, gameOpts rps.GameOptions) error {
+func (p *Player) sendChallenge(ctx context.T, opponent, judge string, gameID rps.GameID, gameOpts rps.GameOptions) error {
 	o, err := rps.BindRockPaperScissors(opponent)
 	if err != nil {
 		return err
 	}
-	return o.Challenge(rt.R().TODOContext(), judge, gameID, gameOpts)
+	return o.Challenge(ctx, judge, gameID, gameOpts)
 }
 
-// challenge receives an incoming challenge.
-func (p *Player) challenge(judge string, gameID rps.GameID, _ rps.GameOptions) error {
+// challenge receives an incoming challenge and starts to play a new game.
+// Note that the new game will occur in a new context.
+func (p *Player) challenge(rt veyron2.Runtime, judge string, gameID rps.GameID, _ rps.GameOptions) error {
 	vlog.VI(1).Infof("challenge received: %s %v", judge, gameID)
-	go p.playGame(judge, gameID)
+	go p.playGame(rt.NewContext(), judge, gameID)
 	return nil
 }
 
 // playGame plays an entire game, which really only consists of reading
 // commands from the server, and picking a random "move" when asked to.
-func (p *Player) playGame(judge string, gameID rps.GameID) (rps.PlayResult, error) {
+func (p *Player) playGame(outer context.T, judge string, gameID rps.GameID) (rps.PlayResult, error) {
+	ctx, cancel := outer.WithTimeout(10 * time.Minute)
+	defer cancel()
 	p.gamesInProgress.Add(1)
 	defer p.gamesInProgress.Add(-1)
 	j, err := rps.BindRockPaperScissors(judge)
 	if err != nil {
 		return rps.PlayResult{}, err
 	}
-	ctx, _ := rt.R().NewContext().WithTimeout(10 * time.Minute)
 	game, err := j.Play(ctx, gameID)
 	if err != nil {
 		return rps.PlayResult{}, err
@@ -120,7 +123,6 @@
 	sender := game.SendStream()
 	for rStream.Advance() {
 		in := rStream.Value()
-
 		if in.PlayerNum > 0 {
 			vlog.VI(1).Infof("I'm player %d", in.PlayerNum)
 		}
diff --git a/examples/rockpaperscissors/rpsbot/main.go b/examples/rockpaperscissors/rpsbot/main.go
index 37164ac..2e0d662 100644
--- a/examples/rockpaperscissors/rpsbot/main.go
+++ b/examples/rockpaperscissors/rpsbot/main.go
@@ -16,6 +16,7 @@
 	"veyron/examples/rockpaperscissors/impl"
 	"veyron/lib/signals"
 	sflag "veyron/security/flag"
+	"veyron2/context"
 	"veyron2/ipc"
 	"veyron2/rt"
 	"veyron2/vlog"
@@ -62,13 +63,14 @@
 	}
 	vlog.Infof("Listening on endpoint /%s (published as %v)", ep, names)
 
-	go initiateGames(rpsService)
+	ctx := r.NewContext()
+	go initiateGames(ctx, rpsService)
 	<-signals.ShutdownOnSignals()
 }
 
-func initiateGames(rpsService *impl.RPS) {
+func initiateGames(ctx context.T, rpsService *impl.RPS) {
 	for {
-		if err := rpsService.Player().InitiateGame(); err != nil {
+		if err := rpsService.Player().InitiateGame(ctx); err != nil {
 			vlog.Infof("Failed to initiate game: %v", err)
 		}
 	}
diff --git a/examples/rockpaperscissors/rpsplayercli/main.go b/examples/rockpaperscissors/rpsplayercli/main.go
index b60438d..0a2828c 100644
--- a/examples/rockpaperscissors/rpsplayercli/main.go
+++ b/examples/rockpaperscissors/rpsplayercli/main.go
@@ -17,6 +17,7 @@
 	sflag "veyron/security/flag"
 
 	"veyron2"
+	"veyron2/context"
 	"veyron2/ipc"
 	"veyron2/rt"
 	"veyron2/vlog"
@@ -32,13 +33,15 @@
 func main() {
 	r := rt.Init()
 	defer r.Cleanup()
+
 	for {
+		ctx := r.NewContext()
 		if selectOne([]string{"Initiate Game", "Wait For Challenge"}) == 0 {
-			initiateGame()
+			initiateGame(ctx)
 		} else {
 			fmt.Println("Waiting to receive a challenge...")
 			game := recvChallenge(r)
-			playGame(game.address, game.id)
+			playGame(ctx, game.address, game.id)
 		}
 		if selectOne([]string{"Play Again", "Quit"}) == 1 {
 			break
@@ -128,11 +131,11 @@
 // initiateGame initiates a new game by getting a list of judges and players,
 // and asking the user to select one of each, to select the game options, what
 // to play, etc.
-func initiateGame() error {
+func initiateGame(ctx context.T) error {
 	jChan := make(chan []string)
 	oChan := make(chan []string)
-	go findAll("judge", jChan)
-	go findAll("player", oChan)
+	go findAll(ctx, "judge", jChan)
+	go findAll(ctx, "player", oChan)
 
 	fmt.Println("Looking for available participants...")
 	judges := <-jChan
@@ -152,13 +155,13 @@
 	numRounds := selectOne([]string{"1", "2", "3", "4", "5", "6"}) + 1
 	gameOpts := rps.GameOptions{NumRounds: int32(numRounds), GameType: rps.GameTypeTag(gameType)}
 
-	gameID, err := createGame(judges[j], gameOpts)
+	gameID, err := createGame(ctx, judges[j], gameOpts)
 	if err != nil {
 		vlog.Infof("createGame: %v", err)
 		return err
 	}
 	for {
-		err := sendChallenge(opponents[o], judges[j], gameID, gameOpts)
+		err := sendChallenge(ctx, opponents[o], judges[j], gameID, gameOpts)
 		if err == nil {
 			break
 		}
@@ -167,37 +170,39 @@
 		o = selectOne(opponents)
 	}
 	fmt.Println("Joining the game...")
-	if _, err = playGame(judges[j], gameID); err != nil {
+
+	if _, err = playGame(ctx, judges[j], gameID); err != nil {
 		vlog.Infof("playGame: %v", err)
 		return err
 	}
 	return nil
 }
 
-func createGame(server string, opts rps.GameOptions) (rps.GameID, error) {
+func createGame(ctx context.T, server string, opts rps.GameOptions) (rps.GameID, error) {
 	j, err := rps.BindRockPaperScissors(server)
 	if err != nil {
 		return rps.GameID{}, err
 	}
-	return j.CreateGame(rt.R().TODOContext(), opts)
+	return j.CreateGame(ctx, opts)
 }
 
-func sendChallenge(opponent, judge string, gameID rps.GameID, gameOpts rps.GameOptions) error {
+func sendChallenge(ctx context.T, opponent, judge string, gameID rps.GameID, gameOpts rps.GameOptions) error {
 	o, err := rps.BindRockPaperScissors(opponent)
 	if err != nil {
 		return err
 	}
-	return o.Challenge(rt.R().TODOContext(), judge, gameID, gameOpts)
+	return o.Challenge(ctx, judge, gameID, gameOpts)
 }
 
-func playGame(judge string, gameID rps.GameID) (rps.PlayResult, error) {
+func playGame(outer context.T, judge string, gameID rps.GameID) (rps.PlayResult, error) {
+	ctx, cancel := outer.WithTimeout(10 * time.Minute)
+	defer cancel()
 	fmt.Println()
 	j, err := rps.BindRockPaperScissors(judge)
 	if err != nil {
 		return rps.PlayResult{}, err
 	}
 
-	ctx, _ := rt.R().NewContext().WithTimeout(10 * time.Minute)
 	game, err := j.Play(ctx, gameID)
 	if err != nil {
 		return rps.PlayResult{}, err
@@ -284,10 +289,10 @@
 	return
 }
 
-func findAll(t string, out chan []string) {
+func findAll(ctx context.T, t string, out chan []string) {
 	ns := rt.R().Namespace()
 	var result []string
-	c, err := ns.Glob(rt.R().TODOContext(), "rps/"+t+"/*")
+	c, err := ns.Glob(ctx, "rps/"+t+"/*")
 	if err != nil {
 		vlog.Infof("ns.Glob failed: %v", err)
 		out <- result
diff --git a/examples/todos/todos_init/main.go b/examples/todos/todos_init/main.go
index 0532ba8..9b696b0 100644
--- a/examples/todos/todos_init/main.go
+++ b/examples/todos/todos_init/main.go
@@ -11,6 +11,7 @@
 	"strings"
 
 	"veyron/examples/todos/schema"
+	"veyron2/context"
 	"veyron2/rt"
 	"veyron2/storage"
 	"veyron2/storage/vstore"
@@ -49,13 +50,14 @@
 // state is the initial store state.
 type state struct {
 	store     storage.Store
+	ctx       context.T
 	storeRoot string              // The name of the root of the store.
 	tx        storage.Transaction // Current transaction; nil if there's no transaction.
 }
 
 // newState returns a fresh state.
-func newState(st storage.Store, storeRoot string) *state {
-	return &state{store: st, storeRoot: storeRoot}
+func newState(ctx context.T, st storage.Store, storeRoot string) *state {
+	return &state{store: st, ctx: ctx, storeRoot: storeRoot}
 }
 
 // put adds a value to the store, creating the path to the value if it doesn't
@@ -63,7 +65,7 @@
 func (st *state) put(path string, v interface{}) {
 	vlog.Infof("Storing %q = %+v", path, v)
 	st.makeParentDirs(path)
-	if _, err := st.tx.Bind(path).Put(rt.R().TODOContext(), v); err != nil {
+	if _, err := st.tx.Bind(path).Put(st.ctx, v); err != nil {
 		vlog.Errorf("put failed: %s: %s", path, err)
 		return
 	}
@@ -76,10 +78,10 @@
 	for i, _ := range l {
 		prefix := filepath.Join(l[:i]...)
 		o := st.tx.Bind(prefix)
-		if exist, err := o.Exists(rt.R().TODOContext()); err != nil {
+		if exist, err := o.Exists(st.ctx); err != nil {
 			vlog.Infof("Error checking existence at %q: %s", prefix, err)
 		} else if !exist {
-			if _, err := o.Put(rt.R().TODOContext(), &schema.Dir{}); err != nil {
+			if _, err := o.Put(st.ctx, &schema.Dir{}); err != nil {
 				vlog.Infof("Error creating parent %q: %s", prefix, err)
 			}
 		}
@@ -91,7 +93,7 @@
 // examples.  It is better to pass a transaction around than risk the race
 // condition of st being used from multiple threads.
 func (st *state) newTransaction() {
-	st.tx = st.store.NewTransaction(rt.R().TODOContext(), st.storeRoot)
+	st.tx = st.store.NewTransaction(st.ctx, st.storeRoot)
 }
 
 // commit commits the current transaction.
@@ -99,7 +101,7 @@
 	if st.tx == nil {
 		vlog.Fatalf("No transaction to commit")
 	}
-	err := st.tx.Commit(rt.R().TODOContext())
+	err := st.tx.Commit(st.ctx)
 	st.tx = nil
 	if err != nil {
 		vlog.Errorf("Failed to commit transaction: %s", err)
@@ -160,10 +162,11 @@
 
 // main reads the data JSON file and populates the store.
 func main() {
-	rt.Init()
+	r := rt.Init()
+	ctx := r.NewContext()
 
 	vlog.Infof("Binding to store on %s", storeName)
-	state := newState(vstore.New(), storeName)
+	state := newState(ctx, vstore.New(), storeName)
 
 	if err := state.processJSONFile(*dataPath); err != nil {
 		vlog.Errorf("Failed to write data: %s", err)
diff --git a/runtimes/google/ipc/benchmarks/bmclient/main.go b/runtimes/google/ipc/benchmarks/bmclient/main.go
index 3afee8c..6065f1c 100644
--- a/runtimes/google/ipc/benchmarks/bmclient/main.go
+++ b/runtimes/google/ipc/benchmarks/bmclient/main.go
@@ -18,9 +18,10 @@
 )
 
 func main() {
-	rt.Init()
+	r := rt.Init()
+	ctx := r.NewContext()
 	if *chunkCount == 0 {
-		benchmarks.CallEcho(*server, *count, *payloadSize, os.Stdout)
+		benchmarks.CallEcho(ctx, *server, *count, *payloadSize, os.Stdout)
 	} else {
 		benchmarks.CallEchoStream(*server, *count, *chunkCount, *payloadSize, os.Stdout)
 	}
diff --git a/runtimes/google/ipc/benchmarks/bmserver/main.go b/runtimes/google/ipc/benchmarks/bmserver/main.go
index d0e5d25..98ac76f 100644
--- a/runtimes/google/ipc/benchmarks/bmserver/main.go
+++ b/runtimes/google/ipc/benchmarks/bmserver/main.go
@@ -19,8 +19,8 @@
 )
 
 func main() {
-	rt.Init()
-	addr, stop := benchmarks.StartServer(*protocol, *address)
+	r := rt.Init()
+	addr, stop := benchmarks.StartServer(r, *protocol, *address)
 	vlog.Infof("Listening on %s", addr)
 	defer stop()
 	<-signals.ShutdownOnSignals()
diff --git a/runtimes/google/ipc/benchmarks/client.go b/runtimes/google/ipc/benchmarks/client.go
index 282714a..f3e4066 100644
--- a/runtimes/google/ipc/benchmarks/client.go
+++ b/runtimes/google/ipc/benchmarks/client.go
@@ -6,13 +6,14 @@
 	"io"
 	"time"
 
+	"veyron2/context"
 	"veyron2/rt"
 	"veyron2/vlog"
 )
 
 // CallEcho calls the Echo method 'iterations' times with the given payload
 // size, and optionally logs the result.
-func CallEcho(address string, iterations, payloadSize int, log io.Writer) {
+func CallEcho(ctx context.T, address string, iterations, payloadSize int, log io.Writer) {
 	payload := make([]byte, payloadSize)
 	for _, i := range payload {
 		payload[i] = byte(i & 0xff)
@@ -25,7 +26,7 @@
 
 	for i := 0; i < iterations; i++ {
 		start := time.Now()
-		result, err := stub.Echo(rt.R().TODOContext(), payload)
+		result, err := stub.Echo(ctx, payload)
 		elapsed := time.Since(start)
 		if err != nil {
 			vlog.Fatalf("Echo failed: %v", err)
diff --git a/runtimes/google/ipc/benchmarks/ipc_test.go b/runtimes/google/ipc/benchmarks/ipc_test.go
index 411869f..00dac63 100644
--- a/runtimes/google/ipc/benchmarks/ipc_test.go
+++ b/runtimes/google/ipc/benchmarks/ipc_test.go
@@ -8,20 +8,19 @@
 	"veyron2/rt"
 )
 
-func init() {
-	rt.Init()
-}
+var runtime = rt.Init()
 
 func RunBenchmark(b *testing.B, payloadSize int) {
-	address, stop := benchmarks.StartServer("tcp", "127.0.0.1:0")
+	address, stop := benchmarks.StartServer(runtime, "tcp", "127.0.0.1:0")
+	ctx := runtime.NewContext()
 	defer stop()
-	benchmarks.CallEcho(address, 1, 1, nil) // Create VC
+	benchmarks.CallEcho(ctx, address, 1, 1, nil) // Create VC
 	b.ResetTimer()
-	benchmarks.CallEcho(address, b.N, payloadSize, nil)
+	benchmarks.CallEcho(ctx, address, b.N, payloadSize, nil)
 }
 
 func RunStreamBenchmark(b *testing.B, rpcCount, messageCount, payloadSize int) {
-	address, stop := benchmarks.StartServer("tcp", "127.0.0.1:0")
+	address, stop := benchmarks.StartServer(runtime, "tcp", "127.0.0.1:0")
 	defer stop()
 	benchmarks.CallEchoStream(address, 1, 1, 1, nil) // Create VC
 	b.ResetTimer()
diff --git a/runtimes/google/ipc/benchmarks/server.go b/runtimes/google/ipc/benchmarks/server.go
index dd884a1..fc14397 100644
--- a/runtimes/google/ipc/benchmarks/server.go
+++ b/runtimes/google/ipc/benchmarks/server.go
@@ -3,9 +3,9 @@
 import (
 	sflag "veyron/security/flag"
 
+	"veyron2"
 	"veyron2/ipc"
 	"veyron2/naming"
-	"veyron2/rt"
 	"veyron2/vlog"
 )
 
@@ -32,8 +32,8 @@
 // StartServer starts a server that implements the Benchmark service. The
 // server listens to the given protocol and address, and returns the veyron
 // address of the server and a callback function to stop the server.
-func StartServer(protocol, address string) (string, func()) {
-	server, err := rt.R().NewServer()
+func StartServer(runtime veyron2.Runtime, protocol, address string) (string, func()) {
+	server, err := runtime.NewServer()
 	if err != nil {
 		vlog.Fatalf("NewServer failed: %v", err)
 	}
diff --git a/runtimes/google/ipc/context_test.go b/runtimes/google/ipc/context_test.go
index 5617c14..e5ac557 100644
--- a/runtimes/google/ipc/context_test.go
+++ b/runtimes/google/ipc/context_test.go
@@ -40,7 +40,6 @@
 func (*rt) NewServer(opts ...ipc.ServerOpt) (ipc.Server, error)                  { panic(badRuntime) }
 func (*rt) Client() ipc.Client                                                   { panic(badRuntime) }
 func (*rt) NewContext() context.T                                                { panic(badRuntime) }
-func (*rt) TODOContext() context.T                                               { panic(badRuntime) }
 func (*rt) NewStreamManager(opts ...stream.ManagerOpt) (stream.Manager, error)   { panic(badRuntime) }
 func (*rt) NewEndpoint(ep string) (naming.Endpoint, error)                       { panic(badRuntime) }
 func (*rt) Namespace() naming.Namespace                                          { panic(badRuntime) }
diff --git a/runtimes/google/rt/ipc.go b/runtimes/google/rt/ipc.go
index 77628e7..d978865 100644
--- a/runtimes/google/rt/ipc.go
+++ b/runtimes/google/rt/ipc.go
@@ -105,10 +105,6 @@
 	return iipc.InternalNewContext(rt)
 }
 
-func (rt *vrt) TODOContext() context.T {
-	return iipc.InternalNewContext(rt)
-}
-
 func (rt *vrt) NewServer(opts ...ipc.ServerOpt) (ipc.Server, error) {
 	var err error
 
diff --git a/services/store/stored/main.go b/services/store/stored/main.go
index c4d09b9..7d8b3a9 100644
--- a/services/store/stored/main.go
+++ b/services/store/stored/main.go
@@ -92,7 +92,7 @@
 
 	// Run viewer if requested.
 	if *viewerPort > 0 {
-		go viewer.ListenAndServe(fmt.Sprintf(":%d", *viewerPort), mountName, vstore.New())
+		go viewer.ListenAndServe(r, fmt.Sprintf(":%d", *viewerPort), mountName, vstore.New())
 	}
 
 	// Wait forever.
diff --git a/services/store/viewer/value.go b/services/store/viewer/value.go
index b2ab106..1999837 100644
--- a/services/store/viewer/value.go
+++ b/services/store/viewer/value.go
@@ -5,7 +5,7 @@
 	"sort"
 	"time"
 
-	"veyron2/rt"
+	"veyron2/context"
 	"veyron2/storage"
 )
 
@@ -20,8 +20,8 @@
 }
 
 // glob performs a glob expansion of the pattern.  The results are sorted.
-func glob(st storage.Store, path, pattern string) ([]string, error) {
-	results := st.Bind(path).Glob(rt.R().TODOContext(), pattern)
+func glob(ctx context.T, st storage.Store, path, pattern string) ([]string, error) {
+	results := st.Bind(path).Glob(ctx, pattern)
 	names := []string{}
 	rStream := results.RecvStream()
 	for rStream.Advance() {
@@ -59,15 +59,15 @@
 }
 
 // Glob performs a glob expansion of a pattern.
-func (v *Value) Glob(pattern string) ([]string, error) {
-	return glob(v.store, v.Name, pattern)
+func (v *Value) Glob(ctx context.T, pattern string) ([]string, error) {
+	return glob(ctx, v.store, v.Name, pattern)
 }
 
 // Get fetches a value from the store.  The result is nil if the value does not
 // exist.
-func (v *Value) Get(path string) interface{} {
+func (v *Value) Get(ctx context.T, path string) interface{} {
 	path = v.fullpath(path)
-	e, err := v.store.Bind(path).Get(rt.R().TODOContext())
+	e, err := v.store.Bind(path).Get(ctx)
 	if err != nil {
 		return nil
 	}
diff --git a/services/store/viewer/viewer.go b/services/store/viewer/viewer.go
index 372062b..4d64621 100644
--- a/services/store/viewer/viewer.go
+++ b/services/store/viewer/viewer.go
@@ -26,8 +26,9 @@
 	"net/http"
 	"path/filepath"
 
+	"veyron2"
+	"veyron2/context"
 	"veyron2/naming"
-	"veyron2/rt"
 	"veyron2/storage"
 	"veyron2/vlog"
 )
@@ -36,6 +37,7 @@
 type server struct {
 	storeRoot string
 	store     storage.Store
+	runtime   veyron2.Runtime
 }
 
 var _ http.Handler = (*server)(nil)
@@ -75,9 +77,9 @@
 
 // loadTemplate fetches the template for the value from the store.  The template
 // is based on the type of the value, under /template/<pkgPath>/<typeName>.
-func (s *server) loadTemplate(v interface{}) *template.Template {
+func (s *server) loadTemplate(ctx context.T, v interface{}) *template.Template {
 	path := naming.Join(s.storeRoot, templatePath(v))
-	e, err := s.store.Bind(path).Get(rt.R().TODOContext())
+	e, err := s.store.Bind(path).Get(ctx)
 	if err != nil {
 		return nil
 	}
@@ -94,10 +96,10 @@
 }
 
 // printRawValuePage prints the value in raw format.
-func (s *server) printRawValuePage(w http.ResponseWriter, path string, v interface{}) {
+func (s *server) printRawValuePage(ctx context.T, w http.ResponseWriter, path string, v interface{}) {
 	var p printer
 	p.print(v)
-	subdirs, _ := glob(s.store, path, "*")
+	subdirs, _ := glob(ctx, s.store, path, "*")
 	x := &Value{Name: path, Value: p.String(), Subdirs: subdirs}
 	if err := rawTemplate.Execute(w, x); err != nil {
 		w.Write([]byte(html.EscapeString(err.Error())))
@@ -106,14 +108,14 @@
 
 // printValuePage prints the value using a template if possible.  If a template
 // is not found, the value is printed in raw format instead.
-func (s *server) printValuePage(w http.ResponseWriter, path string, v interface{}) {
-	if tmpl := s.loadTemplate(v); tmpl != nil {
+func (s *server) printValuePage(ctx context.T, w http.ResponseWriter, path string, v interface{}) {
+	if tmpl := s.loadTemplate(ctx, v); tmpl != nil {
 		if err := tmpl.Execute(w, &Value{store: s.store, Name: path, Value: v}); err != nil {
 			w.Write([]byte(html.EscapeString(err.Error())))
 		}
 		return
 	}
-	s.printRawValuePage(w, path, v)
+	s.printRawValuePage(ctx, w, path, v)
 }
 
 // printRawPage prints a string value directly, without processing.
@@ -129,7 +131,8 @@
 // ServeHTTP is the main HTTP handler.
 func (s *server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
 	path := naming.Join(s.storeRoot, req.URL.Path)
-	e, err := s.store.Bind(path).Get(rt.R().TODOContext())
+	ctx := s.runtime.NewContext()
+	e, err := s.store.Bind(path).Get(ctx)
 	if err != nil {
 		msg := fmt.Sprintf("<html><body><h1>%s</h1><h2>Error: %s</h2></body></html>",
 			html.EscapeString(path),
@@ -145,17 +148,17 @@
 		s.printRawPage(w, e.Value)
 	default:
 		if q["raw"] != nil {
-			s.printRawValuePage(w, path, e.Value)
+			s.printRawValuePage(ctx, w, path, e.Value)
 		} else {
-			s.printValuePage(w, path, e.Value)
+			s.printValuePage(ctx, w, path, e.Value)
 		}
 	}
 }
 
 // ListenAndServe is the main entry point.  It serves store at the specified
 // network address.
-func ListenAndServe(addr string, storeRoot string, st storage.Store) error {
-	s := &server{storeRoot: storeRoot, store: st}
+func ListenAndServe(runtime veyron2.Runtime, addr string, storeRoot string, st storage.Store) error {
+	s := &server{storeRoot: storeRoot, store: st, runtime: runtime}
 	vlog.Infof("Viewer running at http://localhost%s", addr)
 	return http.ListenAndServe(addr, s)
 }
diff --git a/services/wsprd/app/app.go b/services/wsprd/app/app.go
index f905118..abe25d9 100644
--- a/services/wsprd/app/app.go
+++ b/services/wsprd/app/app.go
@@ -15,6 +15,7 @@
 	"veyron/services/wsprd/lib"
 	"veyron/services/wsprd/signature"
 	"veyron2"
+	"veyron2/context"
 	"veyron2/ipc"
 	"veyron2/rt"
 	"veyron2/verror"
@@ -167,14 +168,14 @@
 	}
 }
 
-func (c *Controller) startCall(w lib.ClientWriter, msg *veyronRPC) (ipc.Call, error) {
+func (c *Controller) startCall(ctx context.T, w lib.ClientWriter, msg *veyronRPC) (ipc.Call, error) {
 	c.Lock()
 	defer c.Unlock()
 	if c.client == nil {
 		return nil, verror.BadArgf("no client created")
 	}
 	methodName := lib.UppercaseFirstCharacter(msg.Method)
-	clientCall, err := c.client.StartCall(c.rt.TODOContext(), msg.Name, methodName, msg.InArgs)
+	clientCall, err := c.client.StartCall(ctx, msg.Name, methodName, msg.InArgs)
 	if err != nil {
 		return nil, fmt.Errorf("error starting call (name: %v, method: %v, args: %v): %v", msg.Name, methodName, msg.InArgs, err)
 	}
@@ -272,10 +273,10 @@
 
 // SendVeyronRequest makes a veyron request for the given flowId.  If signal is non-nil, it will receive
 // the call object after it has been constructed.
-func (c *Controller) sendVeyronRequest(id int64, veyronMsg *veyronRPC, w lib.ClientWriter, signal chan ipc.Stream) {
+func (c *Controller) sendVeyronRequest(ctx context.T, id int64, veyronMsg *veyronRPC, w lib.ClientWriter, signal chan ipc.Stream) {
 	// We have to make the start call synchronous so we can make sure that we populate
 	// the call map before we can Handle a recieve call.
-	call, err := c.startCall(w, veyronMsg)
+	call, err := c.startCall(ctx, w, veyronMsg)
 	if err != nil {
 		w.Error(verror.Internalf("can't start Veyron Request: %v", err))
 		return
@@ -294,8 +295,8 @@
 }
 
 // HandleVeyronRequest starts a veyron rpc and returns before the rpc has been completed.
-func (c *Controller) HandleVeyronRequest(id int64, data string, w lib.ClientWriter) {
-	veyronMsg, inStreamType, err := c.parseVeyronRequest(bytes.NewBufferString(data))
+func (c *Controller) HandleVeyronRequest(ctx context.T, id int64, data string, w lib.ClientWriter) {
+	veyronMsg, inStreamType, err := c.parseVeyronRequest(ctx, bytes.NewBufferString(data))
 	if err != nil {
 		w.Error(verror.Internalf("can't parse Veyron Request: %v", err))
 		return
@@ -316,7 +317,7 @@
 			inType: inStreamType,
 		}
 	}
-	go c.sendVeyronRequest(id, veyronMsg, w, signal)
+	go c.sendVeyronRequest(ctx, id, veyronMsg, w, signal)
 }
 
 // CloseStream closes the stream for a given id.
@@ -437,7 +438,7 @@
 }
 
 // parseVeyronRequest parses a json rpc request into a veyronRPC object.
-func (c *Controller) parseVeyronRequest(r io.Reader) (*veyronRPC, vom.Type, error) {
+func (c *Controller) parseVeyronRequest(ctx context.T, r io.Reader) (*veyronRPC, vom.Type, error) {
 	var tempMsg veyronTempRPC
 	decoder := json.NewDecoder(r)
 	if err := decoder.Decode(&tempMsg); err != nil {
@@ -445,7 +446,6 @@
 	}
 
 	// Fetch and adapt signature from the SignatureManager
-	ctx := c.rt.TODOContext()
 	sig, err := c.signatureManager.Signature(ctx, tempMsg.Name, c.client)
 	if err != nil {
 		return nil, nil, verror.Internalf("error getting service signature for %s: %v", tempMsg.Name, err)
@@ -496,9 +496,8 @@
 	Name string
 }
 
-func (c *Controller) getSignature(name string) (signature.JSONServiceSignature, error) {
+func (c *Controller) getSignature(ctx context.T, name string) (signature.JSONServiceSignature, error) {
 	// Fetch and adapt signature from the SignatureManager
-	ctx := c.rt.TODOContext()
 	sig, err := c.signatureManager.Signature(ctx, name, c.client)
 	if err != nil {
 		return nil, verror.Internalf("error getting service signature for %s: %v", name, err)
@@ -508,7 +507,7 @@
 }
 
 // HandleSignatureRequest uses signature manager to get and cache signature of a remote server
-func (c *Controller) HandleSignatureRequest(data string, w lib.ClientWriter) {
+func (c *Controller) HandleSignatureRequest(ctx context.T, data string, w lib.ClientWriter) {
 	// Decode the request
 	var request signatureRequest
 	decoder := json.NewDecoder(bytes.NewBufferString(data))
@@ -518,7 +517,7 @@
 	}
 
 	c.logger.VI(2).Infof("requesting Signature for %q", request.Name)
-	jsSig, err := c.getSignature(request.Name)
+	jsSig, err := c.getSignature(ctx, request.Name)
 	if err != nil {
 		w.Error(err)
 		return
diff --git a/services/wsprd/app/app_test.go b/services/wsprd/app/app_test.go
index 7e4fdf8..930f79d 100644
--- a/services/wsprd/app/app_test.go
+++ b/services/wsprd/app/app_test.go
@@ -26,11 +26,7 @@
 	mounttable "veyron/services/mounttable/lib"
 )
 
-var r veyron2.Runtime
-
-func init() {
-	r = rt.Init()
-}
+var r = rt.Init()
 
 type simpleAdder struct{}
 
@@ -245,7 +241,7 @@
 	if err != nil {
 		t.Errorf("Failed to create controller: %v", err)
 	}
-	jsSig, err := controller.getSignature("/" + endpoint.String())
+	jsSig, err := controller.getSignature(r.NewContext(), "/"+endpoint.String())
 	if err != nil {
 		t.Errorf("Failed to get signature: %v", err)
 	}
@@ -307,7 +303,7 @@
 		NumOutArgs:  test.numOutArgs,
 		IsStreaming: signal != nil,
 	}
-	controller.sendVeyronRequest(0, &request, &writer, signal)
+	controller.sendVeyronRequest(r.NewContext(), 0, &request, &writer, signal)
 
 	checkResponses(&writer, test.expectedStream, test.expectedError, t)
 }
diff --git a/services/wsprd/wspr/pipe.go b/services/wsprd/wspr/pipe.go
index c6f981c..14be0eb 100644
--- a/services/wsprd/wspr/pipe.go
+++ b/services/wsprd/wspr/pipe.go
@@ -235,7 +235,10 @@
 
 		switch msg.Type {
 		case websocketVeyronRequest:
-			p.controller.HandleVeyronRequest(msg.Id, msg.Data, ww)
+			// TODO(mattr): Get the proper context information
+			// from javascript.
+			ctx := p.wspr.rt.NewContext()
+			p.controller.HandleVeyronRequest(ctx, msg.Id, msg.Data, ww)
 		case websocketStreamingValue:
 			// This will asynchronous for a client rpc, but synchronous for a
 			// server rpc.  This could be potentially bad if the server is sending
@@ -253,7 +256,10 @@
 		case websocketServerResponse:
 			go p.controller.HandleServerResponse(msg.Id, msg.Data)
 		case websocketSignatureRequest:
-			go p.controller.HandleSignatureRequest(msg.Data, ww)
+			// TODO(mattr): Get the proper context information
+			// from javascript.
+			ctx := p.wspr.rt.NewContext()
+			go p.controller.HandleSignatureRequest(ctx, msg.Data, ww)
 		default:
 			ww.Error(verror.Unknownf("unknown message type: %v", msg.Type))
 		}
diff --git a/tools/qsh/impl/impl.go b/tools/qsh/impl/impl.go
index 3494882..a813706 100644
--- a/tools/qsh/impl/impl.go
+++ b/tools/qsh/impl/impl.go
@@ -6,8 +6,8 @@
 	"os"
 	"sort"
 
+	"veyron2/context"
 	"veyron2/query"
-	"veyron2/rt"
 	"veyron2/storage"
 	"veyron2/storage/vstore"
 
@@ -69,7 +69,6 @@
 	return nil
 }
 
-func RunQuery(queryRoot, queryString string) error {
-	ctx := rt.R().TODOContext()
+func RunQuery(ctx context.T, queryRoot, queryString string) error {
 	return printStream(vstore.New().Bind(queryRoot).Query(ctx, query.Query{queryString}), os.Stdout, 0)
 }
diff --git a/tools/qsh/main.go b/tools/qsh/main.go
index 80e3885..2a4a4c3 100644
--- a/tools/qsh/main.go
+++ b/tools/qsh/main.go
@@ -19,7 +19,7 @@
 `
 
 func main() {
-	rt.Init()
+	r := rt.Init()
 
 	// TODO(rjkroege@google.com): Handle ^c nicely.
 	flag.Parse()
@@ -33,7 +33,7 @@
 		log.Fatalf("qsh: No queryroot specified\n" + usage)
 	}
 
-	err := impl.RunQuery(queryRoot, queryStringArgs[0])
+	err := impl.RunQuery(r.NewContext(), queryRoot, queryStringArgs[0])
 	if err != nil {
 		log.Printf("qsh: When attempting query: \"%s\" experienced an error: ", queryStringArgs[0], err.Error())
 	}